Skip to content

Commit

Permalink
[AIRFLOW-6908] Lazy load AirflowException (#7528)
Browse files Browse the repository at this point in the history
  • Loading branch information
mik-laj committed Feb 25, 2020
1 parent d1a3424 commit bb552b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion airflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@
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
from airflow.models.dag import DAG # pylint: disable=redefined-outer-name
return DAG
if name == "AirflowException":
from airflow.exceptions import AirflowException # pylint: disable=redefined-outer-name
return AirflowException
raise AttributeError(f"module {__name__} has no attribute {name}")


Expand All @@ -65,6 +68,7 @@ def __getattr__(name):
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK: # pragma: no cover
from airflow.models.dag import DAG
from airflow.exceptions import AirflowException


if not PY37:
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/google/cloud/hooks/stackdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from google.protobuf.json_format import MessageToDict, MessageToJson, Parse
from googleapiclient.errors import HttpError

from airflow import AirflowException
from airflow.exceptions import AirflowException
from airflow.providers.google.cloud.hooks.base import CloudBaseHook


Expand Down

0 comments on commit bb552b2

Please sign in to comment.