uranusjr commented on code in PR #24667:
URL: https://github.com/apache/airflow/pull/24667#discussion_r908009505


##########
airflow/decorators/__init__.pyi:
##########
@@ -124,20 +124,14 @@ class TaskDecoratorCollection:
     @overload
     def virtualenv(self, python_callable: Function) -> Task[Function]: ...
     @overload
-    def branch(
-        self, python_callable: Optional[Callable] = None, multiple_outputs: 
Optional[bool] = None, **kwargs
-    ) -> TaskDecorator:
-        """Wraps a python function into a BranchPythonOperator
+    def branch(self, *, multiple_outputs: Optional[bool] = None, **kwargs) -> 
TaskDecorator:

Review Comment:
   The real implementation is intended to be used with two variants:
   
   ```python
   @task.branch
   def func(**context):
       ...
   
   @task.branch(**kwargs)
   def func(**context):
       ...
   ```
   
   The first variant accepts exactly one positional argument `python_callable`. 
The second should not accept `python_callable`, but all the other arguments 
(normally as keywords, although theoratically you could do `@task.branch(None, 
True, ...)`). This type hint better reflects the intention, not the actual 
implementation details.



-- 
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]

Reply via email to