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 07:33:06 UTC

[GitHub] [airflow] uranusjr opened a new pull request, #26384: Work around pyupgrade edge cases

uranusjr opened a new pull request, #26384:
URL: https://github.com/apache/airflow/pull/26384

   Follow-up to #26290


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


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

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [airflow] potiuk commented on pull request #26384: Work around pyupgrade edge cases

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #26384:
URL: https://github.com/apache/airflow/pull/26384#issuecomment-1246367041

   Ah nice! Would be great if it works :)


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


[GitHub] [airflow] potiuk merged pull request #26384: Work around pyupgrade edge cases

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #26384:
URL: https://github.com/apache/airflow/pull/26384


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


[GitHub] [airflow] potiuk commented on pull request #26384: Work around pyupgrade edge cases

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #26384:
URL: https://github.com/apache/airflow/pull/26384#issuecomment-1246690492

   Merged and cherry-picked to v2-4 branch :)


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


[GitHub] [airflow] uranusjr commented on pull request #26384: Work around pyupgrade edge cases

Posted by GitBox <gi...@apache.org>.
uranusjr commented on PR #26384:
URL: https://github.com/apache/airflow/pull/26384#issuecomment-1246594033

   Seems to work


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


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

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #26384:
URL: https://github.com/apache/airflow/pull/26384#discussion_r971116737


##########
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:
   Indeed. That is even cooler :)



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