-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dcreager/typing-any
* main: [red-knot] Test: Hashable/Sized => A/B (#14769) [`flake8-type-checking`] Expands TC006 docs to better explain itself (#14749) [`pycodestyle`] Handle f-strings properly for `invalid-escape-sequence (W605)` (#14748) [red-knot] Add fuzzer to catch panics for invalid syntax (#14678) Check `AIR001` from builtin or providers `operators` module (#14631) [airflow]: extend removed names (AIR302) (#14734)
- Loading branch information
Showing
19 changed files
with
722 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 11 additions & 5 deletions
16
crates/ruff_linter/resources/test/fixtures/airflow/AIR001.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
from airflow.operators import PythonOperator | ||
from airflow.providers.airbyte.operators.airbyte import AirbyteTriggerSyncOperator | ||
from airflow.providers.amazon.aws.operators.appflow import AppflowFlowRunOperator | ||
|
||
|
||
def my_callable(): | ||
pass | ||
|
||
|
||
my_task = PythonOperator(task_id="my_task", callable=my_callable) | ||
my_task_2 = PythonOperator(callable=my_callable, task_id="my_task_2") | ||
incorrect_name = PythonOperator(task_id="my_task") # AIR001 | ||
|
||
incorrect_name = PythonOperator(task_id="my_task") | ||
incorrect_name_2 = PythonOperator(callable=my_callable, task_id="my_task_2") | ||
my_task = AirbyteTriggerSyncOperator(task_id="my_task", callable=my_callable) | ||
incorrect_name = AirbyteTriggerSyncOperator(task_id="my_task") # AIR001 | ||
|
||
from my_module import MyClass | ||
my_task = AppflowFlowRunOperator(task_id="my_task", callable=my_callable) | ||
incorrect_name = AppflowFlowRunOperator(task_id="my_task") # AIR001 | ||
|
||
incorrect_name = MyClass(task_id="my_task") | ||
# Consider only from the `airflow.operators` (or providers operators) module | ||
from airflow import MyOperator | ||
|
||
incorrect_name = MyOperator(task_id="my_task") |
46 changes: 43 additions & 3 deletions
46
crates/ruff_linter/resources/test/fixtures/airflow/AIR302_names.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,52 @@ | ||
from airflow.triggers.external_task import TaskStateTrigger | ||
from airflow.www.auth import has_access | ||
from airflow.api_connexion.security import requires_access | ||
from airflow.metrics.validators import AllowListValidator | ||
from airflow.metrics.validators import BlockListValidator | ||
from airflow.utils import dates | ||
from airflow.utils.dates import date_range, datetime_to_nano, days_ago | ||
from airflow.utils.dates import ( | ||
date_range, | ||
datetime_to_nano, | ||
days_ago, | ||
infer_time_unit, | ||
parse_execution_date, | ||
round_time, | ||
scale_time_units, | ||
) | ||
from airflow.utils.file import TemporaryDirectory, mkdirs | ||
from airflow.utils.state import SHUTDOWN, terminating_states | ||
from airflow.utils.dag_cycle_tester import test_cycle | ||
|
||
|
||
TaskStateTrigger | ||
|
||
date_range | ||
days_ago | ||
|
||
has_access | ||
requires_access | ||
|
||
AllowListValidator | ||
BlockListValidator | ||
|
||
dates.date_range | ||
dates.days_ago | ||
|
||
date_range | ||
days_ago | ||
parse_execution_date | ||
round_time | ||
scale_time_units | ||
infer_time_unit | ||
|
||
|
||
# This one was not deprecated. | ||
datetime_to_nano | ||
dates.datetime_to_nano | ||
|
||
TemporaryDirectory | ||
mkdirs | ||
|
||
SHUTDOWN | ||
terminating_states | ||
|
||
|
||
test_cycle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.