From 15487a6f4d2edbafe15b332fab5813098b81914a Mon Sep 17 00:00:00 2001 From: melindaloubser1 Date: Tue, 7 Jun 2022 13:17:33 +0200 Subject: [PATCH 1/2] silence pillow deprecation warnings --- changelog/11173.misc.md | 1 + rasa/utils/common.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changelog/11173.misc.md diff --git a/changelog/11173.misc.md b/changelog/11173.misc.md new file mode 100644 index 000000000000..4d017341cf06 --- /dev/null +++ b/changelog/11173.misc.md @@ -0,0 +1 @@ +Silence noisy deprecation warnings about Pillow methods generated by keras-preprocessing. \ No newline at end of file diff --git a/rasa/utils/common.py b/rasa/utils/common.py index bc4ce03677ec..f0b2164880e2 100644 --- a/rasa/utils/common.py +++ b/rasa/utils/common.py @@ -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) ( @@ -51,7 +58,7 @@ "shape. This may consume a large amount of memory.", ), (UserWarning, "Slot auto-fill has been removed in 3.0 .*"), -] +] + EXPECTED_PILLOW_DEPRECATION_WARNINGS class TempDirectoryPath(str, ContextManager): From b7af6e63476714f5c89666186e655bd8de4e4770 Mon Sep 17 00:00:00 2001 From: melindaloubser1 Date: Tue, 7 Jun 2022 18:39:48 +0200 Subject: [PATCH 2/2] ignore importlib warning --- rasa/utils/common.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rasa/utils/common.py b/rasa/utils/common.py index f0b2164880e2..5b8df4288d9d 100644 --- a/rasa/utils/common.py +++ b/rasa/utils/common.py @@ -58,6 +58,11 @@ "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