Skip to content

Commit

Permalink
chore: lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Sep 9, 2024
1 parent 6d0855b commit 9ef9139
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion airbyte/_executors/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import TYPE_CHECKING, Literal

from overrides import overrides
from rich import print
from rich import print # noqa: A004 # Allow shadowing the built-in

from airbyte import exceptions as exc
from airbyte._executors.base import Executor
Expand Down
2 changes: 1 addition & 1 deletion airbyte/_executors/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests
import yaml
from requests import HTTPError
from rich import print
from rich import print # noqa: A004 # Allow shadowing the built-in

from airbyte import exceptions as exc
from airbyte._executors.declarative import DeclarativeExecutor
Expand Down
2 changes: 1 addition & 1 deletion airbyte/_util/temp_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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(
temp_file = tempfile.NamedTemporaryFile( # noqa: SIM115 # Avoiding context manager
mode="w+t",
delete=False,
encoding="utf-8",
Expand Down
2 changes: 1 addition & 1 deletion airbyte/_writers/jsonl.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _open_new_file(
"""Open a new file for writing."""
return cast(
IO[str],
gzip.open(
gzip.open( # noqa: SIM115 # Avoiding context manager
file_path,
mode="wt",
encoding="utf-8",
Expand Down
8 changes: 4 additions & 4 deletions airbyte/cloud/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ def _deploy_connection(
source_id: str
if isinstance(source, Source):
selected_streams = selected_streams or source.get_selected_streams()
if source._deployed_source_id: # noqa: SLF001
source_id = source._deployed_source_id # noqa: SLF001
else:
source_id = self._deploy_source(source)
source_id = (
source._deployed_source_id # noqa: SLF001 # Access to non-public API
or self._deploy_source(source)
)
else:
source_id = source
if not selected_streams:
Expand Down
2 changes: 1 addition & 1 deletion airbyte/secrets/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ def disable_secret_source(source: SecretManager | SecretSourceEnum) -> None:
return

# Else, remove by name
for s in _SECRETS_SOURCES:
for s in list(_SECRETS_SOURCES).copy():
if s.name == str(source):
_SECRETS_SOURCES.remove(s)
13 changes: 7 additions & 6 deletions airbyte/shared/sql_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,13 @@ def _get_temp_table_name(
if not batch_id:
batch_id = str(ulid.ULID())

if len(batch_id) > 9:
# Use the first 6 and last 3 characters of the ULID. This gives great uniqueness while
# limiting the table name suffix to 10 characters, including the underscore.
suffix = f"{batch_id[:6]}{batch_id[-3:]}"
else:
suffix = batch_id
# Use the first 6 and last 3 characters of the ULID. This gives great uniqueness while
# 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
else batch_id
)

# Note: The normalizer may truncate the table name if the database has a name length limit.
# For instance, the Postgres normalizer will enforce a 63-character limit on table names.
Expand Down
2 changes: 1 addition & 1 deletion airbyte/sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import TYPE_CHECKING, Any, Literal

import yaml
from rich import print
from rich import print # noqa: A004 # Allow shadowing the built-in
from rich.syntax import Syntax

from airbyte_protocol.models import (
Expand Down
3 changes: 2 additions & 1 deletion airbyte/types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# noqa: A005 # Allow shadowing the built-in 'types' module
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.

"""Type conversion methods for SQL Caches."""
Expand All @@ -7,7 +8,7 @@
from typing import cast

import sqlalchemy
from rich import print
from rich import print # noqa: A004 # Allow shadowing the built-in


# Compare to documentation here: https://docs.airbyte.com/understanding-airbyte/supported-data-types
Expand Down
2 changes: 1 addition & 1 deletion airbyte/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pathlib import Path

import yaml
from rich import print
from rich import print # noqa: A004 # Allow shadowing the built-in

import airbyte as ab
from airbyte import exceptions as exc
Expand Down

0 comments on commit 9ef9139

Please sign in to comment.