yuqian90 commented on a change in pull request #10153:
URL: https://github.com/apache/airflow/pull/10153#discussion_r484799116



##########
File path: airflow/models/baseoperator.py
##########
@@ -57,6 +58,9 @@
 from airflow.utils.trigger_rule import TriggerRule
 from airflow.utils.weight_rule import WeightRule
 
+if TYPE_CHECKING:
+    from airflow.utils.task_group import TaskGroup  # pylint: 
disable=cyclic-import

Review comment:
       There's actually no cyclic dependency if not because of the type 
checking at the module scope. E.g. in order to add this type hints in 
baseoperator.py, we need to import `TaskGroup` under `TYPE_CHECKING`
   ```
   task_group: Optional["TaskGroup"] = None,
   ```
   
   In task_group.py it's the same. In order to put `BaseOperator` in the type 
hints, `BaseOperator` needs to be imported.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to