ashb commented on a change in pull request #21641:
URL: https://github.com/apache/airflow/pull/21641#discussion_r808983807
##########
File path: airflow/decorators/base.py
##########
@@ -269,22 +276,21 @@ def __call__(self, *args, **kwargs) -> XComArg:
op.doc_md = self.function.__doc__
return XComArg(op)
- def _validate_arg_names(self, funcname: str, kwargs: Dict[str, Any],
valid_names: Set[str] = set()):
- unknown_args = kwargs.copy()
- for name in itertools.chain(self.function_arg_names, valid_names):
- unknown_args.pop(name, None)
-
- if not unknown_args:
- # If we have no args left ot check, we are valid
- return
+ def _validate_arg_names(self, func: ValidationSource, kwargs: Dict[str,
Any]):
+ kwargs_left = kwargs.copy()
+ for arg_name in self.function_arg_names:
+ value = kwargs_left.pop(arg_name, NOTSET)
+ if func != "map" or value is NOTSET or isinstance(value,
get_mappable_types()):
+ continue
+ raise ValueError(f"{func} got unexpected value{type(value)!r} for
keyword argument {arg_name!r}")
Review comment:
Shouldn't this be a TypeError? (That's why Python throws in this
situation)
--
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]