Skip to content

ci: improve check_deferrable_default script to cover positional variables - #41924

Merged
potiuk merged 1 commit into
apache:mainfrom
astronomer:import-deferrable-default-check-script
Sep 1, 2024
Merged

potiuk merged 1 commit into
apache:mainfrom
astronomer:import-deferrable-default-check-script

Conversation

@Lee-W

@Lee-W Lee-W commented Sep 1, 2024

Copy link
Copy Markdown
Member

Why

The original scripts might miss the case that the deferable argument is set as a positional argument. The following is an example operator that will pass this check.

from __future__ import annotations

from airflow.models.baseoperator import BaseOperator


class ExampleOperator(BaseOperator):
    def __init__(self, /, deferrable, *, a=1, **kwargs) -> None:
        super().__init__(**kwargs)

What

  • add posonlyargs into check
  • Check whether the argument default is not None when the argument is deferrable

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants