Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change type annotation for BaseOperatorLink.operators #35003

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 1 addition & 11 deletions airflow/models/baseoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
ClassVar,
Collection,
Iterable,
List,
Sequence,
Type,
TypeVar,
Union,
cast,
Expand Down Expand Up @@ -1891,19 +1889,11 @@ def chain_linear(*elements: DependencyMixin | Sequence[DependencyMixin]):
raise ValueError("No dependencies were set. Did you forget to expand with `*`?")


# pyupgrade assumes all type annotations can be lazily evaluated, but this is
# not the case for attrs-decorated classes, since cattrs needs to evaluate the
# annotation expressions at runtime, and Python before 3.9.0 does not lazily
# evaluate those. Putting the expression in a top-level assignment statement
# communicates this runtime requirement to pyupgrade.
BaseOperatorClassList = List[Type[BaseOperator]]


@attr.s(auto_attribs=True)
class BaseOperatorLink(metaclass=ABCMeta):
"""Abstract base class that defines how we get an operator link."""

operators: ClassVar[BaseOperatorClassList] = []
operators: ClassVar[list[type[BaseOperator]]] = []
"""
This property will be used by Airflow Plugins to find the Operators to which you want
to assign this Operator Link
Expand Down