From 2a40243ae443ba219074994842a986abfa7801cd Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 04:14:32 +0000 Subject: [PATCH 1/4] chore(lint): enable A003, PLW0108 rules (zero-violation easy wins) Un-ignore A003 (no builtin shadowing in classes) and PLW0108 (no unnecessary lambdas). Both have 0 existing violations, so this is config-only with no code changes needed. Co-Authored-By: AJ Steers --- .ruff.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index f0b61926a..0385e83b5 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -86,12 +86,12 @@ ignore = [ "INP001", # Dir 'examples' is part of an implicit namespace package. Add an __init__.py. # TODO: Consider re-enabling these before release: - "A003", # Class attribute 'type' is shadowing a Python builtin + # "A003", # Class attribute 'type' is shadowing a Python builtin (now enforced) "BLE001", # Do not catch blind exception: Exception "ERA001", # Remove commented-out code "FIX002", # Allow "TODO:" until release (then switch to requiring links via TDO003) "PLW0603", # Using the global statement to update _cache is discouraged - "PLW0108", # Lambda may be unnecessary; consider inlining inner function + # "PLW0108", # Lambda may be unnecessary; consider inlining inner function (now enforced) "TRY003", # Allow exceptions to receive strings in constructors. # "TD003", # Require links for TODOs (now enabled) "UP038", # Allow tuples instead of "|" syntax in `isinstance()` checks ("|" is sometimes slower) From e03b9ac1b8681707a14c24bb8d9e816026c649e7 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 04:14:46 +0000 Subject: [PATCH 2/4] style(lint): remove 134 unused noqa directives (RUF100 auto-fix) Auto-fix stale noqa comments that suppress rules not triggered on those lines. These accumulate as code changes and become misleading. Co-Authored-By: AJ Steers --- airbyte/__init__.py | 4 ++-- airbyte/_connector_base.py | 2 +- airbyte/_executors/python.py | 2 +- airbyte/_executors/util.py | 6 ++--- airbyte/_message_iterators.py | 8 +++---- airbyte/_registry_utils.py | 4 ++-- airbyte/_util/api_util.py | 12 +++++----- airbyte/_util/destination_smoke_tests.py | 4 ++-- airbyte/_util/meta.py | 6 ++--- airbyte/_util/registry_spec.py | 2 +- airbyte/_util/temp_files.py | 2 +- airbyte/caches/_state_backend.py | 6 ++--- airbyte/caches/_utils/_dest_to_cache.py | 2 +- airbyte/caches/base.py | 16 +++++++------- airbyte/caches/util.py | 2 +- airbyte/cli/pyab.py | 2 +- airbyte/cli/smoke_test_source/source.py | 4 ++-- airbyte/cloud/connections.py | 4 ++-- airbyte/cloud/connectors.py | 10 ++++----- airbyte/cloud/sync_results.py | 4 ++-- airbyte/cloud/workspaces.py | 18 +++++++-------- airbyte/datasets/_sql.py | 2 +- airbyte/destinations/base.py | 6 ++--- airbyte/destinations/util.py | 2 +- airbyte/mcp/__init__.py | 2 +- airbyte/mcp/_arg_resolvers.py | 2 +- airbyte/mcp/_tool_utils.py | 6 ++--- airbyte/mcp/cloud.py | 10 ++++----- airbyte/mcp/interactive/__init__.py | 2 +- airbyte/mcp/interactive/_registry_ui.py | 2 +- airbyte/mcp/interactive/_sync_history_ui.py | 8 +++---- .../interactive/_workspace_sync_status_ui.py | 2 +- airbyte/mcp/local.py | 2 +- airbyte/mcp/server.py | 2 +- airbyte/progress.py | 22 +++++++++---------- airbyte/records.py | 4 ++-- airbyte/secrets/base.py | 10 ++++----- airbyte/secrets/google_colab.py | 2 +- airbyte/shared/catalog_providers.py | 2 +- airbyte/shared/sql_processor.py | 8 +++---- airbyte/sources/base.py | 12 +++++----- airbyte/sources/util.py | 2 +- airbyte/types.py | 8 +++---- airbyte/validate.py | 4 ++-- docs/generate.py | 2 +- examples/run_integ_test_source.py | 2 +- examples/run_perf_test_reads.py | 6 ++--- scripts/generate_mcp_markdown.py | 8 +++---- tests/unit_tests/test_cloud_credentials.py | 6 ++--- .../unit_tests/test_mcp_connector_registry.py | 2 +- 50 files changed, 134 insertions(+), 134 deletions(-) diff --git a/airbyte/__init__.py b/airbyte/__init__.py index 976c5a5f6..6d355011b 100644 --- a/airbyte/__init__.py +++ b/airbyte/__init__.py @@ -119,7 +119,7 @@ ---------------------- -""" # noqa: D415 +""" from __future__ import annotations @@ -152,7 +152,7 @@ datasets, destinations, documents, - exceptions, # noqa: ICN001 # No 'exc' alias for top-level module + exceptions, # No 'exc' alias for top-level module experimental, logs, mcp, diff --git a/airbyte/_connector_base.py b/airbyte/_connector_base.py index 0e8a66a40..745a41f68 100644 --- a/airbyte/_connector_base.py +++ b/airbyte/_connector_base.py @@ -246,7 +246,7 @@ def config_spec(self) -> dict[str, Any]: def print_config_spec( self, - format: Literal["yaml", "json"] = "yaml", # noqa: A002 + format: Literal["yaml", "json"] = "yaml", *, output_file: Path | str | None = None, stderr: bool = False, diff --git a/airbyte/_executors/python.py b/airbyte/_executors/python.py index 57a5e0094..ed1f776cb 100644 --- a/airbyte/_executors/python.py +++ b/airbyte/_executors/python.py @@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Literal from overrides import overrides -from rich import print # noqa: A004 # Allow shadowing the built-in +from rich import print # Allow shadowing the built-in from airbyte import exceptions as exc from airbyte._executors.base import Executor diff --git a/airbyte/_executors/util.py b/airbyte/_executors/util.py index 7a30a1bf1..bf5a86d41 100644 --- a/airbyte/_executors/util.py +++ b/airbyte/_executors/util.py @@ -11,7 +11,7 @@ import requests import yaml -from rich import print # noqa: A004 # Allow shadowing the built-in +from rich import print # Allow shadowing the built-in from airbyte import exceptions as exc from airbyte._executors.declarative import DeclarativeExecutor @@ -102,7 +102,7 @@ def _try_get_manifest_connector_files( headers={"User-Agent": f"PyAirbyte/{get_version()}"}, ) - if response.status_code == 404: # noqa: PLR2004 + if response.status_code == 404: return manifest_dict, None, None try: @@ -171,7 +171,7 @@ def _get_local_executor( ) -def get_connector_executor( # noqa: PLR0912, PLR0913, PLR0914, PLR0915, C901 # Too complex +def get_connector_executor( # Too complex name: str, *, version: str | None = None, diff --git a/airbyte/_message_iterators.py b/airbyte/_message_iterators.py index e6efd5a11..186705798 100644 --- a/airbyte/_message_iterators.py +++ b/airbyte/_message_iterators.py @@ -141,7 +141,7 @@ def generator() -> Generator[AirbyteMessage, None, None]: yield AirbyteMessage.model_validate_json(next_line) except pydantic.ValidationError: # Handle JSON decoding errors (optional) - raise ValueError("Invalid JSON format") # noqa: B904 + raise ValueError("Invalid JSON format") return cls(generator()) @@ -156,7 +156,7 @@ def generator() -> Generator[AirbyteMessage, None, None]: yield AirbyteMessage.model_validate_json(line) except pydantic.ValidationError: # Handle JSON decoding errors (optional) - raise ValueError(f"Invalid JSON format in input string: {line}") # noqa: B904 + raise ValueError(f"Invalid JSON format in input string: {line}") return cls(generator()) @@ -186,7 +186,7 @@ def generator() -> Generator[AirbyteMessage, None, None]: break next_line: str = current_file_buffer.readline() - if next_line == "": # noqa: PLC1901 # EOF produces an empty string + if next_line == "": # EOF produces an empty string # Close the current file and open the next one current_file_buffer.close() current_file_buffer = None # Ensure the buffer is reset @@ -202,6 +202,6 @@ def generator() -> Generator[AirbyteMessage, None, None]: # Handle JSON decoding errors current_file_buffer.close() current_file_buffer = None - raise ValueError("Invalid JSON format") # noqa: B904 + raise ValueError("Invalid JSON format") return cls(generator()) diff --git a/airbyte/_registry_utils.py b/airbyte/_registry_utils.py index b98c9eafc..d0ade95a2 100644 --- a/airbyte/_registry_utils.py +++ b/airbyte/_registry_utils.py @@ -10,7 +10,7 @@ logger = logging.getLogger("airbyte.registry") -def parse_changelog_html( # noqa: PLR0914 +def parse_changelog_html( html_content: str, connector_name: str ) -> list[dict[str, str | list[str] | None]]: """Parse changelog HTML to extract version history. @@ -88,7 +88,7 @@ def fetch_registry_version_date(connector_name: str, version: str) -> str | None Returns the release date string (YYYY-MM-DD) if found, None otherwise. """ - try: # noqa: PLR1702 + try: registry_url = "https://connectors.airbyte.com/files/registries/v0/oss_registry.json" response = requests.get(registry_url, timeout=10) response.raise_for_status() diff --git a/airbyte/_util/api_util.py b/airbyte/_util/api_util.py index e3f0a9eb5..5f48c83f8 100644 --- a/airbyte/_util/api_util.py +++ b/airbyte/_util/api_util.py @@ -55,7 +55,7 @@ def status_ok(status_code: int) -> bool: """Check if a status code is OK.""" - return status_code >= 200 and status_code < 300 # noqa: PLR2004 # allow inline magic numbers + return status_code >= 200 and status_code < 300 # allow inline magic numbers def _validate_pagination_params( @@ -843,7 +843,7 @@ def run_connection( # Get job info (logs) -def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexibility +def get_job_logs( # Too many arguments - needed for auth flexibility workspace_id: str, connection_id: str, limit: int | None = 100, @@ -1503,7 +1503,7 @@ def build_connection_schedule( ) -def create_connection( # noqa: PLR0913 # Too many arguments +def create_connection( # Too many arguments name: str, *, source_id: str, @@ -1677,7 +1677,7 @@ def delete_connection( ) -def patch_connection( # noqa: PLR0913 # Too many arguments +def patch_connection( # Too many arguments connection_id: str, *, api_root: str, @@ -1895,7 +1895,7 @@ def check_connector( def validate_yaml_manifest( - manifest: Any, # noqa: ANN401 + manifest: Any, *, raise_on_error: bool = True, ) -> tuple[bool, str | None]: @@ -2262,7 +2262,7 @@ def get_connector_builder_project( ) -def update_connector_builder_project_testing_values( # noqa: PLR0913 +def update_connector_builder_project_testing_values( *, workspace_id: str, builder_project_id: str, diff --git a/airbyte/_util/destination_smoke_tests.py b/airbyte/_util/destination_smoke_tests.py index 8990d6021..1e6c621c2 100644 --- a/airbyte/_util/destination_smoke_tests.py +++ b/airbyte/_util/destination_smoke_tests.py @@ -29,7 +29,7 @@ from airbyte import get_source from airbyte.exceptions import PyAirbyteInputError -from airbyte.shared.sql_processor import TableStatistics # noqa: TC001 # Pydantic needs at runtime +from airbyte.shared.sql_processor import TableStatistics # Pydantic needs at runtime logger = logging.getLogger(__name__) @@ -451,7 +451,7 @@ def _run_preflight( return True, None -def run_destination_smoke_test( # noqa: PLR0914 +def run_destination_smoke_test( *, destination: Destination, scenarios: str | list[str] = "fast", diff --git a/airbyte/_util/meta.py b/airbyte/_util/meta.py index fa1c9e135..b3bd9925d 100644 --- a/airbyte/_util/meta.py +++ b/airbyte/_util/meta.py @@ -104,7 +104,7 @@ def is_jupyter() -> bool: Will return False in Colab (use is_colab() instead). """ try: - shell = get_ipython().__class__.__name__ # type: ignore # noqa: PGH003 + shell = get_ipython().__class__.__name__ # type: ignore except NameError: return False # If 'get_ipython' undefined, we're probably in a standard Python interpreter. @@ -123,7 +123,7 @@ def get_notebook_name() -> str | None: session_info: dict | None = None with suppress(Exception): response = requests.get(COLAB_SESSION_URL) - if response.status_code == 200: # noqa: PLR2004 # Magic number + if response.status_code == 200: # Magic number session_info = response.json()[0] if session_info and "name" in session_info: @@ -135,7 +135,7 @@ def get_notebook_name() -> str | None: @lru_cache def get_vscode_notebook_name() -> str | None: with suppress(Exception): - import IPython # noqa: PLC0415 # pyrefly: ignore[missing-import] + import IPython # pyrefly: ignore[missing-import] return Path( IPython.extract_module_locals()[1]["__vsc_ipynb_file__"], diff --git a/airbyte/_util/registry_spec.py b/airbyte/_util/registry_spec.py index ec43b2c14..c253e730f 100644 --- a/airbyte/_util/registry_spec.py +++ b/airbyte/_util/registry_spec.py @@ -76,7 +76,7 @@ def get_connector_spec_from_registry( f"Spec for connector '{connector_name}' (version {version}, platform {platform}) " f"does not contain 'spec.connectionSpecification'." ) - return None # noqa: TRY300 + return None except requests.exceptions.Timeout: logger.warning( diff --git a/airbyte/_util/temp_files.py b/airbyte/_util/temp_files.py index ce2a65cf4..7bd888824 100644 --- a/airbyte/_util/temp_files.py +++ b/airbyte/_util/temp_files.py @@ -26,7 +26,7 @@ def as_temp_files(files_contents: list[dict | str]) -> Generator[list[str], Any, try: for content in files_contents: use_json = isinstance(content, dict) - temp_file = tempfile.NamedTemporaryFile( # noqa: SIM115 # Avoiding context manager + temp_file = tempfile.NamedTemporaryFile( # Avoiding context manager mode="w+t", delete=False, encoding="utf-8", diff --git a/airbyte/caches/_state_backend.py b/airbyte/caches/_state_backend.py index c61833d78..bff87437b 100644 --- a/airbyte/caches/_state_backend.py +++ b/airbyte/caches/_state_backend.py @@ -136,9 +136,9 @@ def _write_state( context={"state_message": state_message}, ) - self._state_backend._ensure_internal_tables() # noqa: SLF001 # Non-public member access - table_prefix = self._state_backend._table_prefix # noqa: SLF001 - engine = self._state_backend._sql_config.get_sql_engine() # noqa: SLF001 + self._state_backend._ensure_internal_tables() # Non-public member access + table_prefix = self._state_backend._table_prefix + engine = self._state_backend._sql_config.get_sql_engine() # Calculate the new state model to write. new_state = ( diff --git a/airbyte/caches/_utils/_dest_to_cache.py b/airbyte/caches/_utils/_dest_to_cache.py index a5b4700dc..8c6abe110 100644 --- a/airbyte/caches/_utils/_dest_to_cache.py +++ b/airbyte/caches/_utils/_dest_to_cache.py @@ -167,7 +167,7 @@ def duckdb_destination_to_cache( # actually live at `/destination-duckdb/foo.duckdb` on the # host. Resolve the host-side path so the cache can open the file. if db_path.startswith(("/local/", "/local\\")): - from airbyte.constants import DEFAULT_PROJECT_DIR # noqa: PLC0415 + from airbyte.constants import DEFAULT_PROJECT_DIR host_path = str(DEFAULT_PROJECT_DIR / "destination-duckdb" / db_path[len("/local/") :]) db_path = host_path diff --git a/airbyte/caches/base.py b/airbyte/caches/base.py index 2683577d4..313e0ca8e 100644 --- a/airbyte/caches/base.py +++ b/airbyte/caches/base.py @@ -42,7 +42,7 @@ from airbyte.strategies import WriteStrategy -class CacheBase(SqlConfig, AirbyteWriterInterface): # noqa: PLR0904 +class CacheBase(SqlConfig, AirbyteWriterInterface): """Base configuration for a cache. Caches inherit from the matching `SqlConfig` class, which provides the SQL config settings @@ -71,14 +71,14 @@ class CacheBase(SqlConfig, AirbyteWriterInterface): # noqa: PLR0904 paired_destination_config_class: ClassVar[type | None] = None @property - def paired_destination_config(self) -> Any | dict[str, Any]: # noqa: ANN401 # Allow Any return type + def paired_destination_config(self) -> Any | dict[str, Any]: # Allow Any return type """Return a dictionary of destination configuration values.""" raise NotImplementedError( f"The type '{type(self).__name__}' does not define an equivalent destination " "configuration." ) - def __init__(self, **data: Any) -> None: # noqa: ANN401 + def __init__(self, **data: Any) -> None: """Initialize the cache and backends.""" super().__init__(**data) @@ -90,7 +90,7 @@ def __init__(self, **data: Any) -> None: # noqa: ANN401 temp_dir=self.cache_dir, temp_file_cleanup=self.cleanup, ) - temp_processor._ensure_schema_exists() # noqa: SLF001 # Accessing non-public member + temp_processor._ensure_schema_exists() # Accessing non-public member # Initialize the catalog and state backends self._catalog_backend = SqlCatalogBackend( @@ -129,10 +129,10 @@ def close(self) -> None: self._read_processor.sql_config.dispose_engine() if self._catalog_backend is not None: - self._catalog_backend._sql_config.dispose_engine() # noqa: SLF001 + self._catalog_backend._sql_config.dispose_engine() if self._state_backend is not None: - self._state_backend._sql_config.dispose_engine() # noqa: SLF001 + self._state_backend._sql_config.dispose_engine() self.dispose_engine() @@ -416,11 +416,11 @@ def create_source_tables( ) # Ensure schema exists - self.processor._ensure_schema_exists() # noqa: SLF001 # Accessing non-public member + self.processor._ensure_schema_exists() # Accessing non-public member # Create tables for each stream if they don't exist for stream_name in catalog_provider.stream_names: - self.processor._ensure_final_table_exists( # noqa: SLF001 + self.processor._ensure_final_table_exists( stream_name=stream_name, create_if_missing=True, ) diff --git a/airbyte/caches/util.py b/airbyte/caches/util.py index 79b820137..55c1b045a 100644 --- a/airbyte/caches/util.py +++ b/airbyte/caches/util.py @@ -137,7 +137,7 @@ def get_colab_cache( ``` """ try: - from google.colab import drive # noqa: PLC0415 # type: ignore[reportMissingImports] + from google.colab import drive # type: ignore[reportMissingImports] except ImportError: drive = None msg = ( diff --git a/airbyte/cli/pyab.py b/airbyte/cli/pyab.py index 04173d39d..0c4f9e4c3 100644 --- a/airbyte/cli/pyab.py +++ b/airbyte/cli/pyab.py @@ -630,7 +630,7 @@ def sync( @cli.command(name="destination-smoke-test") -def destination_smoke_test( # noqa: PLR0913 +def destination_smoke_test( *, destination: Annotated[ str, diff --git a/airbyte/cli/smoke_test_source/source.py b/airbyte/cli/smoke_test_source/source.py index 46abc56a8..6d981d159 100644 --- a/airbyte/cli/smoke_test_source/source.py +++ b/airbyte/cli/smoke_test_source/source.py @@ -80,7 +80,7 @@ class SourceSmokeTest(Source): def spec( self, - logger: logging.Logger, # noqa: ARG002 + logger: logging.Logger, ) -> ConnectorSpecification: """Return the connector specification.""" return ConnectorSpecification( @@ -364,7 +364,7 @@ def read( logger: logging.Logger, config: Mapping[str, Any], catalog: ConfiguredAirbyteCatalog, - state: list[Any] | None = None, # noqa: ARG002 + state: list[Any] | None = None, ) -> Iterable[AirbyteMessage]: """Read records from selected smoke test streams.""" selected_streams = {stream.stream.name for stream in catalog.streams} diff --git a/airbyte/cloud/connections.py b/airbyte/cloud/connections.py index 528b91de9..9ff8fd15d 100644 --- a/airbyte/cloud/connections.py +++ b/airbyte/cloud/connections.py @@ -40,7 +40,7 @@ from airbyte.cloud.workspaces import CloudWorkspace -class CloudConnection: # noqa: PLR0904 # Too many public methods +class CloudConnection: # Too many public methods """A connection is an extract-load (EL) pairing of a source and destination in Airbyte Cloud. You can use a connection object to run sync jobs, retrieve logs, and manage the connection. @@ -180,7 +180,7 @@ def _from_connection_response( source=connection_info.source_id, destination=connection_info.destination_id, ) - result._connection_info = connection_info # noqa: SLF001 # Accessing Non-Public API + result._connection_info = connection_info # Accessing Non-Public API return result # Properties diff --git a/airbyte/cloud/connectors.py b/airbyte/cloud/connectors.py index 622e57ac9..3cd5292e7 100644 --- a/airbyte/cloud/connectors.py +++ b/airbyte/cloud/connectors.py @@ -267,7 +267,7 @@ def _from_source_response( workspace=workspace, connector_id=source_info.source_id, ) - result._connector_info = source_info # noqa: SLF001 # Accessing Non-Public API + result._connector_info = source_info # Accessing Non-Public API return result @@ -355,7 +355,7 @@ def _from_destination_response( workspace=workspace, connector_id=destination_info.destination_id, ) - result._connector_info = destination_info # noqa: SLF001 # Accessing Non-Public API + result._connector_info = destination_info # Accessing Non-Public API return result @@ -723,7 +723,7 @@ def update_definition( def rename( self, - new_name: str, # noqa: ARG002 + new_name: str, ) -> CustomCloudSourceDefinition: """Rename this custom source definition. @@ -771,7 +771,7 @@ def _from_yaml_response( definition_id=definition_info.definition_id, definition_type="yaml", ) - result._definition_info = definition_info # noqa: SLF001 + result._definition_info = definition_info return result def deploy_source( @@ -822,7 +822,7 @@ def deploy_source( client_secret=self.workspace.client_secret, bearer_token=self.workspace.bearer_token, ) - return CloudSource._from_source_response( # noqa: SLF001 # Accessing Non-Public API + return CloudSource._from_source_response( # Accessing Non-Public API workspace=self.workspace, source_response=result, ) diff --git a/airbyte/cloud/sync_results.py b/airbyte/cloud/sync_results.py index e2a88729d..612991a46 100644 --- a/airbyte/cloud/sync_results.py +++ b/airbyte/cloud/sync_results.py @@ -314,7 +314,7 @@ def start_time(self) -> datetime: return ab_datetime_parse(self._fetch_latest_job_info().start_time) except (ValueError, TypeError) as e: if "Invalid isoformat string" in str(e): - job_info_raw = api_util._make_config_api_request( # noqa: SLF001 + job_info_raw = api_util._make_config_api_request( api_root=self.workspace.api_root, config_api_root=self.workspace.config_api_root, path="/jobs/get", @@ -333,7 +333,7 @@ def _fetch_job_with_attempts(self) -> dict[str, Any]: if self._job_with_attempts_info is not None: return self._job_with_attempts_info - self._job_with_attempts_info = api_util._make_config_api_request( # noqa: SLF001 # Config API helper + self._job_with_attempts_info = api_util._make_config_api_request( # Config API helper api_root=self.workspace.api_root, config_api_root=self.workspace.config_api_root, path="/jobs/get", diff --git a/airbyte/cloud/workspaces.py b/airbyte/cloud/workspaces.py index 58f5539e7..8e545ac70 100644 --- a/airbyte/cloud/workspaces.py +++ b/airbyte/cloud/workspaces.py @@ -66,7 +66,7 @@ from airbyte.sources.base import Source -@dataclass(init=False, kw_only=True) # noqa: PLR0904 # Core cloud API facade. +@dataclass(init=False, kw_only=True) # Core cloud API facade. class CloudWorkspace: """A remote workspace on the Airbyte Cloud. @@ -384,7 +384,7 @@ def deploy_source( are not allowed. Defaults to `True`. random_name_suffix: Whether to append a random suffix to the name. """ - source_config_dict = source._hydrated_config.copy() # noqa: SLF001 (non-public API) + source_config_dict = source._hydrated_config.copy() source_config_dict["sourceType"] = source.name.replace("source-", "") if random_name_suffix: @@ -433,7 +433,7 @@ def deploy_destination( random_name_suffix: Whether to append a random suffix to the name. """ if isinstance(destination, Destination): - destination_conf_dict = destination._hydrated_config.copy() # noqa: SLF001 (non-public API) + destination_conf_dict = destination._hydrated_config.copy() destination_conf_dict["destinationType"] = destination.name.replace("destination-", "") # raise ValueError(destination_conf_dict) else: @@ -719,7 +719,7 @@ def list_connections( bearer_token=self.bearer_token, ) return [ - CloudConnection._from_connection_response( # noqa: SLF001 (non-public API) + CloudConnection._from_connection_response( workspace=self, connection_response=connection, ) @@ -745,7 +745,7 @@ def list_sources( bearer_token=self.bearer_token, ) return [ - CloudSource._from_source_response( # noqa: SLF001 (non-public API) + CloudSource._from_source_response( workspace=self, source_response=source, ) @@ -771,7 +771,7 @@ def list_destinations( bearer_token=self.bearer_token, ) return [ - CloudDestination._from_destination_response( # noqa: SLF001 (non-public API) + CloudDestination._from_destination_response( workspace=self, destination_response=destination, ) @@ -870,7 +870,7 @@ def publish_custom_source_definition( client_secret=self.client_secret, bearer_token=self.bearer_token, ) - custom_definition = CustomCloudSourceDefinition._from_yaml_response( # noqa: SLF001 + custom_definition = CustomCloudSourceDefinition._from_yaml_response( self, result ) @@ -907,7 +907,7 @@ def list_custom_source_definitions( bearer_token=self.bearer_token, ) return [ - CustomCloudSourceDefinition._from_yaml_response(self, d) # noqa: SLF001 + CustomCloudSourceDefinition._from_yaml_response(self, d) for d in yaml_definitions ] @@ -940,7 +940,7 @@ def get_custom_source_definition( client_secret=self.client_secret, bearer_token=self.bearer_token, ) - return CustomCloudSourceDefinition._from_yaml_response(self, result) # noqa: SLF001 + return CustomCloudSourceDefinition._from_yaml_response(self, result) raise NotImplementedError( "Docker custom source definitions are not yet supported. " diff --git a/airbyte/datasets/_sql.py b/airbyte/datasets/_sql.py index c2065c800..a3a589fcb 100644 --- a/airbyte/datasets/_sql.py +++ b/airbyte/datasets/_sql.py @@ -91,7 +91,7 @@ def __iter__(self) -> Iterator[dict[str, Any]]: for row in conn.execute(self._query_statement): # Access to private member required because SQLAlchemy doesn't expose a public API. # https://pydoc.dev/sqlalchemy/latest/sqlalchemy.engine.row.RowMapping.html - yield cast("dict[str, Any]", row._mapping) # noqa: SLF001 + yield cast("dict[str, Any]", row._mapping) def __len__(self) -> int: """Return the number of records in the dataset. diff --git a/airbyte/destinations/base.py b/airbyte/destinations/base.py index 0c540ffd7..67fa6e456 100644 --- a/airbyte/destinations/base.py +++ b/airbyte/destinations/base.py @@ -122,7 +122,7 @@ def get_sql_cache( return destination_to_cache(config, schema_name=schema_name) - def write( # noqa: PLR0912, PLR0915 # Too many arguments/statements + def write( # Too many arguments/statements self, source_data: Source | ReadResult, *, @@ -254,7 +254,7 @@ def write( # noqa: PLR0912, PLR0915 # Too many arguments/statements if source: if cache is False: # Get message iterator for source (caching disabled) - message_iterator: AirbyteMessageIterator = source._get_airbyte_message_iterator( # noqa: SLF001 # Non-public API + message_iterator: AirbyteMessageIterator = source._get_airbyte_message_iterator( # Non-public API streams=streams, state_provider=source_state_provider, progress_tracker=progress_tracker, @@ -263,7 +263,7 @@ def write( # noqa: PLR0912, PLR0915 # Too many arguments/statements else: # Caching enabled and we are reading from a source. # Read the data to cache if caching is enabled. - read_result = source._read_to_cache( # noqa: SLF001 # Non-public API + read_result = source._read_to_cache( # Non-public API cache=cache, state_provider=source_state_provider, state_writer=cache_state_writer, diff --git a/airbyte/destinations/util.py b/airbyte/destinations/util.py index 216c05659..63de3d77c 100644 --- a/airbyte/destinations/util.py +++ b/airbyte/destinations/util.py @@ -18,7 +18,7 @@ from airbyte.callbacks import ConfigChangeCallback -def get_destination( # noqa: PLR0913 # Too many arguments +def get_destination( # Too many arguments name: str, config: dict[str, Any] | None = None, *, diff --git a/airbyte/mcp/__init__.py b/airbyte/mcp/__init__.py index 0361e43fd..9134c38cd 100644 --- a/airbyte/mcp/__init__.py +++ b/airbyte/mcp/__init__.py @@ -208,7 +208,7 @@ - [PyAirbyte GitHub Issues](https://github.com/airbytehq/pyairbyte/issues) - [PyAirbyte Discussions](https://github.com/airbytehq/pyairbyte/discussions) -""" # noqa: D415 +""" from airbyte.mcp import cloud, local, registry, server diff --git a/airbyte/mcp/_arg_resolvers.py b/airbyte/mcp/_arg_resolvers.py index cb4f8df5c..bba6ce455 100644 --- a/airbyte/mcp/_arg_resolvers.py +++ b/airbyte/mcp/_arg_resolvers.py @@ -73,7 +73,7 @@ def resolve_list_of_strings(value: str | list[str] | set[str] | None) -> list[st return [item.strip() for item in value.split(",") if item.strip()] -def resolve_connector_config( # noqa: PLR0912 +def resolve_connector_config( config: dict | str | None = None, config_file: str | Path | None = None, config_secret_name: str | None = None, diff --git a/airbyte/mcp/_tool_utils.py b/airbyte/mcp/_tool_utils.py index bead0fdca..360f21622 100644 --- a/airbyte/mcp/_tool_utils.py +++ b/airbyte/mcp/_tool_utils.py @@ -20,10 +20,10 @@ from fastmcp_extensions import MCPServerConfigArg, get_mcp_config from fastmcp_extensions import mcp_tool as _mcp_tool from fastmcp_extensions.decorators import ( - _REGISTERED_PROVIDERS, # noqa: PLC2701 - _REGISTERED_TOOLS, # noqa: PLC2701 + _REGISTERED_PROVIDERS, + _REGISTERED_TOOLS, ) -from fastmcp_extensions.registration import _ProviderToolAnnotations # noqa: PLC2701 +from fastmcp_extensions.registration import _ProviderToolAnnotations from fastmcp_extensions.tool_filters import ( ANNOTATION_MCP_MODULE, ANNOTATION_READ_ONLY_HINT, diff --git a/airbyte/mcp/cloud.py b/airbyte/mcp/cloud.py index 0beab1b41..554e7d667 100644 --- a/airbyte/mcp/cloud.py +++ b/airbyte/mcp/cloud.py @@ -936,7 +936,7 @@ def describe_cloud_source( source_id=source.source_id, source_name=source_name, source_url=source.connector_url, - connector_definition_id=source._connector_info.definition_id, # noqa: SLF001 # type: ignore[union-attr] + connector_definition_id=source._connector_info.definition_id, # type: ignore[union-attr] ) @@ -972,7 +972,7 @@ def describe_cloud_destination( destination_id=destination.destination_id, destination_name=destination_name, destination_url=destination.connector_url, - connector_definition_id=destination._connector_info.definition_id, # noqa: SLF001 # type: ignore[union-attr] + connector_definition_id=destination._connector_info.definition_id, # type: ignore[union-attr] ) @@ -2527,10 +2527,10 @@ def _add_defaults_for_exclude_args( Args: exclude_args: List of argument names that will be excluded from the tool schema. """ - import inspect # noqa: PLC0415 # Local import for optional patching logic + import inspect # Local import for optional patching logic - from fastmcp_extensions.decorators import ( # noqa: PLC0415 - _REGISTERED_TOOLS, # noqa: PLC2701 + from fastmcp_extensions.decorators import ( + _REGISTERED_TOOLS, ) for func, _annotations in _REGISTERED_TOOLS: diff --git a/airbyte/mcp/interactive/__init__.py b/airbyte/mcp/interactive/__init__.py index a65f4f403..e27b838c6 100644 --- a/airbyte/mcp/interactive/__init__.py +++ b/airbyte/mcp/interactive/__init__.py @@ -6,7 +6,7 @@ from typing import TYPE_CHECKING from airbyte.mcp._tool_utils import register_mcp_tools -from airbyte.mcp.interactive import _prefab as _prefab_module # noqa: F401 +from airbyte.mcp.interactive import _prefab as _prefab_module from airbyte.mcp.interactive._registry_ui import show_connectors_list from airbyte.mcp.interactive._sync_history_ui import show_connection_sync_history from airbyte.mcp.interactive._workspace_sync_status_ui import show_workspace_sync_status diff --git a/airbyte/mcp/interactive/_registry_ui.py b/airbyte/mcp/interactive/_registry_ui.py index 54969e95f..51b8131b9 100644 --- a/airbyte/mcp/interactive/_registry_ui.py +++ b/airbyte/mcp/interactive/_registry_ui.py @@ -96,7 +96,7 @@ def show_connectors_list( ), ), ] = "", - certified: Annotated[ # noqa: FBT002 - FastMCP tool parameter. + certified: Annotated[ bool, Field( description=( diff --git a/airbyte/mcp/interactive/_sync_history_ui.py b/airbyte/mcp/interactive/_sync_history_ui.py index 72ba03467..99f849736 100644 --- a/airbyte/mcp/interactive/_sync_history_ui.py +++ b/airbyte/mcp/interactive/_sync_history_ui.py @@ -6,7 +6,7 @@ import json from typing import TYPE_CHECKING, Annotated, Literal -from fastmcp import Context # noqa: TC002 - required at runtime for FastMCP tool registration +from fastmcp import Context from fastmcp.apps import PrefabAppConfig from fastmcp.tools.base import ToolResult from prefab_ui.app import PrefabApp @@ -82,7 +82,7 @@ def _time_label(dt: datetime, *, include_date: bool = False) -> str: app=PrefabAppConfig(), extra_help_text=CLOUD_AUTH_TIP_TEXT, ) -def show_connection_sync_history( # noqa: PLR0914 +def show_connection_sync_history( ctx: Context, connection_id: Annotated[ str, @@ -219,7 +219,7 @@ def show_connection_sync_history( # noqa: PLR0914 ) -def _build_agent_text( # noqa: PLR0913 +def _build_agent_text( *, agent_context: Literal["verbose", "summary", "min"], connection_id: str, @@ -281,7 +281,7 @@ def _build_agent_text( # noqa: PLR0913 return f"{header}\n\n{summary}{detail}" -def _build_sync_history_app( # noqa: PLR0913 +def _build_sync_history_app( *, connection_name: str, job_history_url: str, diff --git a/airbyte/mcp/interactive/_workspace_sync_status_ui.py b/airbyte/mcp/interactive/_workspace_sync_status_ui.py index 77d7ca451..393cf4cb1 100644 --- a/airbyte/mcp/interactive/_workspace_sync_status_ui.py +++ b/airbyte/mcp/interactive/_workspace_sync_status_ui.py @@ -9,7 +9,7 @@ from enum import Enum from typing import TYPE_CHECKING, Annotated, Literal -from fastmcp import Context # noqa: TC002 - required at runtime for FastMCP tool registration +from fastmcp import Context from fastmcp.apps import PrefabAppConfig from fastmcp.tools.base import ToolResult from prefab_ui.actions import OpenLink, SendMessage, SetState diff --git a/airbyte/mcp/local.py b/airbyte/mcp/local.py index 0e6fab984..4504a1cd4 100644 --- a/airbyte/mcp/local.py +++ b/airbyte/mcp/local.py @@ -833,7 +833,7 @@ def run_sql_query( destructive=True, requires_client_filesystem=True, ) -def destination_smoke_test( # noqa: PLR0913, PLR0917 +def destination_smoke_test( destination_connector_name: Annotated[ str, Field( diff --git a/airbyte/mcp/server.py b/airbyte/mcp/server.py index abe661095..fc28de379 100644 --- a/airbyte/mcp/server.py +++ b/airbyte/mcp/server.py @@ -164,7 +164,7 @@ def _create_oidc_auth() -> OIDCProxy | None: @app.custom_route("/health", methods=["GET"]) -async def health_check(request: Request) -> JSONResponse: # noqa: ARG001, RUF029 +async def health_check(request: Request) -> JSONResponse: """Health check endpoint for load balancer probes.""" return JSONResponse({"status": "ok"}) diff --git a/airbyte/progress.py b/airbyte/progress.py index ad984f8a3..92a404268 100644 --- a/airbyte/progress.py +++ b/airbyte/progress.py @@ -127,15 +127,15 @@ def _get_elapsed_time_str(seconds: float) -> str: Minutes are always included after 1 minute elapsed. Hours are always included after 1 hour elapsed. """ - if seconds <= 2: # noqa: PLR2004 # Magic numbers OK here. + if seconds <= 2: # Magic numbers OK here. # Less than 1 minute elapsed return f"{seconds:.2f} seconds" - if seconds < 10: # noqa: PLR2004 # Magic numbers OK here. + if seconds < 10: # Magic numbers OK here. # Less than 10 seconds elapsed return f"{seconds:.1f} seconds" - if seconds <= 60: # noqa: PLR2004 # Magic numbers OK here. + if seconds <= 60: # Magic numbers OK here. # Less than 1 minute elapsed return f"{seconds:.0f} seconds" @@ -157,7 +157,7 @@ def _get_elapsed_time_str(seconds: float) -> str: return f"{hours}hr {minutes}min" -class ProgressTracker: # noqa: PLR0904 # Too many public methods +class ProgressTracker: # Too many public methods """A simple progress bar for the command line and IPython notebooks.""" def __init__( @@ -406,10 +406,10 @@ def _send_telemetry( A thin wrapper around `send_telemetry` that includes the job description. """ send_telemetry( - source=self._source._get_connector_runtime_info() if self._source else None, # noqa: SLF001 - cache=self._cache._get_writer_runtime_info() if self._cache else None, # noqa: SLF001 + source=self._source._get_connector_runtime_info() if self._source else None, + cache=self._cache._get_writer_runtime_info() if self._cache else None, destination=( - self._destination._get_connector_runtime_info() # noqa: SLF001 + self._destination._get_connector_runtime_info() if self._destination else None ), @@ -470,13 +470,13 @@ def _job_info(self) -> dict[str, Any]: "description": self.job_description, } if self._source: - job_info["source"] = self._source._get_connector_runtime_info().to_dict() # noqa: SLF001 + job_info["source"] = self._source._get_connector_runtime_info().to_dict() if self._cache: - job_info["cache"] = self._cache._get_writer_runtime_info().to_dict() # noqa: SLF001 + job_info["cache"] = self._cache._get_writer_runtime_info().to_dict() if self._destination: - job_info["destination"] = self._destination._get_connector_runtime_info().to_dict() # noqa: SLF001 + job_info["destination"] = self._destination._get_connector_runtime_info().to_dict() return job_info @@ -844,7 +844,7 @@ def _update_display(self, *, force_refresh: bool = False) -> None: if ( not force_refresh and self._last_update_time # if not set, then we definitely need to update - and cast("float", self.elapsed_seconds_since_last_update) < 0.8 # noqa: PLR2004 + and cast("float", self.elapsed_seconds_since_last_update) < 0.8 ): return diff --git a/airbyte/records.py b/airbyte/records.py index e28109088..664531278 100644 --- a/airbyte/records.py +++ b/airbyte/records.py @@ -256,14 +256,14 @@ def from_record_message( extracted_at=datetime.fromtimestamp(record_message.emitted_at / 1000, tz=timezone.utc), ) - def __getitem__(self, key: str) -> Any: # noqa: ANN401 + def __getitem__(self, key: str) -> Any: """Return the item with the given key.""" try: return super().__getitem__(key) except KeyError: return super().__getitem__(self._stream_handler.to_index_case(key)) - def __setitem__(self, key: str, value: Any) -> None: # noqa: ANN401 + def __setitem__(self, key: str, value: Any) -> None: """Set the item with the given key to the given value.""" index_case_key = self._stream_handler.to_index_case(key) if ( diff --git a/airbyte/secrets/base.py b/airbyte/secrets/base.py index aa0ba911e..17c6bb5aa 100644 --- a/airbyte/secrets/base.py +++ b/airbyte/secrets/base.py @@ -35,7 +35,7 @@ def __str__(self) -> str: return self.value -class SecretString(str): # noqa: FURB189 # Allow subclass from str instead of UserStr +class SecretString(str): # Allow subclass from str instead of UserStr """A string that represents a secret. This class is used to mark a string as a secret. When a secret is printed, it @@ -104,7 +104,7 @@ def parse_json(self) -> dict: @classmethod def validate( cls, - v: Any, # noqa: ANN401 # Must allow `Any` to match Pydantic signature + v: Any, # Must allow `Any` to match Pydantic signature info: ValidationInfo, ) -> SecretString: """Validate the input value is valid as a secret string.""" @@ -116,9 +116,9 @@ def validate( return cls(v) @classmethod - def __get_pydantic_core_schema__( # noqa: PLW3201 # Pydantic dunder + def __get_pydantic_core_schema__( # Pydantic dunder cls, - source_type: Any, # noqa: ANN401 # Must allow `Any` to match Pydantic signature + source_type: Any, # Must allow `Any` to match Pydantic signature handler: GetCoreSchemaHandler, ) -> CoreSchema: """Return a modified core schema for the secret string.""" @@ -127,7 +127,7 @@ def __get_pydantic_core_schema__( # noqa: PLW3201 # Pydantic dunder ) @classmethod - def __get_pydantic_json_schema__( # noqa: PLW3201 # Pydantic dunder method + def __get_pydantic_json_schema__( # Pydantic dunder method cls, core_schema_: core_schema.CoreSchema, handler: GetJsonSchemaHandler ) -> JsonSchemaValue: """Return a modified JSON schema for the secret string. diff --git a/airbyte/secrets/google_colab.py b/airbyte/secrets/google_colab.py index 1f4ded0f6..dd3f111fe 100644 --- a/airbyte/secrets/google_colab.py +++ b/airbyte/secrets/google_colab.py @@ -14,7 +14,7 @@ class ColabSecretManager(SecretManager): def __init__(self) -> None: """Initialize the Google Colab secret manager.""" try: - from google.colab import ( # pyright: ignore[reportMissingImports] # noqa: PLC0415 + from google.colab import ( # pyright: ignore[reportMissingImports] userdata as colab_userdata, ) diff --git a/airbyte/shared/catalog_providers.py b/airbyte/shared/catalog_providers.py index 5c9c0a810..305439905 100644 --- a/airbyte/shared/catalog_providers.py +++ b/airbyte/shared/catalog_providers.py @@ -137,7 +137,7 @@ def from_read_result( return cls( ConfiguredAirbyteCatalog( streams=[ - dataset._stream_metadata # noqa: SLF001 # Non-public API + dataset._stream_metadata # Non-public API for dataset in read_result.values() ] ) diff --git a/airbyte/shared/sql_processor.py b/airbyte/shared/sql_processor.py index add3e6592..05f3c9514 100644 --- a/airbyte/shared/sql_processor.py +++ b/airbyte/shared/sql_processor.py @@ -400,7 +400,7 @@ def _finalize_state_messages( state_message=state_messages[-1], ) - def _setup(self) -> None: # noqa: B027 # Intentionally empty, not abstract + def _setup(self) -> None: # Intentionally empty, not abstract """Create the database. By default this is a no-op but subclasses can override this method to prepare @@ -408,7 +408,7 @@ def _setup(self) -> None: # noqa: B027 # Intentionally empty, not abstract """ pass - def _do_checkpoint( # noqa: B027 # Intentionally empty, not abstract + def _do_checkpoint( # Intentionally empty, not abstract self, connection: Connection | None = None, ) -> None: @@ -499,7 +499,7 @@ def process_record_message( # Protected members (non-public interface): - def _init_connection_settings(self, connection: Connection) -> None: # noqa: B027 # Intentionally empty, not abstract + def _init_connection_settings(self, connection: Connection) -> None: # Intentionally empty, not abstract """This is called automatically whenever a new connection is created. By default this is a no-op. Subclasses can use this to set connection settings, such as @@ -603,7 +603,7 @@ def _get_temp_table_name( # limiting the table name suffix to 10 characters, including the underscore. suffix = ( f"{batch_id[:6]}{batch_id[-3:]}" - if len(batch_id) > 9 # noqa: PLR2004 # Allow magic int value + if len(batch_id) > 9 # Allow magic int value else batch_id ) diff --git a/airbyte/sources/base.py b/airbyte/sources/base.py index 0a07950a6..67ccda88e 100644 --- a/airbyte/sources/base.py +++ b/airbyte/sources/base.py @@ -11,7 +11,7 @@ from typing import TYPE_CHECKING, Any, Literal import yaml -from rich import print # noqa: A004 # Allow shadowing the built-in +from rich import print # Allow shadowing the built-in from rich.console import Console from rich.markdown import Markdown from rich.markup import escape @@ -64,7 +64,7 @@ ) -class Source(ConnectorBase): # noqa: PLR0904 +class Source(ConnectorBase): """A class representing a source that can be called.""" connector_type = "source" @@ -797,7 +797,7 @@ def _read_with_catalog( ) for message in progress_tracker.tally_records_read(message_generator): if stop_event and stop_event.is_set(): - progress_tracker._log_sync_cancel() # noqa: SLF001 + progress_tracker._log_sync_cancel() time.sleep(0.1) return @@ -915,7 +915,7 @@ def read( progress_tracker.log_success() return result - def _read_to_cache( # noqa: PLR0913 # Too many arguments + def _read_to_cache( # Too many arguments self, cache: CacheBase, *, @@ -978,7 +978,7 @@ def _read_to_cache( # noqa: PLR0913 # Too many arguments progress_tracker=progress_tracker, ) ) - cache._write_airbyte_message_stream( # noqa: SLF001 # Non-public API + cache._write_airbyte_message_stream( # Non-public API stdin=airbyte_message_iterator, catalog_provider=catalog_provider, write_strategy=write_strategy, @@ -987,7 +987,7 @@ def _read_to_cache( # noqa: PLR0913 # Too many arguments ) # Flush the WAL, if applicable - cache.processor._do_checkpoint() # noqa: SLF001 # Non-public API + cache.processor._do_checkpoint() # Non-public API return ReadResult( source_name=self.name, diff --git a/airbyte/sources/util.py b/airbyte/sources/util.py index 42372ed03..fda3fef47 100644 --- a/airbyte/sources/util.py +++ b/airbyte/sources/util.py @@ -44,7 +44,7 @@ def get_connector( ) -def get_source( # noqa: PLR0913 # Too many arguments +def get_source( # Too many arguments name: str, config: dict[str, Any] | None = None, *, diff --git a/airbyte/types.py b/airbyte/types.py index 9ff8e997d..bf89d557a 100644 --- a/airbyte/types.py +++ b/airbyte/types.py @@ -1,4 +1,4 @@ -# noqa: A005 # Allow shadowing the built-in 'types' module +# Allow shadowing the built-in 'types' module # Copyright (c) 2023 Airbyte, Inc., all rights reserved. """Type conversion methods for SQL Caches.""" @@ -8,7 +8,7 @@ from typing import cast import sqlalchemy -from rich import print # noqa: A004 # Allow shadowing the built-in +from rich import print # Allow shadowing the built-in # Compare to documentation here: https://docs.airbyte.com/understanding-airbyte/supported-data-types @@ -34,7 +34,7 @@ class SQLTypeConversionError(Exception): """An exception to be raised when a type conversion fails.""" -def _get_airbyte_type( # noqa: PLR0911 # Too many return statements +def _get_airbyte_type( # Too many return statements json_schema_property_def: dict[str, str | dict | list], ) -> tuple[str, str | None]: """Get the airbyte type and subtype from a JSON schema property definition. @@ -121,7 +121,7 @@ def get_json_type(cls) -> sqlalchemy.types.TypeEngine: """Get the type to use for nested JSON data.""" return sqlalchemy.types.JSON() - def to_sql_type( # noqa: PLR0911 # Too many return statements + def to_sql_type( # Too many return statements self, json_schema_property_def: dict[str, str | dict | list], ) -> sqlalchemy.types.TypeEngine: diff --git a/airbyte/validate.py b/airbyte/validate.py index 4324edd2a..dd6f75546 100644 --- a/airbyte/validate.py +++ b/airbyte/validate.py @@ -15,7 +15,7 @@ from pathlib import Path import yaml -from rich import print # noqa: A004 # Allow shadowing the built-in +from rich import print # Allow shadowing the built-in import airbyte as ab from airbyte import exceptions as exc @@ -95,7 +95,7 @@ def install_only_test(connector_name: str) -> None: """Test that the connector can be installed and spec can be printed.""" print("Creating source and validating spec is returned successfully...") source = ab.get_source(connector_name) - source._get_spec(force_refresh=True) # noqa: SLF001 # Member is private until we have a public API for it. + source._get_spec(force_refresh=True) # Member is private until we have a public API for it. def run() -> None: diff --git a/docs/generate.py b/docs/generate.py index 8990ebfb3..37258b7a8 100755 --- a/docs/generate.py +++ b/docs/generate.py @@ -48,7 +48,7 @@ def _regenerate_mcp_markdown() -> None: spec = importlib.util.spec_from_file_location("_mcp_markdown_gen", script) if spec is None or spec.loader is None: msg = f"Could not load spec for {script}" - raise RuntimeError(msg) # noqa: TRY301 + raise RuntimeError(msg) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) print("[docs-generate] Regenerating docs/mcp-generated/ ...") diff --git a/examples/run_integ_test_source.py b/examples/run_integ_test_source.py index f0413ee2a..4f590bdfc 100644 --- a/examples/run_integ_test_source.py +++ b/examples/run_integ_test_source.py @@ -80,7 +80,7 @@ def main( if __name__ == "__main__": # Get first arg from CLI connector_name = sys.argv[1] - streams_csv = sys.argv[2] if len(sys.argv) > 2 else None # noqa: PLR2004 + streams_csv = sys.argv[2] if len(sys.argv) > 2 else None streams = None if streams_csv: streams = streams_csv.split(",") diff --git a/examples/run_perf_test_reads.py b/examples/run_perf_test_reads.py index 77b545354..1ed7c97b1 100644 --- a/examples/run_perf_test_reads.py +++ b/examples/run_perf_test_reads.py @@ -145,7 +145,7 @@ def get_cache( credentials_path=temp.name, ) - raise ValueError(f"Unknown cache type: {cache_type}") # noqa: TRY003 + raise ValueError(f"Unknown cache type: {cache_type}") def get_source( @@ -175,7 +175,7 @@ def get_source( }, ) - raise ValueError(f"Unknown source alias: {source_alias}") # noqa: TRY003 + raise ValueError(f"Unknown source alias: {source_alias}") def get_destination(destination_type: str) -> ab.Destination: @@ -196,7 +196,7 @@ def get_destination(destination_type: str) -> ab.Destination: docker_image=True, ) - raise ValueError(f"Unknown destination type: {destination_type}") # noqa: TRY003 + raise ValueError(f"Unknown destination type: {destination_type}") def main( diff --git a/scripts/generate_mcp_markdown.py b/scripts/generate_mcp_markdown.py index 78ba75127..3b46cb2bd 100755 --- a/scripts/generate_mcp_markdown.py +++ b/scripts/generate_mcp_markdown.py @@ -163,9 +163,9 @@ def _resolve_extra_module_map(server_spec: str) -> dict[str, str]: # Import private lists from fastmcp_extensions: these are the only # place `mcp_module` is recorded for prompts/resources, so we accept # the private-name coupling. - from fastmcp_extensions.decorators import ( # noqa: PLC0415 - _REGISTERED_PROMPTS, # noqa: PLC2701 - _REGISTERED_RESOURCES, # noqa: PLC2701 + from fastmcp_extensions.decorators import ( + _REGISTERED_PROMPTS, + _REGISTERED_RESOURCES, ) for _fn, ann in _REGISTERED_PROMPTS: @@ -243,7 +243,7 @@ def _frontmatter(title: str, sidebar_label: str, description: str) -> str: ) -def _json_block(label: str, obj: Any) -> str: # noqa: ANN401 +def _json_block(label: str, obj: Any) -> str: """Render an object inside a collapsible `
` JSON code block.""" return ( f"
\n{label}\n\n" diff --git a/tests/unit_tests/test_cloud_credentials.py b/tests/unit_tests/test_cloud_credentials.py index e3438f99a..f5e60d18b 100644 --- a/tests/unit_tests/test_cloud_credentials.py +++ b/tests/unit_tests/test_cloud_credentials.py @@ -445,7 +445,7 @@ class FailingClient: def get_organization(self, **_: object) -> object: pytest.fail("get_organization should not be called") - resolved_organization_id = mcp_cloud._resolve_organization_id( # noqa: SLF001 + resolved_organization_id = mcp_cloud._resolve_organization_id( organization_id="organization-id", organization_name=None, client=FailingClient(), @@ -471,7 +471,7 @@ def fake_get_organization_info(**_: object) -> dict[str, object]: monkeypatch.setattr(api_util, "get_organization_info", fake_get_organization_info) organization = CloudOrganization("organization-id", bearer_token="token") - assert organization._fetch_organization_info() == {"organizationName": "cached"} # noqa: SLF001 - assert organization._fetch_organization_info(force_refresh=True) == { # noqa: SLF001 + assert organization._fetch_organization_info() == {"organizationName": "cached"} + assert organization._fetch_organization_info(force_refresh=True) == { "organizationName": "cached" } diff --git a/tests/unit_tests/test_mcp_connector_registry.py b/tests/unit_tests/test_mcp_connector_registry.py index c09cba1cd..7459a7c71 100644 --- a/tests/unit_tests/test_mcp_connector_registry.py +++ b/tests/unit_tests/test_mcp_connector_registry.py @@ -499,7 +499,7 @@ def test_interactive_tools_include_prefab_metadata() -> None: interactive.register_interactive_tools(app) provider = getattr(app, "_local_provider") - tool = provider._components["tool:show_connectors_list@"] # noqa: SLF001 + tool = provider._components["tool:show_connectors_list@"] assert tool.meta is not None assert tool.meta["ui"]["resourceUri"] == "ui://prefab/renderer.html" From f131d664d3dd2dfb32573cf10f04354ecdb9a0b3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 04:17:48 +0000 Subject: [PATCH 3/4] Revert "style(lint): remove 134 unused noqa directives (RUF100 auto-fix)" This reverts commit e03b9ac1b8681707a14c24bb8d9e816026c649e7. --- airbyte/__init__.py | 4 ++-- airbyte/_connector_base.py | 2 +- airbyte/_executors/python.py | 2 +- airbyte/_executors/util.py | 6 ++--- airbyte/_message_iterators.py | 8 +++---- airbyte/_registry_utils.py | 4 ++-- airbyte/_util/api_util.py | 12 +++++----- airbyte/_util/destination_smoke_tests.py | 4 ++-- airbyte/_util/meta.py | 6 ++--- airbyte/_util/registry_spec.py | 2 +- airbyte/_util/temp_files.py | 2 +- airbyte/caches/_state_backend.py | 6 ++--- airbyte/caches/_utils/_dest_to_cache.py | 2 +- airbyte/caches/base.py | 16 +++++++------- airbyte/caches/util.py | 2 +- airbyte/cli/pyab.py | 2 +- airbyte/cli/smoke_test_source/source.py | 4 ++-- airbyte/cloud/connections.py | 4 ++-- airbyte/cloud/connectors.py | 10 ++++----- airbyte/cloud/sync_results.py | 4 ++-- airbyte/cloud/workspaces.py | 18 +++++++-------- airbyte/datasets/_sql.py | 2 +- airbyte/destinations/base.py | 6 ++--- airbyte/destinations/util.py | 2 +- airbyte/mcp/__init__.py | 2 +- airbyte/mcp/_arg_resolvers.py | 2 +- airbyte/mcp/_tool_utils.py | 6 ++--- airbyte/mcp/cloud.py | 10 ++++----- airbyte/mcp/interactive/__init__.py | 2 +- airbyte/mcp/interactive/_registry_ui.py | 2 +- airbyte/mcp/interactive/_sync_history_ui.py | 8 +++---- .../interactive/_workspace_sync_status_ui.py | 2 +- airbyte/mcp/local.py | 2 +- airbyte/mcp/server.py | 2 +- airbyte/progress.py | 22 +++++++++---------- airbyte/records.py | 4 ++-- airbyte/secrets/base.py | 10 ++++----- airbyte/secrets/google_colab.py | 2 +- airbyte/shared/catalog_providers.py | 2 +- airbyte/shared/sql_processor.py | 8 +++---- airbyte/sources/base.py | 12 +++++----- airbyte/sources/util.py | 2 +- airbyte/types.py | 8 +++---- airbyte/validate.py | 4 ++-- docs/generate.py | 2 +- examples/run_integ_test_source.py | 2 +- examples/run_perf_test_reads.py | 6 ++--- scripts/generate_mcp_markdown.py | 8 +++---- tests/unit_tests/test_cloud_credentials.py | 6 ++--- .../unit_tests/test_mcp_connector_registry.py | 2 +- 50 files changed, 134 insertions(+), 134 deletions(-) diff --git a/airbyte/__init__.py b/airbyte/__init__.py index 6d355011b..976c5a5f6 100644 --- a/airbyte/__init__.py +++ b/airbyte/__init__.py @@ -119,7 +119,7 @@ ---------------------- -""" +""" # noqa: D415 from __future__ import annotations @@ -152,7 +152,7 @@ datasets, destinations, documents, - exceptions, # No 'exc' alias for top-level module + exceptions, # noqa: ICN001 # No 'exc' alias for top-level module experimental, logs, mcp, diff --git a/airbyte/_connector_base.py b/airbyte/_connector_base.py index 745a41f68..0e8a66a40 100644 --- a/airbyte/_connector_base.py +++ b/airbyte/_connector_base.py @@ -246,7 +246,7 @@ def config_spec(self) -> dict[str, Any]: def print_config_spec( self, - format: Literal["yaml", "json"] = "yaml", + format: Literal["yaml", "json"] = "yaml", # noqa: A002 *, output_file: Path | str | None = None, stderr: bool = False, diff --git a/airbyte/_executors/python.py b/airbyte/_executors/python.py index ed1f776cb..57a5e0094 100644 --- a/airbyte/_executors/python.py +++ b/airbyte/_executors/python.py @@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Literal from overrides import overrides -from rich import print # Allow shadowing the built-in +from rich import print # noqa: A004 # Allow shadowing the built-in from airbyte import exceptions as exc from airbyte._executors.base import Executor diff --git a/airbyte/_executors/util.py b/airbyte/_executors/util.py index bf5a86d41..7a30a1bf1 100644 --- a/airbyte/_executors/util.py +++ b/airbyte/_executors/util.py @@ -11,7 +11,7 @@ import requests import yaml -from rich import print # Allow shadowing the built-in +from rich import print # noqa: A004 # Allow shadowing the built-in from airbyte import exceptions as exc from airbyte._executors.declarative import DeclarativeExecutor @@ -102,7 +102,7 @@ def _try_get_manifest_connector_files( headers={"User-Agent": f"PyAirbyte/{get_version()}"}, ) - if response.status_code == 404: + if response.status_code == 404: # noqa: PLR2004 return manifest_dict, None, None try: @@ -171,7 +171,7 @@ def _get_local_executor( ) -def get_connector_executor( # Too complex +def get_connector_executor( # noqa: PLR0912, PLR0913, PLR0914, PLR0915, C901 # Too complex name: str, *, version: str | None = None, diff --git a/airbyte/_message_iterators.py b/airbyte/_message_iterators.py index 186705798..e6efd5a11 100644 --- a/airbyte/_message_iterators.py +++ b/airbyte/_message_iterators.py @@ -141,7 +141,7 @@ def generator() -> Generator[AirbyteMessage, None, None]: yield AirbyteMessage.model_validate_json(next_line) except pydantic.ValidationError: # Handle JSON decoding errors (optional) - raise ValueError("Invalid JSON format") + raise ValueError("Invalid JSON format") # noqa: B904 return cls(generator()) @@ -156,7 +156,7 @@ def generator() -> Generator[AirbyteMessage, None, None]: yield AirbyteMessage.model_validate_json(line) except pydantic.ValidationError: # Handle JSON decoding errors (optional) - raise ValueError(f"Invalid JSON format in input string: {line}") + raise ValueError(f"Invalid JSON format in input string: {line}") # noqa: B904 return cls(generator()) @@ -186,7 +186,7 @@ def generator() -> Generator[AirbyteMessage, None, None]: break next_line: str = current_file_buffer.readline() - if next_line == "": # EOF produces an empty string + if next_line == "": # noqa: PLC1901 # EOF produces an empty string # Close the current file and open the next one current_file_buffer.close() current_file_buffer = None # Ensure the buffer is reset @@ -202,6 +202,6 @@ def generator() -> Generator[AirbyteMessage, None, None]: # Handle JSON decoding errors current_file_buffer.close() current_file_buffer = None - raise ValueError("Invalid JSON format") + raise ValueError("Invalid JSON format") # noqa: B904 return cls(generator()) diff --git a/airbyte/_registry_utils.py b/airbyte/_registry_utils.py index d0ade95a2..b98c9eafc 100644 --- a/airbyte/_registry_utils.py +++ b/airbyte/_registry_utils.py @@ -10,7 +10,7 @@ logger = logging.getLogger("airbyte.registry") -def parse_changelog_html( +def parse_changelog_html( # noqa: PLR0914 html_content: str, connector_name: str ) -> list[dict[str, str | list[str] | None]]: """Parse changelog HTML to extract version history. @@ -88,7 +88,7 @@ def fetch_registry_version_date(connector_name: str, version: str) -> str | None Returns the release date string (YYYY-MM-DD) if found, None otherwise. """ - try: + try: # noqa: PLR1702 registry_url = "https://connectors.airbyte.com/files/registries/v0/oss_registry.json" response = requests.get(registry_url, timeout=10) response.raise_for_status() diff --git a/airbyte/_util/api_util.py b/airbyte/_util/api_util.py index 5f48c83f8..e3f0a9eb5 100644 --- a/airbyte/_util/api_util.py +++ b/airbyte/_util/api_util.py @@ -55,7 +55,7 @@ def status_ok(status_code: int) -> bool: """Check if a status code is OK.""" - return status_code >= 200 and status_code < 300 # allow inline magic numbers + return status_code >= 200 and status_code < 300 # noqa: PLR2004 # allow inline magic numbers def _validate_pagination_params( @@ -843,7 +843,7 @@ def run_connection( # Get job info (logs) -def get_job_logs( # Too many arguments - needed for auth flexibility +def get_job_logs( # noqa: PLR0913 # Too many arguments - needed for auth flexibility workspace_id: str, connection_id: str, limit: int | None = 100, @@ -1503,7 +1503,7 @@ def build_connection_schedule( ) -def create_connection( # Too many arguments +def create_connection( # noqa: PLR0913 # Too many arguments name: str, *, source_id: str, @@ -1677,7 +1677,7 @@ def delete_connection( ) -def patch_connection( # Too many arguments +def patch_connection( # noqa: PLR0913 # Too many arguments connection_id: str, *, api_root: str, @@ -1895,7 +1895,7 @@ def check_connector( def validate_yaml_manifest( - manifest: Any, + manifest: Any, # noqa: ANN401 *, raise_on_error: bool = True, ) -> tuple[bool, str | None]: @@ -2262,7 +2262,7 @@ def get_connector_builder_project( ) -def update_connector_builder_project_testing_values( +def update_connector_builder_project_testing_values( # noqa: PLR0913 *, workspace_id: str, builder_project_id: str, diff --git a/airbyte/_util/destination_smoke_tests.py b/airbyte/_util/destination_smoke_tests.py index 1e6c621c2..8990d6021 100644 --- a/airbyte/_util/destination_smoke_tests.py +++ b/airbyte/_util/destination_smoke_tests.py @@ -29,7 +29,7 @@ from airbyte import get_source from airbyte.exceptions import PyAirbyteInputError -from airbyte.shared.sql_processor import TableStatistics # Pydantic needs at runtime +from airbyte.shared.sql_processor import TableStatistics # noqa: TC001 # Pydantic needs at runtime logger = logging.getLogger(__name__) @@ -451,7 +451,7 @@ def _run_preflight( return True, None -def run_destination_smoke_test( +def run_destination_smoke_test( # noqa: PLR0914 *, destination: Destination, scenarios: str | list[str] = "fast", diff --git a/airbyte/_util/meta.py b/airbyte/_util/meta.py index b3bd9925d..fa1c9e135 100644 --- a/airbyte/_util/meta.py +++ b/airbyte/_util/meta.py @@ -104,7 +104,7 @@ def is_jupyter() -> bool: Will return False in Colab (use is_colab() instead). """ try: - shell = get_ipython().__class__.__name__ # type: ignore + shell = get_ipython().__class__.__name__ # type: ignore # noqa: PGH003 except NameError: return False # If 'get_ipython' undefined, we're probably in a standard Python interpreter. @@ -123,7 +123,7 @@ def get_notebook_name() -> str | None: session_info: dict | None = None with suppress(Exception): response = requests.get(COLAB_SESSION_URL) - if response.status_code == 200: # Magic number + if response.status_code == 200: # noqa: PLR2004 # Magic number session_info = response.json()[0] if session_info and "name" in session_info: @@ -135,7 +135,7 @@ def get_notebook_name() -> str | None: @lru_cache def get_vscode_notebook_name() -> str | None: with suppress(Exception): - import IPython # pyrefly: ignore[missing-import] + import IPython # noqa: PLC0415 # pyrefly: ignore[missing-import] return Path( IPython.extract_module_locals()[1]["__vsc_ipynb_file__"], diff --git a/airbyte/_util/registry_spec.py b/airbyte/_util/registry_spec.py index c253e730f..ec43b2c14 100644 --- a/airbyte/_util/registry_spec.py +++ b/airbyte/_util/registry_spec.py @@ -76,7 +76,7 @@ def get_connector_spec_from_registry( f"Spec for connector '{connector_name}' (version {version}, platform {platform}) " f"does not contain 'spec.connectionSpecification'." ) - return None + return None # noqa: TRY300 except requests.exceptions.Timeout: logger.warning( diff --git a/airbyte/_util/temp_files.py b/airbyte/_util/temp_files.py index 7bd888824..ce2a65cf4 100644 --- a/airbyte/_util/temp_files.py +++ b/airbyte/_util/temp_files.py @@ -26,7 +26,7 @@ def as_temp_files(files_contents: list[dict | str]) -> Generator[list[str], Any, try: for content in files_contents: use_json = isinstance(content, dict) - temp_file = tempfile.NamedTemporaryFile( # Avoiding context manager + temp_file = tempfile.NamedTemporaryFile( # noqa: SIM115 # Avoiding context manager mode="w+t", delete=False, encoding="utf-8", diff --git a/airbyte/caches/_state_backend.py b/airbyte/caches/_state_backend.py index bff87437b..c61833d78 100644 --- a/airbyte/caches/_state_backend.py +++ b/airbyte/caches/_state_backend.py @@ -136,9 +136,9 @@ def _write_state( context={"state_message": state_message}, ) - self._state_backend._ensure_internal_tables() # Non-public member access - table_prefix = self._state_backend._table_prefix - engine = self._state_backend._sql_config.get_sql_engine() + self._state_backend._ensure_internal_tables() # noqa: SLF001 # Non-public member access + table_prefix = self._state_backend._table_prefix # noqa: SLF001 + engine = self._state_backend._sql_config.get_sql_engine() # noqa: SLF001 # Calculate the new state model to write. new_state = ( diff --git a/airbyte/caches/_utils/_dest_to_cache.py b/airbyte/caches/_utils/_dest_to_cache.py index 8c6abe110..a5b4700dc 100644 --- a/airbyte/caches/_utils/_dest_to_cache.py +++ b/airbyte/caches/_utils/_dest_to_cache.py @@ -167,7 +167,7 @@ def duckdb_destination_to_cache( # actually live at `/destination-duckdb/foo.duckdb` on the # host. Resolve the host-side path so the cache can open the file. if db_path.startswith(("/local/", "/local\\")): - from airbyte.constants import DEFAULT_PROJECT_DIR + from airbyte.constants import DEFAULT_PROJECT_DIR # noqa: PLC0415 host_path = str(DEFAULT_PROJECT_DIR / "destination-duckdb" / db_path[len("/local/") :]) db_path = host_path diff --git a/airbyte/caches/base.py b/airbyte/caches/base.py index 313e0ca8e..2683577d4 100644 --- a/airbyte/caches/base.py +++ b/airbyte/caches/base.py @@ -42,7 +42,7 @@ from airbyte.strategies import WriteStrategy -class CacheBase(SqlConfig, AirbyteWriterInterface): +class CacheBase(SqlConfig, AirbyteWriterInterface): # noqa: PLR0904 """Base configuration for a cache. Caches inherit from the matching `SqlConfig` class, which provides the SQL config settings @@ -71,14 +71,14 @@ class CacheBase(SqlConfig, AirbyteWriterInterface): paired_destination_config_class: ClassVar[type | None] = None @property - def paired_destination_config(self) -> Any | dict[str, Any]: # Allow Any return type + def paired_destination_config(self) -> Any | dict[str, Any]: # noqa: ANN401 # Allow Any return type """Return a dictionary of destination configuration values.""" raise NotImplementedError( f"The type '{type(self).__name__}' does not define an equivalent destination " "configuration." ) - def __init__(self, **data: Any) -> None: + def __init__(self, **data: Any) -> None: # noqa: ANN401 """Initialize the cache and backends.""" super().__init__(**data) @@ -90,7 +90,7 @@ def __init__(self, **data: Any) -> None: temp_dir=self.cache_dir, temp_file_cleanup=self.cleanup, ) - temp_processor._ensure_schema_exists() # Accessing non-public member + temp_processor._ensure_schema_exists() # noqa: SLF001 # Accessing non-public member # Initialize the catalog and state backends self._catalog_backend = SqlCatalogBackend( @@ -129,10 +129,10 @@ def close(self) -> None: self._read_processor.sql_config.dispose_engine() if self._catalog_backend is not None: - self._catalog_backend._sql_config.dispose_engine() + self._catalog_backend._sql_config.dispose_engine() # noqa: SLF001 if self._state_backend is not None: - self._state_backend._sql_config.dispose_engine() + self._state_backend._sql_config.dispose_engine() # noqa: SLF001 self.dispose_engine() @@ -416,11 +416,11 @@ def create_source_tables( ) # Ensure schema exists - self.processor._ensure_schema_exists() # Accessing non-public member + self.processor._ensure_schema_exists() # noqa: SLF001 # Accessing non-public member # Create tables for each stream if they don't exist for stream_name in catalog_provider.stream_names: - self.processor._ensure_final_table_exists( + self.processor._ensure_final_table_exists( # noqa: SLF001 stream_name=stream_name, create_if_missing=True, ) diff --git a/airbyte/caches/util.py b/airbyte/caches/util.py index 55c1b045a..79b820137 100644 --- a/airbyte/caches/util.py +++ b/airbyte/caches/util.py @@ -137,7 +137,7 @@ def get_colab_cache( ``` """ try: - from google.colab import drive # type: ignore[reportMissingImports] + from google.colab import drive # noqa: PLC0415 # type: ignore[reportMissingImports] except ImportError: drive = None msg = ( diff --git a/airbyte/cli/pyab.py b/airbyte/cli/pyab.py index 0c4f9e4c3..04173d39d 100644 --- a/airbyte/cli/pyab.py +++ b/airbyte/cli/pyab.py @@ -630,7 +630,7 @@ def sync( @cli.command(name="destination-smoke-test") -def destination_smoke_test( +def destination_smoke_test( # noqa: PLR0913 *, destination: Annotated[ str, diff --git a/airbyte/cli/smoke_test_source/source.py b/airbyte/cli/smoke_test_source/source.py index 6d981d159..46abc56a8 100644 --- a/airbyte/cli/smoke_test_source/source.py +++ b/airbyte/cli/smoke_test_source/source.py @@ -80,7 +80,7 @@ class SourceSmokeTest(Source): def spec( self, - logger: logging.Logger, + logger: logging.Logger, # noqa: ARG002 ) -> ConnectorSpecification: """Return the connector specification.""" return ConnectorSpecification( @@ -364,7 +364,7 @@ def read( logger: logging.Logger, config: Mapping[str, Any], catalog: ConfiguredAirbyteCatalog, - state: list[Any] | None = None, + state: list[Any] | None = None, # noqa: ARG002 ) -> Iterable[AirbyteMessage]: """Read records from selected smoke test streams.""" selected_streams = {stream.stream.name for stream in catalog.streams} diff --git a/airbyte/cloud/connections.py b/airbyte/cloud/connections.py index 9ff8fd15d..528b91de9 100644 --- a/airbyte/cloud/connections.py +++ b/airbyte/cloud/connections.py @@ -40,7 +40,7 @@ from airbyte.cloud.workspaces import CloudWorkspace -class CloudConnection: # Too many public methods +class CloudConnection: # noqa: PLR0904 # Too many public methods """A connection is an extract-load (EL) pairing of a source and destination in Airbyte Cloud. You can use a connection object to run sync jobs, retrieve logs, and manage the connection. @@ -180,7 +180,7 @@ def _from_connection_response( source=connection_info.source_id, destination=connection_info.destination_id, ) - result._connection_info = connection_info # Accessing Non-Public API + result._connection_info = connection_info # noqa: SLF001 # Accessing Non-Public API return result # Properties diff --git a/airbyte/cloud/connectors.py b/airbyte/cloud/connectors.py index 3cd5292e7..622e57ac9 100644 --- a/airbyte/cloud/connectors.py +++ b/airbyte/cloud/connectors.py @@ -267,7 +267,7 @@ def _from_source_response( workspace=workspace, connector_id=source_info.source_id, ) - result._connector_info = source_info # Accessing Non-Public API + result._connector_info = source_info # noqa: SLF001 # Accessing Non-Public API return result @@ -355,7 +355,7 @@ def _from_destination_response( workspace=workspace, connector_id=destination_info.destination_id, ) - result._connector_info = destination_info # Accessing Non-Public API + result._connector_info = destination_info # noqa: SLF001 # Accessing Non-Public API return result @@ -723,7 +723,7 @@ def update_definition( def rename( self, - new_name: str, + new_name: str, # noqa: ARG002 ) -> CustomCloudSourceDefinition: """Rename this custom source definition. @@ -771,7 +771,7 @@ def _from_yaml_response( definition_id=definition_info.definition_id, definition_type="yaml", ) - result._definition_info = definition_info + result._definition_info = definition_info # noqa: SLF001 return result def deploy_source( @@ -822,7 +822,7 @@ def deploy_source( client_secret=self.workspace.client_secret, bearer_token=self.workspace.bearer_token, ) - return CloudSource._from_source_response( # Accessing Non-Public API + return CloudSource._from_source_response( # noqa: SLF001 # Accessing Non-Public API workspace=self.workspace, source_response=result, ) diff --git a/airbyte/cloud/sync_results.py b/airbyte/cloud/sync_results.py index 612991a46..e2a88729d 100644 --- a/airbyte/cloud/sync_results.py +++ b/airbyte/cloud/sync_results.py @@ -314,7 +314,7 @@ def start_time(self) -> datetime: return ab_datetime_parse(self._fetch_latest_job_info().start_time) except (ValueError, TypeError) as e: if "Invalid isoformat string" in str(e): - job_info_raw = api_util._make_config_api_request( + job_info_raw = api_util._make_config_api_request( # noqa: SLF001 api_root=self.workspace.api_root, config_api_root=self.workspace.config_api_root, path="/jobs/get", @@ -333,7 +333,7 @@ def _fetch_job_with_attempts(self) -> dict[str, Any]: if self._job_with_attempts_info is not None: return self._job_with_attempts_info - self._job_with_attempts_info = api_util._make_config_api_request( # Config API helper + self._job_with_attempts_info = api_util._make_config_api_request( # noqa: SLF001 # Config API helper api_root=self.workspace.api_root, config_api_root=self.workspace.config_api_root, path="/jobs/get", diff --git a/airbyte/cloud/workspaces.py b/airbyte/cloud/workspaces.py index 8e545ac70..58f5539e7 100644 --- a/airbyte/cloud/workspaces.py +++ b/airbyte/cloud/workspaces.py @@ -66,7 +66,7 @@ from airbyte.sources.base import Source -@dataclass(init=False, kw_only=True) # Core cloud API facade. +@dataclass(init=False, kw_only=True) # noqa: PLR0904 # Core cloud API facade. class CloudWorkspace: """A remote workspace on the Airbyte Cloud. @@ -384,7 +384,7 @@ def deploy_source( are not allowed. Defaults to `True`. random_name_suffix: Whether to append a random suffix to the name. """ - source_config_dict = source._hydrated_config.copy() + source_config_dict = source._hydrated_config.copy() # noqa: SLF001 (non-public API) source_config_dict["sourceType"] = source.name.replace("source-", "") if random_name_suffix: @@ -433,7 +433,7 @@ def deploy_destination( random_name_suffix: Whether to append a random suffix to the name. """ if isinstance(destination, Destination): - destination_conf_dict = destination._hydrated_config.copy() + destination_conf_dict = destination._hydrated_config.copy() # noqa: SLF001 (non-public API) destination_conf_dict["destinationType"] = destination.name.replace("destination-", "") # raise ValueError(destination_conf_dict) else: @@ -719,7 +719,7 @@ def list_connections( bearer_token=self.bearer_token, ) return [ - CloudConnection._from_connection_response( + CloudConnection._from_connection_response( # noqa: SLF001 (non-public API) workspace=self, connection_response=connection, ) @@ -745,7 +745,7 @@ def list_sources( bearer_token=self.bearer_token, ) return [ - CloudSource._from_source_response( + CloudSource._from_source_response( # noqa: SLF001 (non-public API) workspace=self, source_response=source, ) @@ -771,7 +771,7 @@ def list_destinations( bearer_token=self.bearer_token, ) return [ - CloudDestination._from_destination_response( + CloudDestination._from_destination_response( # noqa: SLF001 (non-public API) workspace=self, destination_response=destination, ) @@ -870,7 +870,7 @@ def publish_custom_source_definition( client_secret=self.client_secret, bearer_token=self.bearer_token, ) - custom_definition = CustomCloudSourceDefinition._from_yaml_response( + custom_definition = CustomCloudSourceDefinition._from_yaml_response( # noqa: SLF001 self, result ) @@ -907,7 +907,7 @@ def list_custom_source_definitions( bearer_token=self.bearer_token, ) return [ - CustomCloudSourceDefinition._from_yaml_response(self, d) + CustomCloudSourceDefinition._from_yaml_response(self, d) # noqa: SLF001 for d in yaml_definitions ] @@ -940,7 +940,7 @@ def get_custom_source_definition( client_secret=self.client_secret, bearer_token=self.bearer_token, ) - return CustomCloudSourceDefinition._from_yaml_response(self, result) + return CustomCloudSourceDefinition._from_yaml_response(self, result) # noqa: SLF001 raise NotImplementedError( "Docker custom source definitions are not yet supported. " diff --git a/airbyte/datasets/_sql.py b/airbyte/datasets/_sql.py index a3a589fcb..c2065c800 100644 --- a/airbyte/datasets/_sql.py +++ b/airbyte/datasets/_sql.py @@ -91,7 +91,7 @@ def __iter__(self) -> Iterator[dict[str, Any]]: for row in conn.execute(self._query_statement): # Access to private member required because SQLAlchemy doesn't expose a public API. # https://pydoc.dev/sqlalchemy/latest/sqlalchemy.engine.row.RowMapping.html - yield cast("dict[str, Any]", row._mapping) + yield cast("dict[str, Any]", row._mapping) # noqa: SLF001 def __len__(self) -> int: """Return the number of records in the dataset. diff --git a/airbyte/destinations/base.py b/airbyte/destinations/base.py index 67fa6e456..0c540ffd7 100644 --- a/airbyte/destinations/base.py +++ b/airbyte/destinations/base.py @@ -122,7 +122,7 @@ def get_sql_cache( return destination_to_cache(config, schema_name=schema_name) - def write( # Too many arguments/statements + def write( # noqa: PLR0912, PLR0915 # Too many arguments/statements self, source_data: Source | ReadResult, *, @@ -254,7 +254,7 @@ def write( # Too many arguments/statements if source: if cache is False: # Get message iterator for source (caching disabled) - message_iterator: AirbyteMessageIterator = source._get_airbyte_message_iterator( # Non-public API + message_iterator: AirbyteMessageIterator = source._get_airbyte_message_iterator( # noqa: SLF001 # Non-public API streams=streams, state_provider=source_state_provider, progress_tracker=progress_tracker, @@ -263,7 +263,7 @@ def write( # Too many arguments/statements else: # Caching enabled and we are reading from a source. # Read the data to cache if caching is enabled. - read_result = source._read_to_cache( # Non-public API + read_result = source._read_to_cache( # noqa: SLF001 # Non-public API cache=cache, state_provider=source_state_provider, state_writer=cache_state_writer, diff --git a/airbyte/destinations/util.py b/airbyte/destinations/util.py index 63de3d77c..216c05659 100644 --- a/airbyte/destinations/util.py +++ b/airbyte/destinations/util.py @@ -18,7 +18,7 @@ from airbyte.callbacks import ConfigChangeCallback -def get_destination( # Too many arguments +def get_destination( # noqa: PLR0913 # Too many arguments name: str, config: dict[str, Any] | None = None, *, diff --git a/airbyte/mcp/__init__.py b/airbyte/mcp/__init__.py index 9134c38cd..0361e43fd 100644 --- a/airbyte/mcp/__init__.py +++ b/airbyte/mcp/__init__.py @@ -208,7 +208,7 @@ - [PyAirbyte GitHub Issues](https://github.com/airbytehq/pyairbyte/issues) - [PyAirbyte Discussions](https://github.com/airbytehq/pyairbyte/discussions) -""" +""" # noqa: D415 from airbyte.mcp import cloud, local, registry, server diff --git a/airbyte/mcp/_arg_resolvers.py b/airbyte/mcp/_arg_resolvers.py index bba6ce455..cb4f8df5c 100644 --- a/airbyte/mcp/_arg_resolvers.py +++ b/airbyte/mcp/_arg_resolvers.py @@ -73,7 +73,7 @@ def resolve_list_of_strings(value: str | list[str] | set[str] | None) -> list[st return [item.strip() for item in value.split(",") if item.strip()] -def resolve_connector_config( +def resolve_connector_config( # noqa: PLR0912 config: dict | str | None = None, config_file: str | Path | None = None, config_secret_name: str | None = None, diff --git a/airbyte/mcp/_tool_utils.py b/airbyte/mcp/_tool_utils.py index 360f21622..bead0fdca 100644 --- a/airbyte/mcp/_tool_utils.py +++ b/airbyte/mcp/_tool_utils.py @@ -20,10 +20,10 @@ from fastmcp_extensions import MCPServerConfigArg, get_mcp_config from fastmcp_extensions import mcp_tool as _mcp_tool from fastmcp_extensions.decorators import ( - _REGISTERED_PROVIDERS, - _REGISTERED_TOOLS, + _REGISTERED_PROVIDERS, # noqa: PLC2701 + _REGISTERED_TOOLS, # noqa: PLC2701 ) -from fastmcp_extensions.registration import _ProviderToolAnnotations +from fastmcp_extensions.registration import _ProviderToolAnnotations # noqa: PLC2701 from fastmcp_extensions.tool_filters import ( ANNOTATION_MCP_MODULE, ANNOTATION_READ_ONLY_HINT, diff --git a/airbyte/mcp/cloud.py b/airbyte/mcp/cloud.py index 554e7d667..0beab1b41 100644 --- a/airbyte/mcp/cloud.py +++ b/airbyte/mcp/cloud.py @@ -936,7 +936,7 @@ def describe_cloud_source( source_id=source.source_id, source_name=source_name, source_url=source.connector_url, - connector_definition_id=source._connector_info.definition_id, # type: ignore[union-attr] + connector_definition_id=source._connector_info.definition_id, # noqa: SLF001 # type: ignore[union-attr] ) @@ -972,7 +972,7 @@ def describe_cloud_destination( destination_id=destination.destination_id, destination_name=destination_name, destination_url=destination.connector_url, - connector_definition_id=destination._connector_info.definition_id, # type: ignore[union-attr] + connector_definition_id=destination._connector_info.definition_id, # noqa: SLF001 # type: ignore[union-attr] ) @@ -2527,10 +2527,10 @@ def _add_defaults_for_exclude_args( Args: exclude_args: List of argument names that will be excluded from the tool schema. """ - import inspect # Local import for optional patching logic + import inspect # noqa: PLC0415 # Local import for optional patching logic - from fastmcp_extensions.decorators import ( - _REGISTERED_TOOLS, + from fastmcp_extensions.decorators import ( # noqa: PLC0415 + _REGISTERED_TOOLS, # noqa: PLC2701 ) for func, _annotations in _REGISTERED_TOOLS: diff --git a/airbyte/mcp/interactive/__init__.py b/airbyte/mcp/interactive/__init__.py index e27b838c6..a65f4f403 100644 --- a/airbyte/mcp/interactive/__init__.py +++ b/airbyte/mcp/interactive/__init__.py @@ -6,7 +6,7 @@ from typing import TYPE_CHECKING from airbyte.mcp._tool_utils import register_mcp_tools -from airbyte.mcp.interactive import _prefab as _prefab_module +from airbyte.mcp.interactive import _prefab as _prefab_module # noqa: F401 from airbyte.mcp.interactive._registry_ui import show_connectors_list from airbyte.mcp.interactive._sync_history_ui import show_connection_sync_history from airbyte.mcp.interactive._workspace_sync_status_ui import show_workspace_sync_status diff --git a/airbyte/mcp/interactive/_registry_ui.py b/airbyte/mcp/interactive/_registry_ui.py index 51b8131b9..54969e95f 100644 --- a/airbyte/mcp/interactive/_registry_ui.py +++ b/airbyte/mcp/interactive/_registry_ui.py @@ -96,7 +96,7 @@ def show_connectors_list( ), ), ] = "", - certified: Annotated[ + certified: Annotated[ # noqa: FBT002 - FastMCP tool parameter. bool, Field( description=( diff --git a/airbyte/mcp/interactive/_sync_history_ui.py b/airbyte/mcp/interactive/_sync_history_ui.py index 99f849736..72ba03467 100644 --- a/airbyte/mcp/interactive/_sync_history_ui.py +++ b/airbyte/mcp/interactive/_sync_history_ui.py @@ -6,7 +6,7 @@ import json from typing import TYPE_CHECKING, Annotated, Literal -from fastmcp import Context +from fastmcp import Context # noqa: TC002 - required at runtime for FastMCP tool registration from fastmcp.apps import PrefabAppConfig from fastmcp.tools.base import ToolResult from prefab_ui.app import PrefabApp @@ -82,7 +82,7 @@ def _time_label(dt: datetime, *, include_date: bool = False) -> str: app=PrefabAppConfig(), extra_help_text=CLOUD_AUTH_TIP_TEXT, ) -def show_connection_sync_history( +def show_connection_sync_history( # noqa: PLR0914 ctx: Context, connection_id: Annotated[ str, @@ -219,7 +219,7 @@ def show_connection_sync_history( ) -def _build_agent_text( +def _build_agent_text( # noqa: PLR0913 *, agent_context: Literal["verbose", "summary", "min"], connection_id: str, @@ -281,7 +281,7 @@ def _build_agent_text( return f"{header}\n\n{summary}{detail}" -def _build_sync_history_app( +def _build_sync_history_app( # noqa: PLR0913 *, connection_name: str, job_history_url: str, diff --git a/airbyte/mcp/interactive/_workspace_sync_status_ui.py b/airbyte/mcp/interactive/_workspace_sync_status_ui.py index 393cf4cb1..77d7ca451 100644 --- a/airbyte/mcp/interactive/_workspace_sync_status_ui.py +++ b/airbyte/mcp/interactive/_workspace_sync_status_ui.py @@ -9,7 +9,7 @@ from enum import Enum from typing import TYPE_CHECKING, Annotated, Literal -from fastmcp import Context +from fastmcp import Context # noqa: TC002 - required at runtime for FastMCP tool registration from fastmcp.apps import PrefabAppConfig from fastmcp.tools.base import ToolResult from prefab_ui.actions import OpenLink, SendMessage, SetState diff --git a/airbyte/mcp/local.py b/airbyte/mcp/local.py index 4504a1cd4..0e6fab984 100644 --- a/airbyte/mcp/local.py +++ b/airbyte/mcp/local.py @@ -833,7 +833,7 @@ def run_sql_query( destructive=True, requires_client_filesystem=True, ) -def destination_smoke_test( +def destination_smoke_test( # noqa: PLR0913, PLR0917 destination_connector_name: Annotated[ str, Field( diff --git a/airbyte/mcp/server.py b/airbyte/mcp/server.py index fc28de379..abe661095 100644 --- a/airbyte/mcp/server.py +++ b/airbyte/mcp/server.py @@ -164,7 +164,7 @@ def _create_oidc_auth() -> OIDCProxy | None: @app.custom_route("/health", methods=["GET"]) -async def health_check(request: Request) -> JSONResponse: +async def health_check(request: Request) -> JSONResponse: # noqa: ARG001, RUF029 """Health check endpoint for load balancer probes.""" return JSONResponse({"status": "ok"}) diff --git a/airbyte/progress.py b/airbyte/progress.py index 92a404268..ad984f8a3 100644 --- a/airbyte/progress.py +++ b/airbyte/progress.py @@ -127,15 +127,15 @@ def _get_elapsed_time_str(seconds: float) -> str: Minutes are always included after 1 minute elapsed. Hours are always included after 1 hour elapsed. """ - if seconds <= 2: # Magic numbers OK here. + if seconds <= 2: # noqa: PLR2004 # Magic numbers OK here. # Less than 1 minute elapsed return f"{seconds:.2f} seconds" - if seconds < 10: # Magic numbers OK here. + if seconds < 10: # noqa: PLR2004 # Magic numbers OK here. # Less than 10 seconds elapsed return f"{seconds:.1f} seconds" - if seconds <= 60: # Magic numbers OK here. + if seconds <= 60: # noqa: PLR2004 # Magic numbers OK here. # Less than 1 minute elapsed return f"{seconds:.0f} seconds" @@ -157,7 +157,7 @@ def _get_elapsed_time_str(seconds: float) -> str: return f"{hours}hr {minutes}min" -class ProgressTracker: # Too many public methods +class ProgressTracker: # noqa: PLR0904 # Too many public methods """A simple progress bar for the command line and IPython notebooks.""" def __init__( @@ -406,10 +406,10 @@ def _send_telemetry( A thin wrapper around `send_telemetry` that includes the job description. """ send_telemetry( - source=self._source._get_connector_runtime_info() if self._source else None, - cache=self._cache._get_writer_runtime_info() if self._cache else None, + source=self._source._get_connector_runtime_info() if self._source else None, # noqa: SLF001 + cache=self._cache._get_writer_runtime_info() if self._cache else None, # noqa: SLF001 destination=( - self._destination._get_connector_runtime_info() + self._destination._get_connector_runtime_info() # noqa: SLF001 if self._destination else None ), @@ -470,13 +470,13 @@ def _job_info(self) -> dict[str, Any]: "description": self.job_description, } if self._source: - job_info["source"] = self._source._get_connector_runtime_info().to_dict() + job_info["source"] = self._source._get_connector_runtime_info().to_dict() # noqa: SLF001 if self._cache: - job_info["cache"] = self._cache._get_writer_runtime_info().to_dict() + job_info["cache"] = self._cache._get_writer_runtime_info().to_dict() # noqa: SLF001 if self._destination: - job_info["destination"] = self._destination._get_connector_runtime_info().to_dict() + job_info["destination"] = self._destination._get_connector_runtime_info().to_dict() # noqa: SLF001 return job_info @@ -844,7 +844,7 @@ def _update_display(self, *, force_refresh: bool = False) -> None: if ( not force_refresh and self._last_update_time # if not set, then we definitely need to update - and cast("float", self.elapsed_seconds_since_last_update) < 0.8 + and cast("float", self.elapsed_seconds_since_last_update) < 0.8 # noqa: PLR2004 ): return diff --git a/airbyte/records.py b/airbyte/records.py index 664531278..e28109088 100644 --- a/airbyte/records.py +++ b/airbyte/records.py @@ -256,14 +256,14 @@ def from_record_message( extracted_at=datetime.fromtimestamp(record_message.emitted_at / 1000, tz=timezone.utc), ) - def __getitem__(self, key: str) -> Any: + def __getitem__(self, key: str) -> Any: # noqa: ANN401 """Return the item with the given key.""" try: return super().__getitem__(key) except KeyError: return super().__getitem__(self._stream_handler.to_index_case(key)) - def __setitem__(self, key: str, value: Any) -> None: + def __setitem__(self, key: str, value: Any) -> None: # noqa: ANN401 """Set the item with the given key to the given value.""" index_case_key = self._stream_handler.to_index_case(key) if ( diff --git a/airbyte/secrets/base.py b/airbyte/secrets/base.py index 17c6bb5aa..aa0ba911e 100644 --- a/airbyte/secrets/base.py +++ b/airbyte/secrets/base.py @@ -35,7 +35,7 @@ def __str__(self) -> str: return self.value -class SecretString(str): # Allow subclass from str instead of UserStr +class SecretString(str): # noqa: FURB189 # Allow subclass from str instead of UserStr """A string that represents a secret. This class is used to mark a string as a secret. When a secret is printed, it @@ -104,7 +104,7 @@ def parse_json(self) -> dict: @classmethod def validate( cls, - v: Any, # Must allow `Any` to match Pydantic signature + v: Any, # noqa: ANN401 # Must allow `Any` to match Pydantic signature info: ValidationInfo, ) -> SecretString: """Validate the input value is valid as a secret string.""" @@ -116,9 +116,9 @@ def validate( return cls(v) @classmethod - def __get_pydantic_core_schema__( # Pydantic dunder + def __get_pydantic_core_schema__( # noqa: PLW3201 # Pydantic dunder cls, - source_type: Any, # Must allow `Any` to match Pydantic signature + source_type: Any, # noqa: ANN401 # Must allow `Any` to match Pydantic signature handler: GetCoreSchemaHandler, ) -> CoreSchema: """Return a modified core schema for the secret string.""" @@ -127,7 +127,7 @@ def __get_pydantic_core_schema__( # Pydantic dunder ) @classmethod - def __get_pydantic_json_schema__( # Pydantic dunder method + def __get_pydantic_json_schema__( # noqa: PLW3201 # Pydantic dunder method cls, core_schema_: core_schema.CoreSchema, handler: GetJsonSchemaHandler ) -> JsonSchemaValue: """Return a modified JSON schema for the secret string. diff --git a/airbyte/secrets/google_colab.py b/airbyte/secrets/google_colab.py index dd3f111fe..1f4ded0f6 100644 --- a/airbyte/secrets/google_colab.py +++ b/airbyte/secrets/google_colab.py @@ -14,7 +14,7 @@ class ColabSecretManager(SecretManager): def __init__(self) -> None: """Initialize the Google Colab secret manager.""" try: - from google.colab import ( # pyright: ignore[reportMissingImports] + from google.colab import ( # pyright: ignore[reportMissingImports] # noqa: PLC0415 userdata as colab_userdata, ) diff --git a/airbyte/shared/catalog_providers.py b/airbyte/shared/catalog_providers.py index 305439905..5c9c0a810 100644 --- a/airbyte/shared/catalog_providers.py +++ b/airbyte/shared/catalog_providers.py @@ -137,7 +137,7 @@ def from_read_result( return cls( ConfiguredAirbyteCatalog( streams=[ - dataset._stream_metadata # Non-public API + dataset._stream_metadata # noqa: SLF001 # Non-public API for dataset in read_result.values() ] ) diff --git a/airbyte/shared/sql_processor.py b/airbyte/shared/sql_processor.py index 05f3c9514..add3e6592 100644 --- a/airbyte/shared/sql_processor.py +++ b/airbyte/shared/sql_processor.py @@ -400,7 +400,7 @@ def _finalize_state_messages( state_message=state_messages[-1], ) - def _setup(self) -> None: # Intentionally empty, not abstract + def _setup(self) -> None: # noqa: B027 # Intentionally empty, not abstract """Create the database. By default this is a no-op but subclasses can override this method to prepare @@ -408,7 +408,7 @@ def _setup(self) -> None: # Intentionally empty, not abstract """ pass - def _do_checkpoint( # Intentionally empty, not abstract + def _do_checkpoint( # noqa: B027 # Intentionally empty, not abstract self, connection: Connection | None = None, ) -> None: @@ -499,7 +499,7 @@ def process_record_message( # Protected members (non-public interface): - def _init_connection_settings(self, connection: Connection) -> None: # Intentionally empty, not abstract + def _init_connection_settings(self, connection: Connection) -> None: # noqa: B027 # Intentionally empty, not abstract """This is called automatically whenever a new connection is created. By default this is a no-op. Subclasses can use this to set connection settings, such as @@ -603,7 +603,7 @@ def _get_temp_table_name( # limiting the table name suffix to 10 characters, including the underscore. suffix = ( f"{batch_id[:6]}{batch_id[-3:]}" - if len(batch_id) > 9 # Allow magic int value + if len(batch_id) > 9 # noqa: PLR2004 # Allow magic int value else batch_id ) diff --git a/airbyte/sources/base.py b/airbyte/sources/base.py index 67ccda88e..0a07950a6 100644 --- a/airbyte/sources/base.py +++ b/airbyte/sources/base.py @@ -11,7 +11,7 @@ from typing import TYPE_CHECKING, Any, Literal import yaml -from rich import print # Allow shadowing the built-in +from rich import print # noqa: A004 # Allow shadowing the built-in from rich.console import Console from rich.markdown import Markdown from rich.markup import escape @@ -64,7 +64,7 @@ ) -class Source(ConnectorBase): +class Source(ConnectorBase): # noqa: PLR0904 """A class representing a source that can be called.""" connector_type = "source" @@ -797,7 +797,7 @@ def _read_with_catalog( ) for message in progress_tracker.tally_records_read(message_generator): if stop_event and stop_event.is_set(): - progress_tracker._log_sync_cancel() + progress_tracker._log_sync_cancel() # noqa: SLF001 time.sleep(0.1) return @@ -915,7 +915,7 @@ def read( progress_tracker.log_success() return result - def _read_to_cache( # Too many arguments + def _read_to_cache( # noqa: PLR0913 # Too many arguments self, cache: CacheBase, *, @@ -978,7 +978,7 @@ def _read_to_cache( # Too many arguments progress_tracker=progress_tracker, ) ) - cache._write_airbyte_message_stream( # Non-public API + cache._write_airbyte_message_stream( # noqa: SLF001 # Non-public API stdin=airbyte_message_iterator, catalog_provider=catalog_provider, write_strategy=write_strategy, @@ -987,7 +987,7 @@ def _read_to_cache( # Too many arguments ) # Flush the WAL, if applicable - cache.processor._do_checkpoint() # Non-public API + cache.processor._do_checkpoint() # noqa: SLF001 # Non-public API return ReadResult( source_name=self.name, diff --git a/airbyte/sources/util.py b/airbyte/sources/util.py index fda3fef47..42372ed03 100644 --- a/airbyte/sources/util.py +++ b/airbyte/sources/util.py @@ -44,7 +44,7 @@ def get_connector( ) -def get_source( # Too many arguments +def get_source( # noqa: PLR0913 # Too many arguments name: str, config: dict[str, Any] | None = None, *, diff --git a/airbyte/types.py b/airbyte/types.py index bf89d557a..9ff8e997d 100644 --- a/airbyte/types.py +++ b/airbyte/types.py @@ -1,4 +1,4 @@ -# Allow shadowing the built-in 'types' module +# noqa: A005 # Allow shadowing the built-in 'types' module # Copyright (c) 2023 Airbyte, Inc., all rights reserved. """Type conversion methods for SQL Caches.""" @@ -8,7 +8,7 @@ from typing import cast import sqlalchemy -from rich import print # Allow shadowing the built-in +from rich import print # noqa: A004 # Allow shadowing the built-in # Compare to documentation here: https://docs.airbyte.com/understanding-airbyte/supported-data-types @@ -34,7 +34,7 @@ class SQLTypeConversionError(Exception): """An exception to be raised when a type conversion fails.""" -def _get_airbyte_type( # Too many return statements +def _get_airbyte_type( # noqa: PLR0911 # Too many return statements json_schema_property_def: dict[str, str | dict | list], ) -> tuple[str, str | None]: """Get the airbyte type and subtype from a JSON schema property definition. @@ -121,7 +121,7 @@ def get_json_type(cls) -> sqlalchemy.types.TypeEngine: """Get the type to use for nested JSON data.""" return sqlalchemy.types.JSON() - def to_sql_type( # Too many return statements + def to_sql_type( # noqa: PLR0911 # Too many return statements self, json_schema_property_def: dict[str, str | dict | list], ) -> sqlalchemy.types.TypeEngine: diff --git a/airbyte/validate.py b/airbyte/validate.py index dd6f75546..4324edd2a 100644 --- a/airbyte/validate.py +++ b/airbyte/validate.py @@ -15,7 +15,7 @@ from pathlib import Path import yaml -from rich import print # Allow shadowing the built-in +from rich import print # noqa: A004 # Allow shadowing the built-in import airbyte as ab from airbyte import exceptions as exc @@ -95,7 +95,7 @@ def install_only_test(connector_name: str) -> None: """Test that the connector can be installed and spec can be printed.""" print("Creating source and validating spec is returned successfully...") source = ab.get_source(connector_name) - source._get_spec(force_refresh=True) # Member is private until we have a public API for it. + source._get_spec(force_refresh=True) # noqa: SLF001 # Member is private until we have a public API for it. def run() -> None: diff --git a/docs/generate.py b/docs/generate.py index 37258b7a8..8990ebfb3 100755 --- a/docs/generate.py +++ b/docs/generate.py @@ -48,7 +48,7 @@ def _regenerate_mcp_markdown() -> None: spec = importlib.util.spec_from_file_location("_mcp_markdown_gen", script) if spec is None or spec.loader is None: msg = f"Could not load spec for {script}" - raise RuntimeError(msg) + raise RuntimeError(msg) # noqa: TRY301 module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) print("[docs-generate] Regenerating docs/mcp-generated/ ...") diff --git a/examples/run_integ_test_source.py b/examples/run_integ_test_source.py index 4f590bdfc..f0413ee2a 100644 --- a/examples/run_integ_test_source.py +++ b/examples/run_integ_test_source.py @@ -80,7 +80,7 @@ def main( if __name__ == "__main__": # Get first arg from CLI connector_name = sys.argv[1] - streams_csv = sys.argv[2] if len(sys.argv) > 2 else None + streams_csv = sys.argv[2] if len(sys.argv) > 2 else None # noqa: PLR2004 streams = None if streams_csv: streams = streams_csv.split(",") diff --git a/examples/run_perf_test_reads.py b/examples/run_perf_test_reads.py index 1ed7c97b1..77b545354 100644 --- a/examples/run_perf_test_reads.py +++ b/examples/run_perf_test_reads.py @@ -145,7 +145,7 @@ def get_cache( credentials_path=temp.name, ) - raise ValueError(f"Unknown cache type: {cache_type}") + raise ValueError(f"Unknown cache type: {cache_type}") # noqa: TRY003 def get_source( @@ -175,7 +175,7 @@ def get_source( }, ) - raise ValueError(f"Unknown source alias: {source_alias}") + raise ValueError(f"Unknown source alias: {source_alias}") # noqa: TRY003 def get_destination(destination_type: str) -> ab.Destination: @@ -196,7 +196,7 @@ def get_destination(destination_type: str) -> ab.Destination: docker_image=True, ) - raise ValueError(f"Unknown destination type: {destination_type}") + raise ValueError(f"Unknown destination type: {destination_type}") # noqa: TRY003 def main( diff --git a/scripts/generate_mcp_markdown.py b/scripts/generate_mcp_markdown.py index 3b46cb2bd..78ba75127 100755 --- a/scripts/generate_mcp_markdown.py +++ b/scripts/generate_mcp_markdown.py @@ -163,9 +163,9 @@ def _resolve_extra_module_map(server_spec: str) -> dict[str, str]: # Import private lists from fastmcp_extensions: these are the only # place `mcp_module` is recorded for prompts/resources, so we accept # the private-name coupling. - from fastmcp_extensions.decorators import ( - _REGISTERED_PROMPTS, - _REGISTERED_RESOURCES, + from fastmcp_extensions.decorators import ( # noqa: PLC0415 + _REGISTERED_PROMPTS, # noqa: PLC2701 + _REGISTERED_RESOURCES, # noqa: PLC2701 ) for _fn, ann in _REGISTERED_PROMPTS: @@ -243,7 +243,7 @@ def _frontmatter(title: str, sidebar_label: str, description: str) -> str: ) -def _json_block(label: str, obj: Any) -> str: +def _json_block(label: str, obj: Any) -> str: # noqa: ANN401 """Render an object inside a collapsible `
` JSON code block.""" return ( f"
\n{label}\n\n" diff --git a/tests/unit_tests/test_cloud_credentials.py b/tests/unit_tests/test_cloud_credentials.py index f5e60d18b..e3438f99a 100644 --- a/tests/unit_tests/test_cloud_credentials.py +++ b/tests/unit_tests/test_cloud_credentials.py @@ -445,7 +445,7 @@ class FailingClient: def get_organization(self, **_: object) -> object: pytest.fail("get_organization should not be called") - resolved_organization_id = mcp_cloud._resolve_organization_id( + resolved_organization_id = mcp_cloud._resolve_organization_id( # noqa: SLF001 organization_id="organization-id", organization_name=None, client=FailingClient(), @@ -471,7 +471,7 @@ def fake_get_organization_info(**_: object) -> dict[str, object]: monkeypatch.setattr(api_util, "get_organization_info", fake_get_organization_info) organization = CloudOrganization("organization-id", bearer_token="token") - assert organization._fetch_organization_info() == {"organizationName": "cached"} - assert organization._fetch_organization_info(force_refresh=True) == { + assert organization._fetch_organization_info() == {"organizationName": "cached"} # noqa: SLF001 + assert organization._fetch_organization_info(force_refresh=True) == { # noqa: SLF001 "organizationName": "cached" } diff --git a/tests/unit_tests/test_mcp_connector_registry.py b/tests/unit_tests/test_mcp_connector_registry.py index 7459a7c71..c09cba1cd 100644 --- a/tests/unit_tests/test_mcp_connector_registry.py +++ b/tests/unit_tests/test_mcp_connector_registry.py @@ -499,7 +499,7 @@ def test_interactive_tools_include_prefab_metadata() -> None: interactive.register_interactive_tools(app) provider = getattr(app, "_local_provider") - tool = provider._components["tool:show_connectors_list@"] + tool = provider._components["tool:show_connectors_list@"] # noqa: SLF001 assert tool.meta is not None assert tool.meta["ui"]["resourceUri"] == "ui://prefab/renderer.html" From 2958c66d16d620c5c96382b2928416785aca85fb Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 04:22:57 +0000 Subject: [PATCH 4/4] fix(lint): remove A003, PLW0108 from ignore list cleanly Per review feedback: remove lines from ignore entirely instead of commenting them out. Both rules are already selected via their parent categories (A and PL). Co-Authored-By: AJ Steers --- .ruff.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 0385e83b5..8dcecaa83 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -86,12 +86,10 @@ ignore = [ "INP001", # Dir 'examples' is part of an implicit namespace package. Add an __init__.py. # TODO: Consider re-enabling these before release: - # "A003", # Class attribute 'type' is shadowing a Python builtin (now enforced) "BLE001", # Do not catch blind exception: Exception "ERA001", # Remove commented-out code "FIX002", # Allow "TODO:" until release (then switch to requiring links via TDO003) "PLW0603", # Using the global statement to update _cache is discouraged - # "PLW0108", # Lambda may be unnecessary; consider inlining inner function (now enforced) "TRY003", # Allow exceptions to receive strings in constructors. # "TD003", # Require links for TODOs (now enabled) "UP038", # Allow tuples instead of "|" syntax in `isinstance()` checks ("|" is sometimes slower)