amoghrajesh commented on code in PR #53929:
URL: https://github.com/apache/airflow/pull/53929#discussion_r2253945019


##########
task-sdk/src/airflow/sdk/definitions/mappedoperator.py:
##########
@@ -144,6 +154,21 @@ def is_mappable_value(value: Any) -> TypeGuard[Collection]:
     return True
 
 
+def prevent_duplicates(kwargs1: dict[str, Any], kwargs2: Mapping[str, Any], *, 
fail_reason: str) -> None:
+    """
+    Ensure *kwargs1* and *kwargs2* do not contain common keys.
+
+    :raises TypeError: If common keys are found.
+    """
+    duplicated_keys = set(kwargs1).intersection(kwargs2)
+    if not duplicated_keys:
+        return
+    if len(duplicated_keys) == 1:
+        raise TypeError(f"{fail_reason} argument: {duplicated_keys.pop()}")
+    duplicated_keys_display = ", ".join(sorted(duplicated_keys))
+    raise TypeError(f"{fail_reason} arguments: {duplicated_keys_display}")

Review Comment:
   Deleted it and handled compat too. It works fine as shown in PR desc.



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to