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

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

43 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 "BaseAsyncOperator", 

30 "BaseHook", 

31 "BaseNotifier", 

32 "BaseOperator", 

33 "BaseOperatorLink", 

34 "BaseSensorOperator", 

35 "Connection", 

36 "Context", 

37 "CronDataIntervalTimetable", 

38 "CronTriggerTimetable", 

39 "DAG", 

40 "DagRunState", 

41 "DeltaDataIntervalTimetable", 

42 "DeltaTriggerTimetable", 

43 "EdgeModifier", 

44 "EventsTimetable", 

45 "Label", 

46 "Metadata", 

47 "MultipleCronTriggerTimetable", 

48 "ObjectStoragePath", 

49 "Param", 

50 "ParamsDict", 

51 "PokeReturnValue", 

52 "TaskGroup", 

53 "TaskInstanceState", 

54 "Trace", 

55 "TriggerRule", 

56 "Variable", 

57 "WeightRule", 

58 "XComArg", 

59 "asset", 

60 "chain", 

61 "chain_linear", 

62 "conf", 

63 "cross_downstream", 

64 "dag", 

65 "get_current_context", 

66 "get_parsing_context", 

67 "literal", 

68 "setup", 

69 "task", 

70 "task_group", 

71 "teardown", 

72] 

73 

74__version__ = "1.2.0" 

75 

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 ( 

81 BaseAsyncOperator, 

82 BaseOperator, 

83 chain, 

84 chain_linear, 

85 cross_downstream, 

86 ) 

87 from airflow.sdk.bases.operatorlink import BaseOperatorLink 

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

89 from airflow.sdk.configuration import AirflowSDKConfigParser 

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

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

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

93 from airflow.sdk.definitions.connection import Connection 

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

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

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

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

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

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

100 from airflow.sdk.definitions.taskgroup import TaskGroup 

101 from airflow.sdk.definitions.template import literal 

102 from airflow.sdk.definitions.timetables.assets import AssetOrTimeSchedule 

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

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

105 CronDataIntervalTimetable, 

106 DeltaDataIntervalTimetable, 

107 ) 

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

109 CronTriggerTimetable, 

110 DeltaTriggerTimetable, 

111 MultipleCronTriggerTimetable, 

112 ) 

113 from airflow.sdk.definitions.variable import Variable 

114 from airflow.sdk.definitions.xcom_arg import XComArg 

115 from airflow.sdk.io.path import ObjectStoragePath 

116 from airflow.sdk.observability.trace import Trace 

117 

118 conf: AirflowSDKConfigParser 

119 

120__lazy_imports: dict[str, str] = { 

121 "Asset": ".definitions.asset", 

122 "AssetAlias": ".definitions.asset", 

123 "AssetAll": ".definitions.asset", 

124 "AssetAny": ".definitions.asset", 

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

126 "AssetWatcher": ".definitions.asset", 

127 "BaseAsyncOperator": ".bases.operator", 

128 "BaseHook": ".bases.hook", 

129 "BaseNotifier": ".bases.notifier", 

130 "BaseOperator": ".bases.operator", 

131 "BaseOperatorLink": ".bases.operatorlink", 

132 "BaseSensorOperator": ".bases.sensor", 

133 "Connection": ".definitions.connection", 

134 "Context": ".definitions.context", 

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

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

137 "DAG": ".definitions.dag", 

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

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

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

141 "EdgeModifier": ".definitions.edges", 

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

143 "Label": ".definitions.edges", 

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

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

146 "ObjectStoragePath": ".io.path", 

147 "Param": ".definitions.param", 

148 "ParamsDict": ".definitions.param", 

149 "PokeReturnValue": ".bases.sensor", 

150 "SecretCache": ".execution_time.cache", 

151 "TaskGroup": ".definitions.taskgroup", 

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

153 "Trace": ".observability.trace", 

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

155 "Variable": ".definitions.variable", 

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

157 "XComArg": ".definitions.xcom_arg", 

158 "asset": ".definitions.asset.decorators", 

159 "chain": ".bases.operator", 

160 "chain_linear": ".bases.operator", 

161 "conf": ".configuration", 

162 "cross_downstream": ".bases.operator", 

163 "dag": ".definitions.dag", 

164 "get_current_context": ".definitions.context", 

165 "get_parsing_context": ".definitions.context", 

166 "literal": ".definitions.template", 

167 "setup": ".definitions.decorators", 

168 "task": ".definitions.decorators", 

169 "task_group": ".definitions.decorators", 

170 "teardown": ".definitions.decorators", 

171} 

172 

173 

174def __getattr__(name: str): 

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

176 import importlib 

177 

178 mod = importlib.import_module(module_path, __name__) 

179 val = getattr(mod, name) 

180 

181 # Store for next time 

182 globals()[name] = val 

183 return val 

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