uranusjr commented on code in PR #69157:
URL: https://github.com/apache/airflow/pull/69157#discussion_r3744870950
##########
task-sdk/src/airflow/sdk/bases/decorator.py:
##########
@@ -253,6 +253,16 @@ def determine_kwargs(
return KeywordParameters.determine(func, args, kwargs).unpacking()
+_TASK_DECORATOR_CALL_HINT = (
+ "This can happen when a @task-decorated function shadows another callable
and the decorated task "
+ "object is called like a regular function. Rename the task function or
call the original callable instead."
+)
+
+
+def _should_add_task_decorator_call_hint(err: TypeError, op_args:
Collection[Any]) -> bool:
+ return bool(op_args) and "too many positional arguments" in str(err)
Review Comment:
The heuristic is too broad for the hint text it produces. Any direct call
like `my_task(1, 2, 3)` with a plain arity mistake (no shadowing involved at
all) hits the exact same TypeError message, which is simply wrong in that case.
--
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]