Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions airflow/sensors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
from airflow.models.taskreschedule import TaskReschedule
from airflow.ti_deps.deps.ready_to_reschedule import ReadyToRescheduleDep
from airflow.utils import timezone

# We need to keep the import here because GCSToLocalFilesystemOperator released in
# Google Provider before 3.0.0 imported apply_defaults from here.
# See https://github.com/apache/airflow/issues/16035
from airflow.utils.decorators import apply_defaults # noqa: F401
from airflow.utils.session import NEW_SESSION, provide_session

if TYPE_CHECKING:
Expand Down
34 changes: 1 addition & 33 deletions airflow/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,12 @@
from __future__ import annotations

import sys
import warnings
from collections import deque
from functools import wraps
from typing import Callable, TypeVar, cast

from airflow.exceptions import RemovedInAirflow3Warning
from typing import Callable, TypeVar

T = TypeVar("T", bound=Callable)


def apply_defaults(func: T) -> T:
"""
Use apply_default decorator for the `default_args` feature to work properly; deprecated.

In previous versions, all subclasses of BaseOperator must use apply_default decorator for the"
`default_args` feature to work properly.

In current version, it is optional. The decorator is applied automatically using the metaclass.
"""
warnings.warn(
"This decorator is deprecated. \n"
"\n"
"In previous versions, all subclasses of BaseOperator must use apply_default decorator for the "
"`default_args` feature to work properly.\n"
"\n"
"In current version, it is optional. The decorator is applied automatically using the metaclass.\n",
RemovedInAirflow3Warning,
stacklevel=3,
)

# Make it still be a wrapper to keep the previous behaviour of an extra stack frame
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)

return cast(T, wrapper)


def remove_task_decorator(python_source: str, task_decorator_name: str) -> str:
"""
Remove @task or similar decorators as well as @setup and @teardown.
Expand Down
1 change: 1 addition & 0 deletions newsfragments/41579.significant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed deprecated ``apply_defaults`` function from ``airflow/utils/decorators.py``.