You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2023/01/11 11:21:28 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #28854: Add missing types to `decorators.base`

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


##########
airflow/decorators/base.py:
##########
@@ -208,16 +209,16 @@ def __init__(
         self.op_kwargs = op_kwargs
         super().__init__(task_id=task_id, **kwargs_to_upstream, **kwargs)
 
-    def execute(self, context: Context):
+    def execute(self, context: Context) -> RV:
         # todo make this more generic (move to prepare_lineage) so it deals with non taskflow operators
         #  as well
         for arg in chain(self.op_args, self.op_kwargs.values()):
             if isinstance(arg, Dataset):
                 self.inlets.append(arg)
-        return_value = super().execute(context)
+        return_value: RV = super().execute(context)

Review Comment:
   Not sure if you can do this, CI will tell.



##########
airflow/decorators/base.py:
##########
@@ -151,6 +151,7 @@ def _find_id_suffixes(dag: DAG) -> Iterator[int]:
     core = re.split(r"__\d+$", task_id)[0]
     return f"{core}__{max(_find_id_suffixes(dag)) + 1}"
 
+RV = TypeVar("RV", bound=Any)

Review Comment:
   What does `bound=Any` do? Isn’t bounding the TypeVar to Any the same as not bounding?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org