amoghrajesh commented on code in PR #53870:
URL: https://github.com/apache/airflow/pull/53870#discussion_r2268753126
##########
task-sdk/src/airflow/sdk/definitions/connection.py:
##########
@@ -30,6 +30,49 @@
log = logging.getLogger(__name__)
+def _prune_dict(val: Any, mode="strict"):
+ """
+ Given dict ``val``, returns new dict based on ``val`` with all empty
elements removed.
+
+ What constitutes "empty" is controlled by the ``mode`` parameter. If mode
is 'strict'
+ then only ``None`` elements will be removed. If mode is ``truthy``, then
element ``x``
+ will be removed if ``bool(x) is False``.
+ """
+
+ def is_empty(x):
+ if mode == "strict":
+ return x is None
+ if mode == "truthy":
+ return bool(x) is False
+ raise ValueError("allowable values for `mode` include 'truthy' and
'strict'")
Review Comment:
Handled in
https://github.com/apache/airflow/pull/53870/commits/85619c01edc94dad998021198dd719a93f4b06e5
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]