dsuhinin commented on code in PR #62174:
URL: https://github.com/apache/airflow/pull/62174#discussion_r2927372153
##########
task-sdk/src/airflow/sdk/bases/decorator.py:
##########
@@ -313,6 +313,23 @@ def __init__(
param.replace(default=None) if param.name in KNOWN_CONTEXT_KEYS
else param
for param in signature.parameters.values()
]
+
+ # Python requires that positional parameters with defaults don't
precede those without.
+ # This only applies to POSITIONAL_ONLY and POSITIONAL_OR_KEYWORD
parameters — *args,
+ # **kwargs, and keyword-only parameters follow different rules.
+ positional_kinds = (inspect.Parameter.POSITIONAL_ONLY,
inspect.Parameter.POSITIONAL_OR_KEYWORD)
+ positional = [(i, p) for i, p in enumerate(parameters) if p.kind in
positional_kinds]
+ first_default_idx = next((i for i, p in positional if p.default !=
inspect.Parameter.empty), None)
+ if first_default_idx is not None:
+ parameters = [
+ param.replace(default=None)
Review Comment:
ok, fixed and add a bit comments.
--
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]