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 "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 "ParamsDict", 

50 "PokeReturnValue", 

51 "TaskGroup", 

52 "TaskInstanceState", 

53 "Trace", 

54 "TriggerRule", 

55 "Variable", 

56 "WeightRule", 

57 "XComArg", 

58 "asset", 

59 "chain", 

60 "chain_linear", 

61 "conf", 

62 "cross_downstream", 

63 "dag", 

64 "get_current_context", 

65 "get_parsing_context", 

66 "literal", 

67 "setup", 

68 "task", 

69 "task_group", 

70 "teardown", 

71] 

72 

73__version__ = "1.2.0" 

74 

75if TYPE_CHECKING: 

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

77 from airflow.sdk.bases.hook import BaseHook 

78 from airflow.sdk.bases.notifier import BaseNotifier 

79 from airflow.sdk.bases.operator import BaseOperator, chain, chain_linear, cross_downstream 

80 from airflow.sdk.bases.operatorlink import BaseOperatorLink 

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

82 from airflow.sdk.configuration import AirflowSDKConfigParser 

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

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

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

86 from airflow.sdk.definitions.connection import Connection 

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

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

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

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

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

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

93 from airflow.sdk.definitions.taskgroup import TaskGroup 

94 from airflow.sdk.definitions.template import literal 

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

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

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

98 CronDataIntervalTimetable, 

99 DeltaDataIntervalTimetable, 

100 ) 

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

102 CronTriggerTimetable, 

103 DeltaTriggerTimetable, 

104 MultipleCronTriggerTimetable, 

105 ) 

106 from airflow.sdk.definitions.variable import Variable 

107 from airflow.sdk.definitions.xcom_arg import XComArg 

108 from airflow.sdk.io.path import ObjectStoragePath 

109 from airflow.sdk.observability.trace import Trace 

110 

111 conf: AirflowSDKConfigParser 

112 

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 "ParamsDict": ".definitions.param", 

141 "PokeReturnValue": ".bases.sensor", 

142 "SecretCache": ".execution_time.cache", 

143 "TaskGroup": ".definitions.taskgroup", 

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

145 "Trace": ".observability.trace", 

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

147 "Variable": ".definitions.variable", 

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

149 "XComArg": ".definitions.xcom_arg", 

150 "asset": ".definitions.asset.decorators", 

151 "chain": ".bases.operator", 

152 "chain_linear": ".bases.operator", 

153 "conf": ".configuration", 

154 "cross_downstream": ".bases.operator", 

155 "dag": ".definitions.dag", 

156 "get_current_context": ".definitions.context", 

157 "get_parsing_context": ".definitions.context", 

158 "literal": ".definitions.template", 

159 "setup": ".definitions.decorators", 

160 "task": ".definitions.decorators", 

161 "task_group": ".definitions.decorators", 

162 "teardown": ".definitions.decorators", 

163} 

164 

165 

166def __getattr__(name: str): 

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

168 import importlib 

169 

170 mod = importlib.import_module(module_path, __name__) 

171 val = getattr(mod, name) 

172 

173 # Store for next time 

174 globals()[name] = val 

175 return val 

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