@@ -56,7 +56,8 @@ impl Violation for Airflow31Removal {
5656 | Replacement :: SourceModuleMoved { module : _, name : _ }
5757 | Replacement :: SourceModuleMovedToSDK {
5858 module : _, name : _, ..
59- } => {
59+ }
60+ | Replacement :: InternalModule { module : _, name : _ } => {
6061 format ! ( "`{deprecated}` is removed in Airflow 3.1" )
6162 }
6263 }
@@ -81,6 +82,10 @@ impl Violation for Airflow31Removal {
8182 } => Some ( format ! (
8283 "`{name}` has been moved to `{module}` since Airflow 3.1 (with apache-airflow-task-sdk>={version})."
8384 ) ) ,
85+ Replacement :: InternalModule { module, name } => Some ( format ! (
86+ "`{name}` has been moved to `{module}` since Airflow 3.1. \
87+ This is an internal module which is not supposed to be used and is subject to change without notice."
88+ ) ) ,
8489 }
8590 }
8691}
@@ -130,23 +135,19 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
130135 "airflow" ,
131136 "utils" ,
132137 "setup_teardown" ,
133- "BaseSetupTeardownContext" ,
134- ] => Replacement :: Message (
135- "`BaseSetupTeardownContext` has been moved to `airflow.sdk.definitions._internal.setup_teardown` \
136- since Airflow 3.1. This is an internal module and is subject to change without notice.",
137- ) ,
138- [ "airflow" , "utils" , "setup_teardown" , "SetupTeardownContext" ] => Replacement :: Message (
139- "`SetupTeardownContext` has been moved to `airflow.sdk.definitions._internal.setup_teardown` \
140- since Airflow 3.1. This is an internal module and is subject to change without notice.",
141- ) ,
138+ rest @ ( "BaseSetupTeardownContext" | "SetupTeardownContext" ) ,
139+ ] => Replacement :: InternalModule {
140+ module : "airflow.sdk.definitions._internal.setup_teardown" ,
141+ name : rest. to_string ( ) ,
142+ } ,
142143 // airflow.secrets
143144 [ "airflow" , "secrets" , "cache" , "SecretCache" ] => Replacement :: SourceModuleMovedToSDK {
144145 module : "airflow.sdk" ,
145146 name : "SecretCache" . to_string ( ) ,
146147 version : "1.1.6" ,
147148 } ,
148149 // airflow.utils.xcom
149- [ "airflow" , "utils" , "xcom" , "XCOM_RETURN_KEY" ] => Replacement :: SourceModuleMoved {
150+ [ "airflow" , "utils" , "xcom" , "XCOM_RETURN_KEY" ] => Replacement :: InternalModule {
150151 module : "airflow.models.xcom" ,
151152 name : "XCOM_RETURN_KEY" . to_string ( ) ,
152153 } ,
@@ -169,37 +170,25 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
169170 version : "1.1.6" ,
170171 } ,
171172 // airflow.utils.decorators
172- [ "airflow" , "utils" , "decorators" , "remove_task_decorator" ] => Replacement :: Message (
173- "`remove_task_decorator` has been moved to `airflow.sdk.definitions._internal.decorators` \
174- since Airflow 3.1. This is an internal module and is subject to change without notice.",
175- ) ,
176173 [
177174 "airflow" ,
178175 "utils" ,
179176 "decorators" ,
180- " fixup_decorator_warning_stack",
181- ] => Replacement :: Message (
182- "`fixup_decorator_warning_stack` has been moved to ` airflow.sdk.definitions._internal.decorators` \
183- since Airflow 3.1. This is an internal module and is subject to change without notice." ,
184- ) ,
177+ rest @ ( "remove_task_decorator" | " fixup_decorator_warning_stack") ,
178+ ] => Replacement :: InternalModule {
179+ module : " airflow.sdk.definitions._internal.decorators" ,
180+ name : rest . to_string ( ) ,
181+ } ,
185182 // airflow.models.abstractoperator
186- [ "airflow" , "models" , "abstractoperator" , "AbstractOperator" ] => Replacement :: Message (
187- "`AbstractOperator` has been moved to `airflow.sdk.definitions._internal.abstractoperator` \
188- since Airflow 3.1. This is an internal module and is subject to change without notice.",
189- ) ,
190- [ "airflow" , "models" , "abstractoperator" , "NotMapped" ] => Replacement :: Message (
191- "`NotMapped` has been moved to `airflow.sdk.definitions._internal.abstractoperator` \
192- since Airflow 3.1. This is an internal module and is subject to change without notice.",
193- ) ,
194183 [
195184 "airflow" ,
196185 "models" ,
197186 "abstractoperator" ,
198- " TaskStateChangeCallback",
199- ] => Replacement :: Message (
200- "`TaskStateChangeCallback` has been moved to ` airflow.sdk.definitions._internal.abstractoperator` \
201- since Airflow 3.1. This is an internal module and is subject to change without notice." ,
202- ) ,
187+ rest @ ( "AbstractOperator" | "NotMapped" | " TaskStateChangeCallback") ,
188+ ] => Replacement :: InternalModule {
189+ module : " airflow.sdk.definitions._internal.abstractoperator" ,
190+ name : rest . to_string ( ) ,
191+ } ,
203192 // airflow.models.baseoperator
204193 [ "airflow" , "models" , "baseoperator" , "BaseOperator" ] => {
205194 Replacement :: SourceModuleMovedToSDK {
0 commit comments