Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/airflow/sdk/__init__.py: 29%

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

48 statements  

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 

18 

19from typing import TYPE_CHECKING 

20 

21__all__ = [ 

22 "__version__", 

23 "Asset", 

24 "AssetAlias", 

25 "AssetAll", 

26 "AssetAny", 

27 "AssetOrTimeSchedule", 

28 "AssetWatcher", 

29 "AsyncCallback", 

30 "BaseAsyncOperator", 

31 "BaseHook", 

32 "BaseNotifier", 

33 "BaseOperator", 

34 "BaseOperatorLink", 

35 "BaseSensorOperator", 

36 "Connection", 

37 "Context", 

38 "CronDataIntervalTimetable", 

39 "CronTriggerTimetable", 

40 "CronPartitionTimetable", 

41 "DAG", 

42 "DagRunState", 

43 "DeadlineAlert", 

44 "DeadlineReference", 

45 "DeltaDataIntervalTimetable", 

46 "DeltaTriggerTimetable", 

47 "EdgeModifier", 

48 "EventsTimetable", 

49 "IdentityMapper", 

50 "Label", 

51 "Metadata", 

52 "MultipleCronTriggerTimetable", 

53 "ObjectStoragePath", 

54 "Param", 

55 "ParamsDict", 

56 "PartitionedAssetTimetable", 

57 "PartitionMapper", 

58 "PokeReturnValue", 

59 "SyncCallback", 

60 "TaskGroup", 

61 "TaskInstanceState", 

62 "Trace", 

63 "TriggerRule", 

64 "Variable", 

65 "WeightRule", 

66 "XComArg", 

67 "asset", 

68 "chain", 

69 "chain_linear", 

70 "conf", 

71 "cross_downstream", 

72 "dag", 

73 "get_current_context", 

74 "get_parsing_context", 

75 "literal", 

76 "macros", 

77 "setup", 

78 "task", 

79 "task_group", 

80 "teardown", 

81] 

82 

83__version__ = "1.2.0" 

84 

85if TYPE_CHECKING: 

86 from airflow.sdk.api.datamodels._generated import DagRunState, TaskInstanceState, TriggerRule, WeightRule 

87 from airflow.sdk.bases.hook import BaseHook 

88 from airflow.sdk.bases.notifier import BaseNotifier 

89 from airflow.sdk.bases.operator import ( 

90 BaseAsyncOperator, 

91 BaseOperator, 

92 chain, 

93 chain_linear, 

94 cross_downstream, 

95 ) 

96 from airflow.sdk.bases.operatorlink import BaseOperatorLink 

97 from airflow.sdk.bases.sensor import BaseSensorOperator, PokeReturnValue 

98 from airflow.sdk.configuration import AirflowSDKConfigParser 

99 from airflow.sdk.definitions.asset import Asset, AssetAlias, AssetAll, AssetAny, AssetWatcher 

100 from airflow.sdk.definitions.asset.decorators import asset 

101 from airflow.sdk.definitions.asset.metadata import Metadata 

102 from airflow.sdk.definitions.callback import AsyncCallback, SyncCallback 

103 from airflow.sdk.definitions.connection import Connection 

104 from airflow.sdk.definitions.context import Context, get_current_context, get_parsing_context 

105 from airflow.sdk.definitions.dag import DAG, dag 

106 from airflow.sdk.definitions.deadline import DeadlineAlert, DeadlineReference 

107 from airflow.sdk.definitions.decorators import setup, task, teardown 

108 from airflow.sdk.definitions.decorators.task_group import task_group 

109 from airflow.sdk.definitions.edges import EdgeModifier, Label 

110 from airflow.sdk.definitions.param import Param, ParamsDict 

111 from airflow.sdk.definitions.partition_mapper.base import PartitionMapper 

112 from airflow.sdk.definitions.partition_mapper.identity import IdentityMapper 

113 from airflow.sdk.definitions.taskgroup import TaskGroup 

114 from airflow.sdk.definitions.template import literal 

115 from airflow.sdk.definitions.timetables.assets import ( 

116 AssetOrTimeSchedule, 

117 PartitionedAssetTimetable, 

118 ) 

119 from airflow.sdk.definitions.timetables.events import EventsTimetable 

120 from airflow.sdk.definitions.timetables.interval import ( 

121 CronDataIntervalTimetable, 

122 DeltaDataIntervalTimetable, 

123 ) 

