Skip to content

Commit

Permalink
adding deprications for core operators (apache#43972)
Browse files Browse the repository at this point in the history
  • Loading branch information
gopidesupavan authored Nov 13, 2024
1 parent 26e8063 commit 951b3a1
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
17 changes: 17 additions & 0 deletions airflow/hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@
# specific language governing permissions and limitations
# under the License.
# fmt:, off

from __future__ import annotations

from airflow.utils.deprecation_tools import add_deprecated_classes

__deprecated_classes = {
"filesystem": {
"FSHook": "airflow.providers.standard.hooks.filesystem.FSHook",
},
"package_index": {
"PackageIndexHook": "airflow.providers.standard.hooks.package_index.PackageIndexHook",
},
"subprocess": {
"SubprocessHook": "airflow.providers.standard.hooks.subprocess.SubprocessHook",
},
}
add_deprecated_classes(__deprecated_classes, __name__)
30 changes: 30 additions & 0 deletions airflow/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,33 @@
:sphinx-autoapi-skip:
"""

from __future__ import annotations

from airflow.utils.deprecation_tools import add_deprecated_classes

__deprecated_classes = {
"python":{
"PythonOperator": "airflow.providers.standard.operators.python.PythonOperator",
"BranchPythonOperator": "airflow.providers.standard.operators.python.BranchPythonOperator",
"ShortCircuitOperator": "airflow.providers.standard.operators.python.ShortCircuitOperator",
"PythonVirtualenvOperator": "airflow.providers.standard.operators.python.PythonVirtualenvOperator",
"ExternalPythonOperator": "airflow.providers.standard.operators.python.ExternalPythonOperator",
"BranchExternalPythonOperator": "airflow.providers.standard.operators.python.BranchExternalPythonOperator",
"BranchPythonVirtualenvOperator": "airflow.providers.standard.operators.python.BranchPythonVirtualenvOperator",
},
"bash":{
"BashOperator": "airflow.providers.standard.operators.bash.BashOperator",
},
"datetime":{
"BranchDateTimeOperator": "airflow.providers.standard.operators.datetime.BranchDateTimeOperator",
},
"generic_transfer": {
"GenericTransfer": "airflow.providers.standard.operators.generic_transfer.GenericTransfer",
},
"weekday": {
"BranchDayOfWeekOperator": "airflow.providers.standard.operators.weekday.BranchDayOfWeekOperator",
},

}
add_deprecated_classes(__deprecated_classes, __name__)
29 changes: 29 additions & 0 deletions airflow/sensors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,32 @@
:sphinx-autoapi-skip:
"""

from __future__ import annotations

from airflow.utils.deprecation_tools import add_deprecated_classes

__deprecated_classes = {
"python":{
"PythonSensor": "airflow.providers.standard.sensors.python.PythonSensor",
},
"bash":{
"BashSensor": "airflow.providers.standard.sensor.bash.BashSensor",
},
"date_time":{
"DateTimeSensor": "airflow.providers.standard.sensors.date_time.DateTimeSensor",
"DateTimeSensorAsync": "airflow.providers.standard.sensors.date_time.DateTimeSensorAsync",
},
"time_sensor": {
"TimeSensor": "airflow.providers.standard.sensors.time.TimeSensor",
"TimeSensorAsync": "airflow.providers.standard.sensors.time.TimeSensorAsync",
},
"weekday": {
"DayOfWeekSensor": "airflow.providers.standard.sensors.weekday.DayOfWeekSensor",
},
"time_delta": {
"TimeDeltaSensor": "airflow.providers.standard.sensors.time_delta.TimeDeltaSensor",
"TimeDeltaSensorAsync": "airflow.providers.standard.sensors.time_delta.TimeDeltaSensorAsync",
}
}
add_deprecated_classes(__deprecated_classes, __name__)

0 comments on commit 951b3a1

Please sign in to comment.