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

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

61 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 "AllowedKeyMapper", 

24 "Asset", 

25 "AssetAccessControl", 

26 "AssetAlias", 

27 "AssetAll", 

28 "AssetAny", 

29 "AssetOrTimeSchedule", 

30 "AssetWatcher", 

31 "AsyncCallback", 

32 "BaseAsyncOperator", 

33 "BaseBranchOperator", 

34 "BaseHook", 

35 "BaseNotifier", 

36 "BaseOperator", 

37 "BaseOperatorLink", 

38 "BaseSensorOperator", 

39 "BaseXCom", 

40 "BranchMixIn", 

41 "ChainMapper", 

42 "Connection", 

43 "Context", 

44 "CronDataIntervalTimetable", 

45 "CronTriggerTimetable", 

46 "CronPartitionTimetable", 

47 "DAG", 

48 "DagRunState", 

49 "DayWindow", 

50 "DeadlineAlert", 

51 "DeadlineReference", 

52 "DeltaDataIntervalTimetable", 

53 "DeltaTriggerTimetable", 

54 "EdgeModifier", 

55 "EventsTimetable", 

56 "ExceptionRetryPolicy", 

57 "FanOutMapper", 

58 "FixedKeyMapper", 

59 "HourWindow", 

60 "IdentityMapper", 

61 "Label", 

62 "Metadata", 

63 "MinimumCount", 

64 "MonthWindow", 

65 "MultipleCronTriggerTimetable", 

66 "NEVER_EXPIRE", 

67 "ObjectStoragePath", 

68 "Param", 

69 "ParamsDict", 

70 "PartitionedAtRuntime", 

71 "PartitionedAssetTimetable", 

72 "PartitionMapper", 

73 "PokeReturnValue", 

74 "ProductMapper", 

75 "QuarterWindow", 

76 "ResumableJobMixin", 

77 "RetryAction", 

78 "RetryDecision", 

79 "RetryPolicy", 

80 "RetryRule", 

81 "RollupMapper", 

82 "SegmentWindow", 

83 "SkipMixin", 

84 "SyncCallback", 

85 "StartOfDayMapper", 

86 "StartOfHourMapper", 

87 "StartOfMonthMapper", 

88 "StartOfQuarterMapper", 

89 "StartOfWeekMapper", 

90 "StartOfYearMapper", 

91 "TaskGroup", 

92 "TaskInstance", 

93 "TaskInstanceState", 

94 "TriggerRule", 

95 "Variable", 

96 "WaitForAll", 

97 "WeekWindow", 

98 "WeightRule", 

99 "Window", 

100 "XComArg", 

101 "YearWindow", 

102 "asset", 

103 "chain", 

104 "chain_linear", 

105 "conf", 

106 "cross_downstream", 

107 "dag", 

108 "get_current_context", 

109 "get_parsing_context", 

110 "literal", 

111 "lineage", 

112 "macros", 

113 "result", 

114 "setup", 

115 "task", 

116 "task_group", 

117 "teardown", 

118] 

119 

120__version__ = "1.4.0" 

121 

122if TYPE_CHECKING: 

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

124 from airflow.sdk.bases.branch import BaseBranchOperator, BranchMixIn 

125 from airflow.sdk.bases.hook import BaseHook 

126 from airflow.sdk.bases.notifier import BaseNotifier 

127 from airflow.sdk.bases.operator import ( 

128 BaseAsyncOperator, 

129 BaseOperator, 

130 chain, 

131 chain_linear, 

132 cross_downstream, 

133 ) 

134 from airflow.sdk.bases.operatorlink import BaseOperatorLink 

135 from airflow.sdk.bases.resumablejobmixin import ResumableJobMixin 

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

137 from airflow.sdk.bases.skipmixin import SkipMixin 

138 from airflow.sdk.bases.xcom import BaseXCom 

139 from airflow.sdk.configuration import AirflowSDKConfigParser 

140 from airflow.sdk.definitions.asset import ( 

141 Asset, 

142 AssetAccessControl, 

143 AssetAlias, 

144 AssetAll, 

145 AssetAny, 

146 AssetWatcher, 

147 ) 

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

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

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

