Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/airflow/sdk/__init__.py: 35%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements. See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership. The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License. You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied. See the License for the
15# specific language governing permissions and limitations
16# under the License.
17from __future__ import annotations
19from typing import TYPE_CHECKING
21__all__ = [
22 "__version__",
23 "Asset",
24 "AssetAlias",
25 "AssetAll",
26 "AssetAny",
27 "AssetOrTimeSchedule",
28 "AssetWatcher",
29 "BaseHook",
30 "BaseNotifier",
31 "BaseOperator",
32 "BaseOperatorLink",
33 "BaseSensorOperator",
34 "Connection",
35 "Context",
36 "CronDataIntervalTimetable",
37 "CronTriggerTimetable",
38 "DAG",
39 "DagRunState",
40 "DeltaDataIntervalTimetable",
41 "DeltaTriggerTimetable",
42 "EdgeModifier",
43 "EventsTimetable",
44 "Label",
45 "Metadata",
46 "MultipleCronTriggerTimetable",
47 "ObjectStoragePath",
48 "Param",
49 "PokeReturnValue",
50 "TaskGroup",
51 "TaskInstanceState",
52 "Trace",
53 "TriggerRule",
54 "Variable",
55 "WeightRule",
56 "XComArg",
57 "asset",
58 "chain",
59 "chain_linear",
60 "conf",
61 "cross_downstream",
62 "dag",
63 "get_current_context",
64 "get_parsing_context",
65 "literal",
66 "setup",
67 "task",
68 "task_group",
69 "teardown",
70]
72__version__ = "1.2.0"
74from airflow.sdk.observability.trace import Trace
76if TYPE_CHECKING:
77 from airflow.sdk.api.datamodels._generated import DagRunState, TaskInstanceState, TriggerRule, WeightRule
78 from airflow.sdk.bases.hook import BaseHook
79 from airflow.sdk.bases.notifier import BaseNotifier
80 from airflow.sdk.bases.operator import BaseOperator, chain, chain_linear, cross_downstream
81 from airflow.sdk.bases.operatorlink import BaseOperatorLink
82 from airflow.sdk.bases.sensor import BaseSensorOperator, PokeReturnValue
83 from airflow.sdk.configuration import AirflowSDKConfigParser
84 from airflow.sdk.definitions.asset import Asset, AssetAlias, AssetAll, AssetAny, AssetWatcher
85 from airflow.sdk.definitions.asset.decorators import asset
86 from airflow.sdk.definitions.asset.metadata import Metadata
87 from airflow.sdk.definitions.connection import Connection
88 from airflow.sdk.definitions.context import Context, get_current_context, get_parsing_context
89 from airflow.sdk.definitions.dag import DAG, dag
90 from airflow.sdk.definitions.decorators import setup, task, teardown
91 from airflow.sdk.definitions.decorators.task_group import task_group
92 from airflow.sdk.definitions.edges import EdgeModifier, Label
93 from airflow.sdk.definitions.param import Param
94 from airflow.sdk.definitions.taskgroup import TaskGroup
95 from airflow.sdk.definitions.template import literal
96 from airflow.sdk.definitions.timetables.assets import AssetOrTimeSchedule
97 from airflow.sdk.definitions.timetables.events import EventsTimetable
98 from airflow.sdk.definitions.timetables.interval import (
99 CronDataIntervalTimetable,
100 DeltaDataIntervalTimetable,
101 )
102 from airflow.sdk.definitions.timetables.trigger import (
103 CronTriggerTimetable,
104 DeltaTriggerTimetable,
105 MultipleCronTriggerTimetable,
106 )
107 from airflow.sdk.definitions.variable import Variable
108 from airflow.sdk.definitions.xcom_arg import XComArg
109 from airflow.sdk.io.path import ObjectStoragePath
111 conf: AirflowSDKConfigParser
113__lazy_imports: dict[str, str] = {
114 "Asset": ".definitions.asset",
115 "AssetAlias": ".definitions.asset",
116 "AssetAll": ".definitions.asset",
117 "AssetAny": ".definitions.asset",
118 "AssetOrTimeSchedule": ".definitions.timetables.assets",
119 "AssetWatcher": ".definitions.asset",
120 "BaseHook": ".bases.hook",
121 "BaseNotifier": ".bases.notifier",
122 "BaseOperator": ".bases.operator",
123 "BaseOperatorLink": ".bases.operatorlink",
124 "BaseSensorOperator": ".bases.sensor",
125 "Connection": ".definitions.connection",
126 "Context": ".definitions.context",
127 "CronDataIntervalTimetable": ".definitions.timetables.interval",
128 "CronTriggerTimetable": ".definitions.timetables.trigger",
129 "DAG": ".definitions.dag",
130 "DagRunState": ".api.datamodels._generated",
131 "DeltaDataIntervalTimetable": ".definitions.timetables.interval",
132 "DeltaTriggerTimetable": ".definitions.timetables.trigger",
133 "EdgeModifier": ".definitions.edges",
134 "EventsTimetable": ".definitions.timetables.events",
135 "Label": ".definitions.edges",
136 "Metadata": ".definitions.asset.metadata",
137 "MultipleCronTriggerTimetable": ".definitions.timetables.trigger",
138 "ObjectStoragePath": ".io.path",
139 "Param": ".definitions.param",
140 "PokeReturnValue": ".bases.sensor",
141 "SecretCache": ".execution_time.cache",
142 "TaskGroup": ".definitions.taskgroup",
143 "TaskInstanceState": ".api.datamodels._generated",
144 "Trace": ".observability.trace",
145 "TriggerRule": ".api.datamodels._generated",
146 "Variable": ".definitions.variable",
147 "WeightRule": ".api.datamodels._generated",
148 "XComArg": ".definitions.xcom_arg",
149 "asset": ".definitions.asset.decorators",
150 "chain": ".bases.operator",
151 "chain_linear": ".bases.operator",
152 "conf": ".configuration",
153 "cross_downstream": ".bases.operator",
154 "dag": ".definitions.dag",
155 "get_current_context": ".definitions.context",
156 "get_parsing_context": ".definitions.context",
157 "setup": ".definitions.decorators",
158 "task": ".definitions.decorators",
159 "task_group": ".definitions.decorators",
160 "teardown": ".definitions.decorators",
161}
164def __getattr__(name: str):
165 if module_path := __lazy_imports.get(name):
166 import importlib
168 mod = importlib.import_module(module_path, __name__)
169 val = getattr(mod, name)
171 # Store for next time
172 globals()[name] = val
173 return val
174 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")