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 2022/09/14 13:43:44 UTC

[GitHub] [airflow] ashb commented on a diff in pull request #26384: Work around pyupgrade edge cases

ashb commented on code in PR #26384:
URL: https://github.com/apache/airflow/pull/26384#discussion_r970826923


##########
airflow/models/baseoperator.py:
##########
@@ -1738,11 +1738,19 @@ def cross_downstream(
         task.set_downstream(to_tasks)
 
 
+# pyupgrade assumes all type annotations can be lazily evaluated, but this is
+# not the case for attrs-decorated classes, since cattrs needs to evaluate the
+# annotation expressions at runtime, and Python before 3.9.0 does not lazily
+# evaluate those. Putting the expression in a top-level assignment statement
+# communicates this runtime requirement to pyupgrade.
+BaseOperatorClassList = List[Type[BaseOperator]]

Review Comment:
   We're working on how we can remove cattrs https://github.com/apache/airflow/issues/26130 so hopefully we can remove this soon.



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