151 from airflow.sdk.definitions.connection import Connection 

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

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

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

155 from airflow.sdk.definitions.decorators import result, setup, task, teardown 

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

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

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

159 from airflow.sdk.definitions.partition_mappers.allowed_key import AllowedKeyMapper 

160 from airflow.sdk.definitions.partition_mappers.base import ( 

161 PartitionMapper, 

162 RollupMapper, 

163 ) 

164 from airflow.sdk.definitions.partition_mappers.chain import ChainMapper 

165 from airflow.sdk.definitions.partition_mappers.fixed_key import FixedKeyMapper 

166 from airflow.sdk.definitions.partition_mappers.identity import IdentityMapper 

167 from airflow.sdk.definitions.partition_mappers.product import ProductMapper 

168 from airflow.sdk.definitions.partition_mappers.temporal import ( 

169 FanOutMapper, 

170 StartOfDayMapper, 

171 StartOfHourMapper, 

172 StartOfMonthMapper, 

173 StartOfQuarterMapper, 

174 StartOfWeekMapper, 

175 StartOfYearMapper, 

176 ) 

177 from airflow.sdk.definitions.partition_mappers.wait_policy import ( 

178 MinimumCount, 

179 WaitForAll, 

180 ) 

181 from airflow.sdk.definitions.partition_mappers.window import ( 

182 DayWindow, 

183 HourWindow, 

184 MonthWindow, 

185 QuarterWindow, 

186 SegmentWindow, 

187 WeekWindow, 

188 Window, 

189 YearWindow, 

190 ) 

191 from airflow.sdk.definitions.retry_policy import ( 

192 ExceptionRetryPolicy, 

193 RetryAction, 

194 RetryDecision, 

195 RetryPolicy, 

196 RetryRule, 

197 ) 

198 from airflow.sdk.definitions.taskgroup import TaskGroup 

199 from airflow.sdk.definitions.template import literal 

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

201 AssetOrTimeSchedule, 

202 PartitionedAssetTimetable, 

203 PartitionedAtRuntime, 

204 ) 

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

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

207 CronDataIntervalTimetable, 

208 DeltaDataIntervalTimetable, 

209 ) 

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

211 CronPartitionTimetable, 

212 CronTriggerTimetable, 

213 DeltaTriggerTimetable, 

214 MultipleCronTriggerTimetable, 

215 ) 

216 from airflow.sdk.definitions.variable import Variable 

217 from airflow.sdk.definitions.xcom_arg import XComArg 

218 from airflow.sdk.execution_time import macros 

219 from airflow.sdk.execution_time.context import NEVER_EXPIRE 

220 from airflow.sdk.io.path import ObjectStoragePath 

221 from airflow.sdk.types import TaskInstance 

222 

223 conf: AirflowSDKConfigParser 

224 

