Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence pillow deprecation warnings #11173

Merged
merged 4 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/11173.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Silence noisy deprecation warnings about Pillow methods generated by keras-preprocessing.
14 changes: 13 additions & 1 deletion rasa/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@

T = TypeVar("T")

EXPECTED_PILLOW_DEPRECATION_WARNINGS = [
# Keras uses deprecated Pillow features
# cf. https://github.com/keras-team/keras/issues/16639
(DeprecationWarning, f"{method} is deprecated and will be removed in Pillow 10 .*")
for method in ["BICUBIC", "NEAREST", "BILINEAR", "HAMMING", "BOX", "LANCZOS"]
]

EXPECTED_WARNINGS = [
# TODO (issue #9932)
(
Expand All @@ -51,7 +58,12 @@
"shape. This may consume a large amount of memory.",
),
(UserWarning, "Slot auto-fill has been removed in 3.0 .*"),
]
# This warning is caused by the flatbuffers package
# The import was fixed on Github, but the latest version
# is not available on PyPi, so we cannot pin the newer version.
# cf. https://github.com/google/flatbuffers/issues/6957
(DeprecationWarning, "the imp module is deprecated in favour of importlib.*"),
] + EXPECTED_PILLOW_DEPRECATION_WARNINGS


class TempDirectoryPath(str, ContextManager):
Expand Down