Description
pathlib.Path is widely used and preferred over os for file system operations in modern Python. It would be beneficial to support pathlib.Path
Related code
|
def convert( |
|
self, source: Union[str, requests.Response], **kwargs: Any |
|
) -> DocumentConverterResult: # TODO: deal with kwargs |
|
""" |
|
Args: |
|
- source: can be a string representing a path or url, or a requests.response object |
|
- extension: specifies the file extension to use when interpreting the file. If None, infer from source (path, uri, content-type, etc.) |
|
""" |
|
|
|
# Local path or url |
|
if isinstance(source, str): |
|
if ( |
|
source.startswith("http://") |
|
or source.startswith("https://") |
|
or source.startswith("file://") |
|
): |
|
return self.convert_url(source, **kwargs) |
|
else: |
|
return self.convert_local(source, **kwargs) |
|
# Request response |
|
elif isinstance(source, requests.Response): |
|
return self.convert_response(source, **kwargs) |
Description
pathlib.Pathis widely used and preferred overosfor file system operations in modern Python. It would be beneficial to support pathlib.PathRelated code
markitdown/src/markitdown/_markitdown.py
Lines 1044 to 1065 in ad5d4fb