Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/airflow/sdk/__init__.py: 24%
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 "AllowedKeyMapper",
24 "Asset",
25 "AssetAlias",
26 "AssetAll",
27 "AssetAny",
28 "AssetOrTimeSchedule",
29 "AssetWatcher",
30 "AsyncCallback",
31 "BaseAsyncOperator",
32 "BaseBranchOperator",
33 "BaseHook",
34 "BaseNotifier",
35 "BaseOperator",
36 "BaseOperatorLink",
37 "BaseSensorOperator",
38 "BaseXCom",
39 "BranchMixIn",
40 "ChainMapper",
41 "Connection",
42 "Context",
43 "CronDataIntervalTimetable",
44 "CronTriggerTimetable",
45 "CronPartitionTimetable",
46 "DAG",
47 "DagRunState",
48 "DeadlineAlert",
49 "DeadlineReference",
50 "DeltaDataIntervalTimetable",
51 "DeltaTriggerTimetable",
52 "EdgeModifier",
53 "EventsTimetable",
54 "IdentityMapper",
55 "Label",
56 "Metadata",
57 "MultipleCronTriggerTimetable",
58 "ObjectStoragePath",
59 "Param",
60 "ParamsDict",
61 "PartitionedAssetTimetable",
62 "PartitionMapper",
63 "PokeReturnValue",
64 "ProductMapper",
65 "SkipMixin",
66 "SyncCallback",
67 "StartOfDayMapper",
68 "StartOfHourMapper",
69 "StartOfMonthMapper",
70 "StartOfQuarterMapper",
71 "StartOfWeekMapper",
72 "StartOfYearMapper",
73 "TaskGroup",
74 "TaskInstance",
75 "TaskInstanceState",
76 "TriggerRule",
77 "Variable",
78 "WeightRule",
79 "XComArg",
80 "asset",
81 "chain",
82 "chain_linear",
83 "conf",
84 "cross_downstream",
85 "dag",
86 "get_current_context",
87 "get_parsing_context",
88 "literal",
89 "lineage",
90 "macros",
91 "setup",
92 "task",
93 "task_group",
94 "teardown",
95]
97__version__ = "1.2.0"
99if TYPE_CHECKING:
100 from airflow.sdk.api.datamodels._generated import DagRunState, TaskInstanceState, TriggerRule, WeightRule
101 from airflow.sdk.bases.branch import BaseBranchOperator, BranchMixIn
102 from airflow.sdk.bases.hook import BaseHook
103 from airflow.sdk.bases.notifier import BaseNotifier
104 from airflow.sdk.bases.operator import (
105 BaseAsyncOperator,
106 BaseOperator,
107 chain,
108 chain_linear,
109 cross_downstream,
110 )
111 from airflow.sdk.bases.operatorlink import BaseOperatorLink
112 from airflow.sdk.bases.sensor import BaseSensorOperator, PokeReturnValue
113 from airflow.sdk.bases.skipmixin import SkipMixin
114 from airflow.sdk.bases.xcom import BaseXCom
115 from airflow.sdk.configuration import AirflowSDKConfigParser
116 from airflow.sdk.definitions.asset import Asset, AssetAlias, AssetAll, AssetAny, AssetWatcher
117 from airflow.sdk.definitions.asset.decorators import asset
118 from airflow.sdk.definitions.asset.metadata import Metadata
119 from airflow.sdk.definitions.callback import AsyncCallback, SyncCallback
120 from airflow.sdk.definitions.connection import Connection
121 from airflow.sdk.definitions.context import Context, get_current_context, get_parsing_context
122 from airflow.sdk.definitions.dag import DAG, dag
123 from airflow.sdk.definitions.deadline import DeadlineAlert, DeadlineReference
124 from airflow.sdk.definitions.decorators import setup, task, teardown
125 from airflow.sdk.definitions.decorators.task_group import task_group
126 from airflow.sdk.definitions.edges import EdgeModifier, Label
127 from airflow.sdk.definitions.param import Param, ParamsDict
128 from airflow.sdk.definitions.partition_mappers.allowed_key import AllowedKeyMapper
129 from airflow.sdk.definitions.partition_mappers.base import PartitionMapper
130 from airflow.sdk.definitions.partition_mappers.chain import ChainMapper
131 from airflow.sdk.definitions.partition_mappers.identity import IdentityMapper
132 from airflow.sdk.definitions.partition_mappers.product import ProductMapper
133 from airflow.sdk.definitions.partition_mappers.temporal import (
134 StartOfDayMapper,
135 StartOfHourMapper,
136 StartOfMonthMapper,
137 StartOfQuarterMapper,
138 StartOfWeekMapper,
139 StartOfYearMapper,
140 )
141 from airflow.sdk.definitions.taskgroup import TaskGroup
142 from airflow.sdk.definitions.template import literal
143 from airflow.sdk.definitions.timetables.assets import (
144 AssetOrTimeSchedule,
145 PartitionedAssetTimetable,
146 )
147 from airflow.sdk.definitions.timetables.events import EventsTimetable
148 from airflow.sdk.definitions.timetables.interval import (
149 CronDataIntervalTimetable,
150 DeltaDataIntervalTimetable,
151 )
152 from airflow.sdk.definitions.timetables.trigger import (
153 CronPartitionTimetable,
154 CronTriggerTimetable,
155 DeltaTriggerTimetable,
156 MultipleCronTriggerTimetable,
157 )
158 from airflow.sdk.definitions.variable import Variable
159 from airflow.sdk.definitions.xcom_arg import XComArg
160 from airflow.sdk.execution_time import macros
161 from airflow.sdk.io.path import ObjectStoragePath
162 from airflow.sdk.types import TaskInstance
164 conf: AirflowSDKConfigParser
166__lazy_imports: dict[str, str] = {
167 "AllowedKeyMapper": ".definitions.partition_mappers.allowed_key",
168 "Asset": ".definitions.asset",
169 "AssetAlias": ".definitions.asset",
170 "AssetAll": ".definitions.asset",
171 "AssetAny": ".definitions.asset",
172 "AssetOrTimeSchedule": ".definitions.timetables.assets",
173 "AssetWatcher": ".definitions.asset",
174 "AsyncCallback": ".definitions.callback",
175 "BaseAsyncOperator": ".bases.operator",
176 "BaseBranchOperator": ".bases.branch",
177 "BaseHook": ".bases.hook",
178 "BaseNotifier": ".bases.notifier",
179 "BaseOperator": ".bases.operator",
180 "BaseOperatorLink": ".bases.operatorlink",
181 "BaseSensorOperator": ".bases.sensor",
182 "BaseXCom": ".bases.xcom",
183 "BranchMixIn": ".bases.branch",
184 "ChainMapper": ".definitions.partition_mappers.chain",
185 "Connection": ".definitions.connection",
186 "Context": ".definitions.context",
187 "CronDataIntervalTimetable": ".definitions.timetables.interval",
188 "CronTriggerTimetable": ".definitions.timetables.trigger",
189 "CronPartitionTimetable": ".definitions.timetables.trigger",
190 "DAG": ".definitions.dag",
191 "DagRunState": ".api.datamodels._generated",
192 "DeadlineAlert": ".definitions.deadline",
193 "DeadlineReference": ".definitions.deadline",
194 "DeltaDataIntervalTimetable": ".definitions.timetables.interval",
195 "DeltaTriggerTimetable": ".definitions.timetables.trigger",
196 "EdgeModifier": ".definitions.edges",
197 "EventsTimetable": ".definitions.timetables.events",
198 "IdentityMapper": ".definitions.partition_mappers.identity",
199 "Label": ".definitions.edges",
200 "Metadata": ".definitions.asset.metadata",
201 "MultipleCronTriggerTimetable": ".definitions.timetables.trigger",
202 "ObjectStoragePath": ".io.path",
203 "Param": ".definitions.param",
204 "ParamsDict": ".definitions.param",
205 "PartitionedAssetTimetable": ".definitions.timetables.assets",
206 "PartitionMapper": ".definitions.partition_mappers.base",
207 "PokeReturnValue": ".bases.sensor",
208 "ProductMapper": ".definitions.partition_mappers.product",
209 "SecretCache": ".execution_time.cache",
210 "SkipMixin": ".bases.skipmixin",
211 "SyncCallback": ".definitions.callback",
212 "StartOfDayMapper": ".definitions.partition_mappers.temporal",
213 "StartOfHourMapper": ".definitions.partition_mappers.temporal",
214 "StartOfMonthMapper": ".definitions.partition_mappers.temporal",
215 "StartOfQuarterMapper": ".definitions.partition_mappers.temporal",
216 "StartOfWeekMapper": ".definitions.partition_mappers.temporal",
217 "StartOfYearMapper": ".definitions.partition_mappers.temporal",
218 "TaskGroup": ".definitions.taskgroup",
219 "TaskInstance": ".types",
220 "TaskInstanceState": ".api.datamodels._generated",
221 "TriggerRule": ".api.datamodels._generated",
222 "Variable": ".definitions.variable",
223 "WeightRule": ".api.datamodels._generated",
224 "XComArg": ".definitions.xcom_arg",
225 "asset": ".definitions.asset.decorators",
226 "chain": ".bases.operator",
227 "chain_linear": ".bases.operator",
228 "conf": ".configuration",
229 "cross_downstream": ".bases.operator",
230 "dag": ".definitions.dag",
231 "get_current_context": ".definitions.context",
232 "get_parsing_context": ".definitions.context",
233 "literal": ".definitions.template",
234 "lineage": ".lineage",
235 "macros": ".execution_time",
236 "setup": ".definitions.decorators",
237 "task": ".definitions.decorators",
238 "task_group": ".definitions.decorators",
239 "teardown": ".definitions.decorators",
240}
243def __getattr__(name: str):
244 if module_path := __lazy_imports.get(name):
245 import importlib
247 mod = importlib.import_module(module_path, __name__)
248 val = getattr(mod, name)
250 # Store for next time
251 globals()[name] = val
252 return val
253 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")