1#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18
19from __future__ import annotations
20
21from airflow.utils.deprecation_tools import add_deprecated_classes
22
23__deprecated_classes = {
24 "setup_teardown": {
25 "BaseSetupTeardownContext": "airflow.sdk.definitions._internal.setup_teardown.BaseSetupTeardownContext",
26 "SetupTeardownContext": "airflow.sdk.definitions._internal.setup_teardown.SetupTeardownContext",
27 },
28 "xcom": {
29 "XCOM_RETURN_KEY": "airflow.models.xcom.XCOM_RETURN_KEY",
30 },
31 "task_group": {
32 "TaskGroup": "airflow.sdk.TaskGroup",
33 },
34 "timezone": {
35 # Since we have corrected all uses inside core to use the internal version, anything hitting this
36 # should be in user code or custom providers, so redirect them to the public interface in Task SDK
37 "*": "airflow.sdk.timezone"
38 },
39 "decorators": {
40 "remove_task_decorator": "airflow.sdk.definitions._internal.decorators.remove_task_decorator",
41 "fixup_decorator_warning_stack": "airflow.sdk.definitions._internal.decorators.fixup_decorator_warning_stack",
42 },
43 "timeout": {
44 "timeout": "airflow.sdk.execution_time.timeout.timeout",
45 },
46 "trigger_rule": {"*": "airflow.task.trigger_rule"},
47 "operator_resources": {
48 "*": "airflow.sdk.definitions.operator_resources",
49 },
50 "weight_rule": {
51 "WeightRule": "airflow.task.weight_rule.WeightRule",
52 "DB_SAFE_MINIMUM": "airflow.sdk.bases.operator.DB_SAFE_MINIMUM",
53 "DB_SAFE_MAXIMUM": "airflow.sdk.bases.operator.DB_SAFE_MAXIMUM",
54 "db_safe_priority": "airflow.sdk.bases.operator.db_safe_priority",
55 },
56}
57
58add_deprecated_classes(__deprecated_classes, __name__)