-
Notifications
You must be signed in to change notification settings - Fork 16.6k
[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
Merged
[v3-1-test] Fix code formatting via ruff preview (#57641) #57670
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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", | ||
|
|
@@ -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": { | ||
|
|
@@ -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", | ||
| } | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
|
|
||
| from __future__ import annotations | ||
|
|
||
| import importlib | ||
| import importlib.machinery | ||
| import importlib.util | ||
| import inspect | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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", | ||
| }, | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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" | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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", | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -21,7 +21,6 @@ | |
| import io | ||
| import itertools | ||
| import logging | ||
| import logging.config | ||
| import os | ||
| import re | ||
| from http import HTTPStatus | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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: | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -16,7 +16,6 @@ | |
| # under the License. | ||
| from __future__ import annotations | ||
|
|
||
| import concurrent | ||
| import concurrent.futures | ||
| import datetime | ||
| import itertools | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -33,7 +33,6 @@ | |
| from pathlib import Path | ||
| from typing import TYPE_CHECKING, Any | ||
|
|
||
| import botocore.client | ||
| import botocore.exceptions | ||
| import botocore.waiter | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ | |
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| import logging.config | ||
| from importlib import reload | ||
| from unittest import mock | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ | |
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| import logging.config | ||
| import re | ||
| from importlib import reload | ||
| from unittest import mock | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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: ... | ||
|
|
@@ -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, | ||
|
|
@@ -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 | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
|
|
||
| import json | ||
| import logging | ||
| import logging.config | ||
| from unittest import mock | ||
|
|
||
| import pytest | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ | |
|
|
||
| import inspect | ||
| import logging | ||
| import logging.config | ||
| from unittest.mock import MagicMock | ||
|
|
||
| import pandas as pd | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
| ) | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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)) | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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) | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
|
|
||
| import copy | ||
| import logging | ||
| import logging.config | ||
| import os | ||
| import pickle | ||
| import re | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -32,7 +32,6 @@ | |
| import re | ||
|
|
||
| import docutils.nodes | ||
| import docutils.parsers.rst | ||
| from docutils.core import publish_doctree | ||
| from jinja2 import BaseLoader, Environment | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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"] | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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() | ||
|
|
@@ -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) | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.