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 2020/02/24 14:48:59 UTC
[GitHub] [airflow] ashb commented on a change in pull request #7517:
[AIRFLOW-6817] Lazy-load `airflow.DAG` to keep user-facing API untouched
ashb commented on a change in pull request #7517: [AIRFLOW-6817] Lazy-load `airflow.DAG` to keep user-facing API untouched
URL: https://github.com/apache/airflow/pull/7517#discussion_r383308021
##########
File path: airflow/__init__.py
##########
@@ -42,3 +42,22 @@
login: Optional[Callable] = None
integrate_plugins()
+
+__all__ = ['__version__', 'login', 'DAG']
+
+
+def __getattr__(name):
+ # PEP-562: Lazy loaded attributes on python modules
+ if name == "DAG":
+ from airflow.models.dag import DAG # pylint: disable=redefined-outer-name
Review comment:
Given this isn't at the top level does pylint still detect it as a cycle?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services