ashb commented on code in PR #29039:
URL: https://github.com/apache/airflow/pull/29039#discussion_r1081321019


##########
airflow/www/views.py:
##########
@@ -154,6 +154,18 @@ def truncate_task_duration(task_duration):
     return int(task_duration) if task_duration > 10.0 else 
round(task_duration, 3)
 
 
+def sanitize_args(args: dict[str, str]) -> dict[str, str]:
+    """
+    Remove all parameters starting with `_`
+    :param args: arguments of request
+    :return: the dictionary passed as input with args starting with `_` 
removed.
+    """
+    for key in list(args.keys()):
+        if key.startswith("_"):
+            del args[key]
+    return args

Review Comment:
   This mutates args in place which might be unexpected/cause some unforeseen 
issues down the line so:
   
   ```suggestion
       return {
           key: value
           for key, value in args.items()
           if not key.startswith("_")
       }
   ```



-- 
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]

Reply via email to