enhancement: improve detect_filetype warning to include filename (#355)

* Improve warning to include filename if provided

* Update changelog & version
This commit is contained in:
Tom Aarsen 2023-03-10 18:26:08 +01:00 committed by GitHub
parent c51adb21e3
commit 3d21b4098e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -1,8 +1,7 @@
## 0.5.4-dev1 ## 0.5.4-dev2
### Enhancements ### Enhancements
* Add `FsspecConnector` to easily integrate any existing `fsspec` filesystem as a connector. * Add `FsspecConnector` to easily integrate any existing `fsspec` filesystem as a connector.
* Rename `s3_connector.py` to `s3.py` for readability and consistency with the * Rename `s3_connector.py` to `s3.py` for readability and consistency with the
rest of the connectors. rest of the connectors.
@ -11,6 +10,7 @@
* Adds an `UNSTRUCTURED_LANGUAGE_CHECKS` environment variable to control whether or not language * Adds an `UNSTRUCTURED_LANGUAGE_CHECKS` environment variable to control whether or not language
specific checks like vocabulary and POS tagging are applied. Set to `"true"` for higher specific checks like vocabulary and POS tagging are applied. Set to `"true"` for higher
resolution partitioning and `"false"` for faster processing. resolution partitioning and `"false"` for faster processing.
* Improves `detect_filetype` warning to include filename when provided.
### Features ### Features

View File

@ -1 +1 @@
__version__ = "0.5.4-dev1" # pragma: no cover __version__ = "0.5.4-dev2" # pragma: no cover

View File

@ -229,7 +229,8 @@ def detect_filetype(
return EXT_TO_FILETYPE.get(extension.lower(), filetype) return EXT_TO_FILETYPE.get(extension.lower(), filetype)
logger.warning( logger.warning(
f"MIME type was {mime_type}. This file type is not currently supported in unstructured.", f"The MIME type{f' of {filename!r}' if filename else ''} is {mime_type!r}. "
"This file type is not currently supported in unstructured.",
) )
return FileType.UNK return FileType.UNK