Skip to content

Commit

Permalink
fix a bunch of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Nov 11, 2024
1 parent e987d9a commit c3ce1ee
Show file tree
Hide file tree
Showing 67 changed files with 295 additions and 328 deletions.
2 changes: 1 addition & 1 deletion airbyte_cdk/config_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from copy import copy
from typing import Any

from orjson import orjson
import orjson

from airbyte_cdk.models import (
AirbyteControlConnectorConfigMessage,
Expand Down
2 changes: 1 addition & 1 deletion airbyte_cdk/destinations/destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, ClassVar

from orjson import orjson
import orjson

from airbyte_cdk.connector import Connector
from airbyte_cdk.exception_handler import init_uncaught_exception_handler
Expand Down
5 changes: 2 additions & 3 deletions airbyte_cdk/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
import sys
import tempfile
from collections import defaultdict
from collections.abc import Iterable, Mapping
from functools import wraps
from typing import TYPE_CHECKING, Any
from urllib.parse import urlparse

import orjson
import requests
from orjson import orjson
from requests import PreparedRequest, Response, Session

from airbyte_cdk.exception_handler import init_uncaught_exception_handler
Expand All @@ -44,8 +45,6 @@


if TYPE_CHECKING:
from collections.abc import Iterable, Mapping

from airbyte_cdk.connector import TConfig


Expand Down
2 changes: 1 addition & 1 deletion airbyte_cdk/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import logging.config
from typing import TYPE_CHECKING, Any, ClassVar

from orjson import orjson
import orjson

from airbyte_cdk.models import (
AirbyteLogMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
from __future__ import annotations

import logging
from collections.abc import Iterable
from typing import TYPE_CHECKING

from airbyte_cdk.exception_handler import generate_failed_streams_error_message
Expand All @@ -16,9 +18,6 @@


if TYPE_CHECKING:
import logging
from collections.abc import Iterable

from airbyte_cdk.sources.concurrent_source.partition_generation_completed_sentinel import (
PartitionGenerationCompletedSentinel,
)
Expand Down
5 changes: 2 additions & 3 deletions airbyte_cdk/sources/concurrent_source/concurrent_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from __future__ import annotations

import concurrent
import logging
from collections.abc import Iterable, Iterator
from queue import Queue
from typing import TYPE_CHECKING

Expand All @@ -26,9 +28,6 @@


if TYPE_CHECKING:
import logging
from collections.abc import Iterable, Iterator

from airbyte_cdk.models import AirbyteMessage
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
#
from __future__ import annotations

from collections.abc import Mapping
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING, Any
from typing import Any

from airbyte_cdk.sources.streams.http.requests_native_auth.abstract_token import (
AbstractHeaderAuthenticator,
)


if TYPE_CHECKING:
from collections.abc import Mapping


@dataclass
class DeclarativeAuthenticator(AbstractHeaderAuthenticator):
"""Interface used to associate which authenticators can be used as part of the declarative framework"""
"""Interface used to associate which authenticators can be used as part of the declarative framework."""

def get_request_params(self) -> Mapping[str, Any]:
"""HTTP request parameter to add to the requests"""
Expand Down
5 changes: 1 addition & 4 deletions airbyte_cdk/sources/declarative/auth/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import annotations

import base64
from collections.abc import Mapping
from dataclasses import InitVar, dataclass
from datetime import datetime
from typing import TYPE_CHECKING, Any
Expand All @@ -16,10 +17,6 @@
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString


if TYPE_CHECKING:
from collections.abc import Mapping


class JwtAlgorithm(str): # noqa: SLOT000 (no slots in str subclass)
"""Enum for supported JWT algorithms"""

Expand Down
5 changes: 1 addition & 4 deletions airbyte_cdk/sources/declarative/auth/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
from __future__ import annotations

from collections.abc import Mapping
from dataclasses import InitVar, dataclass, field
from typing import TYPE_CHECKING, Any

Expand All @@ -20,10 +21,6 @@
)


if TYPE_CHECKING:
from collections.abc import Mapping


@dataclass
class DeclarativeOauth2Authenticator(AbstractOauth2Authenticator, DeclarativeAuthenticator):
"""Generates OAuth2.0 access tokens from an OAuth2.0 refresh token and client credentials based on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
from __future__ import annotations

from collections.abc import Mapping
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any

Expand All @@ -11,10 +12,6 @@
from airbyte_cdk.sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator


if TYPE_CHECKING:
from collections.abc import Mapping


@dataclass
class SelectiveAuthenticator(DeclarativeAuthenticator):
"""Authenticator that selects concrete implementation based on specific config value."""
Expand Down
10 changes: 3 additions & 7 deletions airbyte_cdk/sources/declarative/auth/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@

import base64
import logging
from collections.abc import Mapping
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING, Any

import requests
from cachetools import TTLCache, cached

from airbyte_cdk.sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator
from airbyte_cdk.sources.declarative.auth.token_provider import TokenProvider
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString
from airbyte_cdk.sources.declarative.requesters.request_option import (
RequestOption,
RequestOptionType,
)


if TYPE_CHECKING:
from collections.abc import Mapping

from airbyte_cdk.sources.declarative.auth.token_provider import TokenProvider
from airbyte_cdk.sources.types import Config
from airbyte_cdk.sources.types import Config


@dataclass
Expand Down
5 changes: 2 additions & 3 deletions airbyte_cdk/sources/declarative/auth/token_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#
from __future__ import annotations

import datetime
from abc import abstractmethod
from collections.abc import Mapping
from dataclasses import InitVar, dataclass, field
from typing import TYPE_CHECKING, Any

Expand All @@ -19,9 +21,6 @@


if TYPE_CHECKING:
import datetime
from collections.abc import Mapping

from isodate import Duration

from airbyte_cdk.sources.declarative.decoders.decoder import Decoder
Expand Down
5 changes: 2 additions & 3 deletions airbyte_cdk/sources/declarative/checks/check_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#
from __future__ import annotations

import logging
import traceback
from collections.abc import Mapping
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING, Any

Expand All @@ -12,9 +14,6 @@


if TYPE_CHECKING:
import logging
from collections.abc import Mapping

from airbyte_cdk import AbstractSource


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
#
from __future__ import annotations

from collections.abc import Mapping
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING, Any

from airbyte_cdk.sources.declarative.interpolation import InterpolatedString


if TYPE_CHECKING:
from collections.abc import Mapping

from airbyte_cdk.sources.types import Config
from airbyte_cdk.sources.types import Config


@dataclass
Expand Down
7 changes: 2 additions & 5 deletions airbyte_cdk/sources/declarative/datetime/min_max_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
#
from __future__ import annotations

import datetime as dt
from collections.abc import Mapping
from dataclasses import InitVar, dataclass, field
from typing import TYPE_CHECKING, Any

from airbyte_cdk.sources.declarative.datetime.datetime_parser import DatetimeParser
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString


if TYPE_CHECKING:
import datetime as dt
from collections.abc import Mapping


@dataclass
class MinMaxDatetime:
"""Compares the provided date against optional minimum or maximum times. If date is earlier than
Expand Down
7 changes: 3 additions & 4 deletions airbyte_cdk/sources/declarative/declarative_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
from __future__ import annotations

import logging
from collections.abc import Iterable, Mapping, MutableMapping
from dataclasses import InitVar, dataclass, field
from typing import TYPE_CHECKING, Any

Expand All @@ -12,7 +14,7 @@
PerPartitionWithGlobalCursor,
)
from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
from airbyte_cdk.sources.declarative.retrievers import SimpleRetriever
from airbyte_cdk.sources.declarative.retrievers.simple_retriever import SimpleRetriever
from airbyte_cdk.sources.declarative.schema import DefaultSchemaLoader
from airbyte_cdk.sources.streams.checkpoint import (
CheckpointMode,
Expand All @@ -25,9 +27,6 @@


if TYPE_CHECKING:
import logging
from collections.abc import Iterable, Mapping, MutableMapping

from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.declarative.migrations.state_migration import StateMigration
from airbyte_cdk.sources.declarative.retrievers.retriever import Retriever
Expand Down
7 changes: 2 additions & 5 deletions airbyte_cdk/sources/declarative/decoders/json_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
from __future__ import annotations

import logging
from collections.abc import Generator, Mapping
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING, Any

import orjson
import requests
from orjson import orjson

from airbyte_cdk.sources.declarative.decoders.decoder import Decoder


if TYPE_CHECKING:
from collections.abc import Generator, Mapping


logger = logging.getLogger("airbyte")


Expand Down
8 changes: 2 additions & 6 deletions airbyte_cdk/sources/declarative/decoders/xml_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@
from __future__ import annotations

import logging
from collections.abc import Generator, Mapping, MutableMapping
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING, Any
from xml.parsers.expat import ExpatError

import requests
import xmltodict

from airbyte_cdk.sources.declarative.decoders.decoder import Decoder


if TYPE_CHECKING:
from collections.abc import Generator, Mapping, MutableMapping

import requests


logger = logging.getLogger("airbyte")


Expand Down
11 changes: 3 additions & 8 deletions airbyte_cdk/sources/declarative/extractors/dpath_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
#
from __future__ import annotations

from collections.abc import Iterable, Mapping, MutableMapping
from dataclasses import InitVar, dataclass, field
from typing import TYPE_CHECKING, Any

import dpath
import requests

from airbyte_cdk.sources.declarative.decoders import Decoder, JsonDecoder
from airbyte_cdk.sources.declarative.extractors.record_extractor import RecordExtractor
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString


if TYPE_CHECKING:
from collections.abc import Iterable, Mapping, MutableMapping

import requests

from airbyte_cdk.sources.types import Config
from airbyte_cdk.sources.types import Config


@dataclass
Expand Down
Loading

0 comments on commit c3ce1ee

Please sign in to comment.