Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[v3-1-test] Fix code formatting via ruff preview (#57641) #57670

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

Merged
potiuk merged 1 commit into apache:v3-1-test from jscheffl:backport-75bd628-v3-1-test
Nov 1, 2025
Merged

[v3-1-test] Fix code formatting via ruff preview (#57641) #57670

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
8 changes: 4 additions & 4 deletions airflow-core/src/airflow/operators/__init__.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from airflow.utils.deprecation_tools import add_deprecated_classes

__deprecated_classes = {
"python":{
"python": {
"PythonOperator": "airflow.providers.standard.operators.python.PythonOperator",
"BranchPythonOperator": "airflow.providers.standard.operators.python.BranchPythonOperator",
"ShortCircuitOperator": "airflow.providers.standard.operators.python.ShortCircuitOperator",
Expand All @@ -37,10 +37,10 @@
"BranchPythonVirtualenvOperator": "airflow.providers.standard.operators.python.BranchPythonVirtualenvOperator",
"get_current_context": "airflow.sdk.get_current_context",
},
"bash":{
"bash": {
"BashOperator": "airflow.providers.standard.operators.bash.BashOperator",
},
"datetime":{
"datetime": {
"BranchDateTimeOperator": "airflow.providers.standard.operators.datetime.BranchDateTimeOperator",
},
"generic_transfer": {
Expand All @@ -64,7 +64,7 @@
"smooth": {
"SmoothOperator": "airflow.providers.standard.operators.smooth.SmoothOperator",
},
"branch":{
"branch": {
"BranchMixIn": "airflow.providers.standard.operators.branch.BranchMixIn",
"BaseBranchOperator": "airflow.providers.standard.operators.branch.BaseBranchOperator",
}
Expand Down
1 change: 0 additions & 1 deletion airflow-core/src/airflow/plugins_manager.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from __future__ import annotations

import importlib
import importlib.machinery
import importlib.util
import inspect
Expand Down
6 changes: 3 additions & 3 deletions airflow-core/src/airflow/sensors/__init__.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"PokeReturnValue": "airflow.sdk.bases.sensor.PokeReturnValue",
"poke_mode_only": "airflow.sdk.bases.sensor.poke_mode_only",
},
"python":{
"python": {
"PythonSensor": "airflow.providers.standard.sensors.python.PythonSensor",
},
"bash":{
"bash": {
"BashSensor": "airflow.providers.standard.sensors.bash.BashSensor",
},
"date_time":{
"date_time": {
"DateTimeSensor": "airflow.providers.standard.sensors.date_time.DateTimeSensor",
"DateTimeSensorAsync": "airflow.providers.standard.sensors.date_time.DateTimeSensorAsync",
},
Expand Down
2 changes: 1 addition & 1 deletion airflow-core/src/airflow/ti_deps/deps/not_previously_skipped _dep.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from airflow.models.taskinstance import PAST_DEPENDS_MET
from airflow.ti_deps.deps.base_ti_dep import BaseTIDep

## The following constants are taken from the SkipMixin class in the standard provider
# The following constants are taken from the SkipMixin class in the standard provider
# The key used by SkipMixin to store XCom data.
XCOM_SKIPMIXIN_KEY = "skipmixin_key"

Expand Down
2 changes: 1 addition & 1 deletion airflow-core/src/airflow/utils/log/file_task_handler.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _fetch_logs_from_service(url: str, log_relative_path: str) -> Response:
algorithm="HS512",
# We must set an empty private key here as otherwise it can be automatically loaded by JWTGenerator
# and secret_key and private_key cannot be set together
private_key=None, # type: ignore[arg-type]
private_key=None, # type: ignore[arg-type]
issuer=None,
valid_for=conf.getint("webserver", "log_request_clock_grace", fallback=30),
audience="task-instance-logs",
Expand Down
1 change: 0 additions & 1 deletion airflow-core/tests/unit/utils/test_log_handlers.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io
import itertools
import logging
import logging.config
import os
import re
from http import HTTPStatus
Expand Down
2 changes: 0 additions & 2 deletions dev/airflow-github
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,7 @@ def cli():
" searching for few commits to find the cherry-picked commits",
)
@click.option("--unmerged", "show_uncherrypicked_only", help="Show unmerged PRs only", is_flag=True)

@click.option("--show-commits", help="Show commit SHAs (default: on, off when --unmerged)", is_flag=True, default=None)

def compare(target_version, github_token, previous_version=None, show_uncherrypicked_only=False, show_commits=None):
# Set smart defaults
if show_commits is None:
Expand Down
1 change: 0 additions & 1 deletion devel-common/src/sphinx_exts/docs_build/fetch_inventories.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# under the License.
from __future__ import annotations

import concurrent
import concurrent.futures
import datetime
import itertools
Expand Down
1 change: 0 additions & 1 deletion providers/amazon/src/airflow/providers/amazon/aws/hooks/batc h_waiters.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from pathlib import Path
from typing import TYPE_CHECKING, Any

import botocore.client
import botocore.exceptions
import botocore.waiter

Expand Down
1 change: 0 additions & 1 deletion providers/celery/tests/unit/celery/log_handlers/test_log_han dlers.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from __future__ import annotations

import logging
import logging.config
from importlib import reload
from unittest import mock

Expand Down
1 change: 0 additions & 1 deletion providers/cncf/kubernetes/tests/unit/cncf/kubernetes/log_han dlers/test_log_handlers.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from __future__ import annotations

import logging
import logging.config
import re
from importlib import reload
from unittest import mock
Expand Down
6 changes: 3 additions & 3 deletions providers/common/sql/src/airflow/providers/common/sql/hooks/ sql.pyi
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class DbApiHook(BaseHook):
) -> PandasDataFrame: ...
def get_pandas_df_by_chunks(
self, sql, parameters: list | tuple | Mapping[str, Any] | None = None, *, chunksize: int, **kwargs
) -> Generator[PandasDataFrame, None, None]: ...
) -> Generator[PandasDataFrame]: ...
def get_records(
self, sql: str | list[str], parameters: Iterable | Mapping[str, Any] | None = None
) -> Any: ...
Expand Down Expand Up @@ -143,7 +143,7 @@ class DbApiHook(BaseHook):
chunksize: int,
df_type: Literal["pandas"] = "pandas",
**kwargs,
) -> Generator[PandasDataFrame, None, None]: ...
) -> Generator[PandasDataFrame]: ...
@overload
def get_df_by_chunks(
self,
Expand All @@ -153,7 +153,7 @@ class DbApiHook(BaseHook):
chunksize: int,
df_type: Literal["polars"],
**kwargs,
) -> Generator[PolarsDataFrame, None, None]: ...
) -> Generator[PolarsDataFrame]: ...
@staticmethod
def strip_sql_string(sql: str) -> str: ...
@staticmethod
Expand Down
1 change: 0 additions & 1 deletion providers/common/sql/tests/unit/common/sql/hooks/test_dbapi. py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import json
import logging
import logging.config
from unittest import mock

import pytest
Expand Down
1 change: 0 additions & 1 deletion providers/common/sql/tests/unit/common/sql/hooks/test_sql.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import inspect
import logging
import logging.config
from unittest.mock import MagicMock

import pandas as pd
Expand Down
2 changes: 0 additions & 2 deletions providers/databricks/tests/unit/databricks/hooks/test_databr icks.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
from unittest.mock import AsyncMock

import aiohttp
import aiohttp.client_exceptions
import azure.identity
import azure.identity.aio
import pytest
import tenacity
from azure.core.credentials import AccessToken
Expand Down
2 changes: 1 addition & 1 deletion providers/edge3/src/airflow/providers/edge3/worker_api/route s/worker.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def set_state(
free_concurrency=int(body.sysinfo["free_concurrency"]),
queues=worker.queues,
)
_assert_version(body.sysinfo) # Exception only after worker state is in the DB
_assert_version(body.sysinfo) # Exception only after worker state is in the DB
return WorkerSetStateReturn(
state=worker.state, queues=worker.queues, maintenance_comments=worker.maintenance_comment
)
Expand Down
2 changes: 1 addition & 1 deletion providers/google/src/airflow/providers/google/cloud/hooks/bi gquery.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def get_datasets_list(
if return_iterator:
# The iterator returned by list_datasets() is a HTTPIterator but annotated
# as Iterator
return iterator # type: ignore
return iterator # type: ignore

datasets_list = list(iterator)
self.log.info("Datasets List: %s", len(datasets_list))
Expand Down
2 changes: 1 addition & 1 deletion providers/google/src/airflow/providers/google/cloud/hooks/ml engine.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ async def get_job_status(
job = await self.get_job(
project_id=project_id,
job_id=job_id,
session=session, # type: ignore
session=session, # type: ignore
)
job = await job.json(content_type=None)
self.log.info("Retrieving json_response: %s", job)
Expand Down
1 change: 0 additions & 1 deletion providers/google/src/airflow/providers/google/common/auth_ba ckend/google_openid.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from functools import wraps
from typing import TypeVar, cast

import google
import google.auth.transport.requests
import google.oauth2.id_token

Expand Down
1 change: 0 additions & 1 deletion providers/google/src/airflow/providers/google/common/hooks/b ase_google.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from typing import TYPE_CHECKING, Any, TypeVar, cast

import google.auth
import google.oauth2.service_account
import google_auth_httplib2
import requests
import tenacity
Expand Down
3 changes: 1 addition & 2 deletions providers/google/src/airflow/providers/google/common/utils/i d_token_credentials.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
import os
from typing import TYPE_CHECKING

import google.auth.transport
from google.auth import credentials as google_auth_credentials, environment_vars, exceptions
from google.oauth2 import credentials as oauth2_credentials, service_account

if TYPE_CHECKING:
import google.oauth2
import google.auth.transport

# Valid types accepted for file-based credentials.
# They are taken from "google.auth._default" and since they are all "protected" and the imports might
Expand Down
1 change: 0 additions & 1 deletion providers/postgres/src/airflow/providers/postgres/hooks/post gres.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeAlias, cast, overload

import psycopg2
import psycopg2.extensions
import psycopg2.extras
from more_itertools import chunked
from psycopg2.extras import DictCursor, NamedTupleCursor, RealDictCursor, execute_batch
Expand Down
1 change: 0 additions & 1 deletion providers/standard/tests/unit/standard/operators/test_python .py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import copy
import logging
import logging.config
import os
import pickle
import re
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/prek/significant_newsfragments_checker.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import re

import docutils.nodes
import docutils.parsers.rst
from docutils.core import publish_doctree
from jinja2 import BaseLoader, Environment

Expand Down
4 changes: 2 additions & 2 deletions task-sdk/src/airflow/sdk/definitions/asset/__init__.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def _validate_identifier(instance, attribute, value):
raise ValueError(f"{type(instance).__name__} {attribute.name} cannot exceed 1500 characters")
if value.isspace():
raise ValueError(f"{type(instance).__name__} {attribute.name} cannot be just whitespace")
## We use latin1_general_cs to store the name (and group, asset values etc) on MySQL.
## relaxing this check for non mysql backend
# We use latin1_general_cs to store the name (and group, asset values etc.) on MySQL.
# relaxing this check for non mysql backend
if SQL_ALCHEMY_CONN.startswith("mysql") and not value.isascii():
raise ValueError(f"{type(instance).__name__} {attribute.name} must only consist of ASCII characters")
return value
Expand Down
4 changes: 2 additions & 2 deletions task-sdk/src/airflow/sdk/definitions/decorators/condition.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
from airflow.sdk.definitions.context import Context

BoolConditionFunc: TypeAlias = Callable[[Context], bool]
MsgConditionFunc: TypeAlias = "Callable[[Context], tuple[bool, str | None]]"
AnyConditionFunc: TypeAlias = "BoolConditionFunc | MsgConditionFunc"
MsgConditionFunc: TypeAlias = Callable[[Context], tuple[bool, str | None]]
AnyConditionFunc: TypeAlias = BoolConditionFunc | MsgConditionFunc

__all__ = ["run_if", "skip_if"]

Expand Down
6 changes: 3 additions & 3 deletions task-sdk/tests/task_sdk/execution_time/test_supervisor.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ def _handler(sig, frame):

def test_service_subprocess(self, watched_subprocess, mock_process, mocker):
"""Test `_service_subprocess` processes selector events and handles subprocess exit."""
## Given
# Given

# Mock file objects and handlers
mock_stdout = mocker.Mock()
Expand All @@ -1224,10 +1224,10 @@ def test_service_subprocess(self, watched_subprocess, mock_process, mocker):
# Mock to simulate process exited successfully
mock_process.wait.return_value = 0

## Our actual test
# Our actual test
watched_subprocess._service_subprocess(max_wait_time=1.0)

## Validations!
# Validations!
# Validate selector interactions
watched_subprocess.selector.select.assert_called_once_with(timeout=1.0)

Expand Down