225__lazy_imports: dict[str, str] = { 

226 "AllowedKeyMapper": ".definitions.partition_mappers.allowed_key", 

227 "Asset": ".definitions.asset", 

228 "AssetAccessControl": ".definitions.asset", 

229 "AssetAlias": ".definitions.asset", 

230 "AssetAll": ".definitions.asset", 

231 "AssetAny": ".definitions.asset", 

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

233 "AssetWatcher": ".definitions.asset", 

234 "AsyncCallback": ".definitions.callback", 

235 "BaseAsyncOperator": ".bases.operator", 

236 "BaseBranchOperator": ".bases.branch", 

237 "BaseHook": ".bases.hook", 

238 "BaseNotifier": ".bases.notifier", 

239 "BaseOperator": ".bases.operator", 

240 "BaseOperatorLink": ".bases.operatorlink", 

241 "BaseSensorOperator": ".bases.sensor", 

242 "BaseXCom": ".bases.xcom", 

243 "BranchMixIn": ".bases.branch", 

244 "ChainMapper": ".definitions.partition_mappers.chain", 

245 "Connection": ".definitions.connection", 

246 "Context": ".definitions.context", 

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

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

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

250 "DAG": ".definitions.dag", 

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

252 "DayWindow": ".definitions.partition_mappers.window", 

253 "DeadlineAlert": ".definitions.deadline", 

254 "DeadlineReference": ".definitions.deadline", 

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

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

257 "EdgeModifier": ".definitions.edges", 

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

259 "ExceptionRetryPolicy": ".definitions.retry_policy", 

260 "FanOutMapper": ".definitions.partition_mappers.temporal", 

261 "FixedKeyMapper": ".definitions.partition_mappers.fixed_key", 

262 "HourWindow": ".definitions.partition_mappers.window", 

263 "IdentityMapper": ".definitions.partition_mappers.identity", 

264 "Label": ".definitions.edges", 

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

266 "MinimumCount": ".definitions.partition_mappers.wait_policy", 

267 "MonthWindow": ".definitions.partition_mappers.window", 

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

269 "ObjectStoragePath": ".io.path", 

270 "Param": ".definitions.param", 

271 "ParamsDict": ".definitions.param", 

272 "PartitionedAtRuntime": ".definitions.timetables.assets", 

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

274 "PartitionMapper": ".definitions.partition_mappers.base", 

275 "PokeReturnValue": ".bases.sensor", 

276 "ProductMapper": ".definitions.partition_mappers.product", 

277 "QuarterWindow": ".definitions.partition_mappers.window", 

278 "ResumableJobMixin": ".bases.resumablejobmixin", 

279 "RetryAction": ".definitions.retry_policy", 

280 "RetryDecision": ".definitions.retry_policy", 

281 "RetryPolicy": ".definitions.retry_policy", 

282 "RetryRule": ".definitions.retry_policy", 

283 "RollupMapper": ".definitions.partition_mappers.base", 

284 "SecretCache": ".execution_time.cache", 

285 "SegmentWindow": ".definitions.partition_mappers.window", 

286 "SkipMixin": ".bases.skipmixin", 

287 "SyncCallback": ".definitions.callback", 

288 "StartOfDayMapper": ".definitions.partition_mappers.temporal", 

289 "StartOfHourMapper": ".definitions.partition_mappers.temporal", 

290 "StartOfMonthMapper": ".definitions.partition_mappers.temporal", 

291 "StartOfQuarterMapper": ".definitions.partition_mappers.temporal", 

292 "StartOfWeekMapper": ".definitions.partition_mappers.temporal", 

293 "StartOfYearMapper": ".definitions.partition_mappers.temporal", 

294 "TaskGroup": ".definitions.taskgroup", 

295 "TaskInstance": ".types", 

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

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

298 "Variable": ".definitions.variable", 

299 "WaitForAll": ".definitions.partition_mappers.wait_policy", 

300 "WeekWindow": ".definitions.partition_mappers.window", 

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

302 "Window": ".definitions.partition_mappers.window", 

303 "XComArg": ".definitions.xcom_arg", 

304 "YearWindow": ".definitions.partition_mappers.window", 

305 "asset": ".definitions.asset.decorators", 

306 "chain": ".bases.operator", 

307 "chain_linear": ".bases.operator", 

308 "conf": ".configuration", 

309 "cross_downstream": ".bases.operator", 

310 "dag": ".definitions.dag", 

311 "NEVER_EXPIRE": ".execution_time.context", 

312 "get_current_context": ".definitions.context", 

313 "get_parsing_context": ".definitions.context", 

314 "literal": ".definitions.template", 

315 "lineage": ".lineage", 

316 "macros": ".execution_time", 

317 "result": ".definitions.decorators", 

318 "setup": ".definitions.decorators", 

319 "task": ".definitions.decorators", 

320 "task_group": ".definitions.decorators", 

321 "teardown": ".definitions.decorators", 

322} 

323 

324 

325def __getattr__(name: str): 

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

327 import importlib 

328 

329 mod = importlib.import_module(module_path, __name__) 

330 val = getattr(mod, name) 

331 

332 # Store for next time 

333 globals()[name] = val 

334 return val 

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