You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "vincbeck (via GitHub)" <gi...@apache.org> on 2023/07/17 14:22:20 UTC

[GitHub] [airflow] vincbeck commented on a diff in pull request #32573: Fix bug in prune_dict where empty dict and list would be removed even in strict mode

vincbeck commented on code in PR #32573:
URL: https://github.com/apache/airflow/pull/32573#discussion_r1265444127


##########
airflow/providers/amazon/aws/utils/__init__.py:
##########
@@ -18,16 +18,29 @@
 
 import logging
 import re
+import warnings
 from datetime import datetime
 from enum import Enum
 
+from airflow.exceptions import AirflowProviderDeprecationWarning
+from airflow.utils.helpers import prune_dict
 from airflow.version import version
 
 log = logging.getLogger(__name__)
 
 
 def trim_none_values(obj: dict):
-    return {key: val for key, val in obj.items() if val is not None}
+    from packaging.version import Version
+
+    from airflow.version import version
+
+    if Version(version) < Version("2.7"):
+        return {key: val for key, val in obj.items() if val is not None}
+    else:
+        warnings.warn(
+            "use airflow.utils.helpers.prune_dict() instead", AirflowProviderDeprecationWarning, stacklevel=2
+        )

Review Comment:
   But they wont see this warning right? You are testing the Airflow version right before



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org