potiuk commented on code in PR #33837:
URL: https://github.com/apache/airflow/pull/33837#discussion_r1323536503
##########
airflow/models/mappedoperator.py:
##########
@@ -90,31 +90,21 @@ def validate_mapping_kwargs(op: type[BaseOperator], func:
ValidationSource, valu
# use a dict so order of args is same as code order
unknown_args = value.copy()
for klass in op.mro():
- init = klass.__init__ # type: ignore[misc]
- try:
- param_names = init._BaseOperatorMeta__param_names
- except AttributeError:
- continue
- for name in param_names:
+ for name in getattr(klass.__init__, "_BaseOperatorMeta__param_names",
[]): # type: ignore[misc]
value = unknown_args.pop(name, NOTSET)
- if func != "expand":
- continue
- if value is NOTSET:
- continue
- if is_mappable(value):
- continue
- type_name = type(value).__name__
- error = f"{op.__name__}.expand() got an unexpected type
{type_name!r} for keyword argument {name}"
- raise ValueError(error)
+ if func == "expand" and not (value is NOTSET or
is_mappable(value)):
Review Comment:
Should we change `is_mappable` to return False when `value is NOTSET` ? That
would change the condition to:
```
if func == "expand" and not is_mappable(value):
```
--
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]