124 from airflow.sdk.definitions.timetables.trigger import ( 

125 CronPartitionTimetable, 

126 CronTriggerTimetable, 

127 DeltaTriggerTimetable, 

128 MultipleCronTriggerTimetable, 

129 ) 

130 from airflow.sdk.definitions.variable import Variable 

131 from airflow.sdk.definitions.xcom_arg import XComArg 

132 from airflow.sdk.execution_time import macros 

133 from airflow.sdk.io.path import ObjectStoragePath 

134 from airflow.sdk.observability.trace import Trace 

135 

136 conf: AirflowSDKConfigParser 

137 

138__lazy_imports: dict[str, str] = { 

139 "Asset": ".definitions.asset", 

140 "AssetAlias": ".definitions.asset", 

141 "AssetAll": ".definitions.asset", 

142 "AssetAny": ".definitions.asset", 

143 "AssetOrTimeSchedule": ".definitions.timetables.assets", 

144 "AssetWatcher": ".definitions.asset", 

145 "AsyncCallback": ".definitions.callback", 

146 "BaseAsyncOperator": ".bases.operator", 

147 "BaseHook": ".bases.hook", 

148 "BaseNotifier": ".bases.notifier", 

149 "BaseOperator": ".bases.operator", 

150 "BaseOperatorLink": ".bases.operatorlink", 

151 "BaseSensorOperator": ".bases.sensor", 

152 "Connection": ".definitions.connection", 

153 "Context": ".definitions.context", 

154 "CronDataIntervalTimetable": ".definitions.timetables.interval", 

155 "CronTriggerTimetable": ".definitions.timetables.trigger", 

156 "CronPartitionTimetable": ".definitions.timetables.trigger", 

157 "DAG": ".definitions.dag", 

158 "DagRunState": ".api.datamodels._generated", 

159 "DeadlineAlert": ".definitions.deadline", 

160 "DeadlineReference": ".definitions.deadline", 

161 "DeltaDataIntervalTimetable": ".definitions.timetables.interval", 

162 "DeltaTriggerTimetable": ".definitions.timetables.trigger", 

163 "EdgeModifier": ".definitions.edges", 

164 "EventsTimetable": ".definitions.timetables.events", 

165 "IdentityMapper": ".definitions.partition_mapper.identity", 

166 "Label": ".definitions.edges", 

167 "Metadata": ".definitions.asset.metadata", 

168 "MultipleCronTriggerTimetable": ".definitions.timetables.trigger", 

169 "ObjectStoragePath": ".io.path", 

170 "Param": ".definitions.param", 

171 "ParamsDict": ".definitions.param", 

172 "PartitionedAssetTimetable": ".definitions.timetables.assets", 

173 "PartitionMapper": ".definitions.partition_mapper.base", 

174 "PokeReturnValue": ".bases.sensor", 

175 "SecretCache": ".execution_time.cache", 

176 "SyncCallback": ".definitions.callback", 

177 "TaskGroup": ".definitions.taskgroup", 

178 "TaskInstanceState": ".api.datamodels._generated", 

179 "Trace": ".observability.trace", 

180 "TriggerRule": ".api.datamodels._generated", 

181 "Variable": ".definitions.variable", 

182 "WeightRule": ".api.datamodels._generated", 

183 "XComArg": ".definitions.xcom_arg", 

184 "asset": ".definitions.asset.decorators", 

185 "chain": ".bases.operator", 

186 "chain_linear": ".bases.operator", 

187 "conf": ".configuration", 

188 "cross_downstream": ".bases.operator", 

189 "dag": ".definitions.dag", 

190 "get_current_context": ".definitions.context", 

191 "get_parsing_context": ".definitions.context", 

192 "literal": ".definitions.template", 

193 "macros": ".execution_time", 

194 "setup": ".definitions.decorators", 

195 "task": ".definitions.decorators", 

196 "task_group": ".definitions.decorators", 

197 "teardown": ".definitions.decorators", 

198} 

199 

200 

201def __getattr__(name: str): 

202 if module_path := __lazy_imports.get(name): 

203 import importlib 

204 

205 mod = importlib.import_module(module_path, __name__) 

206 val = getattr(mod, name) 

207 

208 # Store for next time 

209 globals()[name] = val 

210 return val 

211 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")