Skip to content

Commit 2671c24

Browse files
authored
fix: fix sorting & __init__ imports (#189)
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
1 parent cf93e3a commit 2671c24

File tree

35 files changed

+331
-122
lines changed

35 files changed

+331
-122
lines changed

airbyte_cdk/__init__.py

Lines changed: 93 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,46 @@
4848
# Once those issues are resolved, the below can be sorted with isort.
4949
import dunamai as _dunamai
5050

51-
from .destinations import Destination
52-
from .models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, Status, Type, FailureType, AirbyteStream, AdvancedAuth, DestinationSyncMode, ConnectorSpecification, OAuthConfigSpecification, OrchestratorType, ConfiguredAirbyteStream, SyncMode, AirbyteLogMessage, Level, AirbyteRecordMessage
53-
54-
from .sources import Source
55-
from .config_observation import create_connector_config_control_message, emit_configuration_as_airbyte_control_message
51+
from .config_observation import (
52+
create_connector_config_control_message,
53+
emit_configuration_as_airbyte_control_message,
54+
)
5655
from .connector import BaseConnector, Connector
57-
58-
from .entrypoint import launch, AirbyteEntrypoint
59-
56+
from .destinations import Destination
57+
from .entrypoint import AirbyteEntrypoint, launch
6058
from .logger import AirbyteLogFormatter, init_logger
61-
from .sources import AbstractSource
59+
from .models import (
60+
AdvancedAuth,
61+
AirbyteConnectionStatus,
62+
AirbyteLogMessage,
63+
AirbyteMessage,
64+
AirbyteRecordMessage,
65+
AirbyteStream,
66+
ConfiguredAirbyteCatalog,
67+
ConfiguredAirbyteStream,
68+
ConnectorSpecification,
69+
DestinationSyncMode,
70+
FailureType,
71+
Level,
72+
OAuthConfigSpecification,
73+
OrchestratorType,
74+
Status,
75+
SyncMode,
76+
Type,
77+
)
78+
from .sources import AbstractSource, Source
6279
from .sources.concurrent_source.concurrent_source import ConcurrentSource
6380
from .sources.concurrent_source.concurrent_source_adapter import ConcurrentSourceAdapter
6481
from .sources.config import BaseConfig
65-
from .sources.types import Config, Record, StreamSlice
6682
from .sources.connector_state_manager import ConnectorStateManager
6783
from .sources.declarative.auth import DeclarativeOauth2Authenticator
68-
from .sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator
69-
from .sources.declarative.auth.declarative_authenticator import NoAuth
84+
from .sources.declarative.auth.declarative_authenticator import DeclarativeAuthenticator, NoAuth
7085
from .sources.declarative.auth.oauth import DeclarativeSingleUseRefreshTokenOauth2Authenticator
71-
from .sources.declarative.auth.token import BasicHttpAuthenticator, BearerAuthenticator, ApiKeyAuthenticator
86+
from .sources.declarative.auth.token import (
87+
ApiKeyAuthenticator,
88+
BasicHttpAuthenticator,
89+
BearerAuthenticator,
90+
)
7291
from .sources.declarative.datetime.min_max_datetime import MinMaxDatetime
7392
from .sources.declarative.declarative_stream import DeclarativeStream
7493
from .sources.declarative.decoders import Decoder, JsonDecoder
@@ -77,48 +96,89 @@
7796
from .sources.declarative.extractors.record_extractor import RecordExtractor
7897
from .sources.declarative.extractors.record_filter import RecordFilter
7998
from .sources.declarative.incremental import DatetimeBasedCursor
80-
from .sources.declarative.interpolation import InterpolatedString, InterpolatedBoolean
99+
from .sources.declarative.interpolation import InterpolatedBoolean, InterpolatedString
81100
from .sources.declarative.manifest_declarative_source import ManifestDeclarativeSource
82-
from .sources.declarative.migrations.legacy_to_per_partition_state_migration import LegacyToPerPartitionStateMigration
83-
84-
from .sources.declarative.partition_routers import CartesianProductStreamSlicer, SinglePartitionRouter, SubstreamPartitionRouter
101+
from .sources.declarative.migrations.legacy_to_per_partition_state_migration import (
102+
LegacyToPerPartitionStateMigration,
103+
)
104+
from .sources.declarative.partition_routers import (
105+
CartesianProductStreamSlicer,
106+
SinglePartitionRouter,
107+
SubstreamPartitionRouter,
108+
)
85109
from .sources.declarative.partition_routers.substream_partition_router import ParentStreamConfig
86-
from .sources.declarative.requesters import Requester, HttpRequester
87-
110+
from .sources.declarative.requesters import HttpRequester, Requester
88111
from .sources.declarative.requesters.error_handlers import BackoffStrategy
89112
from .sources.declarative.requesters.paginators import DefaultPaginator, PaginationStrategy
90-
from .sources.declarative.requesters.paginators.strategies import OffsetIncrement, CursorPaginationStrategy, PageIncrement, StopConditionPaginationStrategyDecorator
91-
113+
from .sources.declarative.requesters.paginators.strategies import (
114+
CursorPaginationStrategy,
115+
OffsetIncrement,
116+
PageIncrement,
117+
StopConditionPaginationStrategyDecorator,
118+
)
92119
from .sources.declarative.requesters.request_option import RequestOption, RequestOptionType
93-
94-
from .sources.declarative.requesters.request_options.default_request_options_provider import DefaultRequestOptionsProvider
95-
from .sources.declarative.requesters.request_options.interpolated_request_input_provider import InterpolatedRequestInputProvider
120+
from .sources.declarative.requesters.request_options.default_request_options_provider import (
121+
DefaultRequestOptionsProvider,
122+
)
123+
from .sources.declarative.requesters.request_options.interpolated_request_input_provider import (
124+
InterpolatedRequestInputProvider,
125+
)
96126
from .sources.declarative.requesters.requester import HttpMethod
97127
from .sources.declarative.retrievers import SimpleRetriever
98128
from .sources.declarative.schema import JsonFileSchemaLoader
99-
from .sources.declarative.transformations.add_fields import AddFields, AddedFieldDefinition
129+
from .sources.declarative.transformations.add_fields import AddedFieldDefinition, AddFields
100130
from .sources.declarative.transformations.transformation import RecordTransformation
101131
from .sources.declarative.types import FieldPointer
102132
from .sources.declarative.yaml_declarative_source import YamlDeclarativeSource
103133
from .sources.message import InMemoryMessageRepository, MessageRepository
104134
from .sources.source import TState
105135
from .sources.streams.availability_strategy import AvailabilityStrategy
106-
from .sources.streams.call_rate import AbstractAPIBudget, HttpAPIBudget, HttpRequestMatcher, MovingWindowCallRatePolicy, Rate, CachedLimiterSession, LimiterSession
136+
from .sources.streams.call_rate import (
137+
AbstractAPIBudget,
138+
CachedLimiterSession,
139+
HttpAPIBudget,
140+
HttpRequestMatcher,
141+
LimiterSession,
142+
MovingWindowCallRatePolicy,
143+
Rate,
144+
)
107145
from .sources.streams.checkpoint import Cursor as LegacyCursor
108146
from .sources.streams.checkpoint import ResumableFullRefreshCursor
109147
from .sources.streams.concurrent.adapters import StreamFacade
110-
from .sources.streams.concurrent.cursor import ConcurrentCursor, CursorField, FinalStateCursor
111-
from .sources.streams.concurrent.cursor import Cursor
112-
from .sources.streams.concurrent.state_converters.datetime_stream_state_converter import EpochValueConcurrentStreamStateConverter, IsoMillisConcurrentStreamStateConverter
113-
from .sources.streams.core import Stream, IncrementalMixin, package_name_from_class
148+
from .sources.streams.concurrent.cursor import (
149+
ConcurrentCursor,
150+
Cursor,
151+
CursorField,
152+
FinalStateCursor,
153+
)
154+
from .sources.streams.concurrent.state_converters.datetime_stream_state_converter import (
155+
EpochValueConcurrentStreamStateConverter,
156+
IsoMillisConcurrentStreamStateConverter,
157+
)
158+
from .sources.streams.core import IncrementalMixin, Stream, package_name_from_class
114159
from .sources.streams.http import HttpStream, HttpSubStream
115160
from .sources.streams.http.availability_strategy import HttpAvailabilityStrategy
116-
from .sources.streams.http.exceptions import BaseBackoffException, DefaultBackoffException, UserDefinedBackoffException
161+
from .sources.streams.http.exceptions import (
162+
BaseBackoffException,
163+
DefaultBackoffException,
164+
UserDefinedBackoffException,
165+
)
117166
from .sources.streams.http.rate_limiting import default_backoff_handler
118-
from .sources.streams.http.requests_native_auth import Oauth2Authenticator, TokenAuthenticator, SingleUseRefreshTokenOauth2Authenticator
167+
from .sources.streams.http.requests_native_auth import (
168+
Oauth2Authenticator,
169+
SingleUseRefreshTokenOauth2Authenticator,
170+
TokenAuthenticator,
171+
)
119172
from .sources.streams.http.requests_native_auth.abstract_token import AbstractHeaderAuthenticator
173+
from .sources.types import Config, Record, StreamSlice
120174
from .sources.utils import casing
121-
from .sources.utils.schema_helpers import InternalConfig, ResourceSchemaLoader, check_config_against_spec_or_exit, split_config, expand_refs
175+
from .sources.utils.schema_helpers import (
176+
InternalConfig,
177+
ResourceSchemaLoader,
178+
check_config_against_spec_or_exit,
179+
expand_refs,
180+
split_config,
181+
)
122182
from .sources.utils.transform import TransformConfig, TypeTransformer
123183
from .utils import AirbyteTracedException, is_cloud_environment
124184
from .utils.constants import ENV_REQUEST_CACHE_PATH
@@ -127,7 +187,6 @@
127187
from .utils.spec_schema_transformations import resolve_refs
128188
from .utils.stream_status_utils import as_airbyte_message
129189

130-
131190
__all__ = [
132191
# Availability strategy
133192
"AvailabilityStrategy",
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from airbyte_cdk.cli.source_declarative_manifest._run import run
22

3-
43
__all__ = [
54
"run",
65
]

airbyte_cdk/models/__init__.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
# of airbyte-cdk rather than a standalone package.
88
from .airbyte_protocol import (
99
AdvancedAuth,
10-
AirbyteStateStats,
1110
AirbyteAnalyticsTraceMessage,
1211
AirbyteCatalog,
1312
AirbyteConnectionStatus,
@@ -22,13 +21,14 @@
2221
AirbyteRecordMessage,
2322
AirbyteStateBlob,
2423
AirbyteStateMessage,
24+
AirbyteStateStats,
2525
AirbyteStateType,
2626
AirbyteStream,
2727
AirbyteStreamState,
2828
AirbyteStreamStatus,
29-
AirbyteStreamStatusTraceMessage,
3029
AirbyteStreamStatusReason,
3130
AirbyteStreamStatusReasonType,
31+
AirbyteStreamStatusTraceMessage,
3232
AirbyteTraceMessage,
3333
AuthFlowType,
3434
ConfiguredAirbyteCatalog,
@@ -48,6 +48,14 @@
4848
TraceType,
4949
Type,
5050
)
51+
from .airbyte_protocol_serializers import (
52+
AirbyteMessageSerializer,
53+
AirbyteStateMessageSerializer,
54+
AirbyteStreamStateSerializer,
55+
ConfiguredAirbyteCatalogSerializer,
56+
ConfiguredAirbyteStreamSerializer,
57+
ConnectorSpecificationSerializer,
58+
)
5159
from .well_known_types import (
5260
BinaryData,
5361
Boolean,
@@ -61,12 +69,3 @@
6169
TimeWithoutTimezone,
6270
TimeWithTimezone,
6371
)
64-
65-
from .airbyte_protocol_serializers import (
66-
AirbyteStreamStateSerializer,
67-
AirbyteStateMessageSerializer,
68-
AirbyteMessageSerializer,
69-
ConfiguredAirbyteCatalogSerializer,
70-
ConfiguredAirbyteStreamSerializer,
71-
ConnectorSpecificationSerializer,
72-
)

airbyte_cdk/sources/declarative/async_job/job_orchestrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
TypeVar,
2121
)
2222

23-
from airbyte_cdk import StreamSlice
2423
from airbyte_cdk.logger import lazy_log
2524
from airbyte_cdk.models import FailureType
2625
from airbyte_cdk.sources.declarative.async_job.job import AsyncJob
@@ -31,6 +30,7 @@
3130
from airbyte_cdk.sources.declarative.async_job.repository import AsyncJobRepository
3231
from airbyte_cdk.sources.declarative.async_job.status import AsyncJobStatus
3332
from airbyte_cdk.sources.message import MessageRepository
33+
from airbyte_cdk.sources.types import StreamSlice
3434
from airbyte_cdk.utils.airbyte_secrets_utils import filter_secrets
3535
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
3636

airbyte_cdk/sources/declarative/auth/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
33
#
44

5-
from airbyte_cdk.sources.declarative.auth.oauth import DeclarativeOauth2Authenticator
65
from airbyte_cdk.sources.declarative.auth.jwt import JwtAuthenticator
6+
from airbyte_cdk.sources.declarative.auth.oauth import DeclarativeOauth2Authenticator
77

8-
__all__ = [
9-
"DeclarativeOauth2Authenticator",
10-
"JwtAuthenticator"
11-
]
8+
__all__ = ["DeclarativeOauth2Authenticator", "JwtAuthenticator"]

airbyte_cdk/sources/declarative/decoders/__init__.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,25 @@
33
#
44

55
from airbyte_cdk.sources.declarative.decoders.decoder import Decoder
6-
from airbyte_cdk.sources.declarative.decoders.json_decoder import JsonDecoder, JsonlDecoder, IterableDecoder, GzipJsonDecoder
6+
from airbyte_cdk.sources.declarative.decoders.json_decoder import (
7+
GzipJsonDecoder,
8+
IterableDecoder,
9+
JsonDecoder,
10+
JsonlDecoder,
11+
)
712
from airbyte_cdk.sources.declarative.decoders.noop_decoder import NoopDecoder
8-
from airbyte_cdk.sources.declarative.decoders.pagination_decoder_decorator import PaginationDecoderDecorator
13+
from airbyte_cdk.sources.declarative.decoders.pagination_decoder_decorator import (
14+
PaginationDecoderDecorator,
15+
)
916
from airbyte_cdk.sources.declarative.decoders.xml_decoder import XmlDecoder
1017

11-
__all__ = ["Decoder", "JsonDecoder", "JsonlDecoder", "IterableDecoder", "GzipJsonDecoder", "NoopDecoder", "PaginationDecoderDecorator", "XmlDecoder"]
18+
__all__ = [
19+
"Decoder",
20+
"JsonDecoder",
21+
"JsonlDecoder",
22+
"IterableDecoder",
23+
"GzipJsonDecoder",
24+
"NoopDecoder",
25+
"PaginationDecoderDecorator",
26+
"XmlDecoder",
27+
]

airbyte_cdk/sources/declarative/extractors/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
from airbyte_cdk.sources.declarative.extractors.http_selector import HttpSelector
77
from airbyte_cdk.sources.declarative.extractors.record_filter import RecordFilter
88
from airbyte_cdk.sources.declarative.extractors.record_selector import RecordSelector
9-
from airbyte_cdk.sources.declarative.extractors.response_to_file_extractor import ResponseToFileExtractor
9+
from airbyte_cdk.sources.declarative.extractors.response_to_file_extractor import (
10+
ResponseToFileExtractor,
11+
)
1012

11-
__all__ = ["HttpSelector", "DpathExtractor", "RecordFilter", "RecordSelector", "ResponseToFileExtractor"]
13+
__all__ = [
14+
"HttpSelector",
15+
"DpathExtractor",
16+
"RecordFilter",
17+
"RecordSelector",
18+
"ResponseToFileExtractor",
19+
]

airbyte_cdk/sources/declarative/incremental/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44

55
from airbyte_cdk.sources.declarative.incremental.datetime_based_cursor import DatetimeBasedCursor
66
from airbyte_cdk.sources.declarative.incremental.declarative_cursor import DeclarativeCursor
7-
from airbyte_cdk.sources.declarative.incremental.global_substream_cursor import GlobalSubstreamCursor
8-
from airbyte_cdk.sources.declarative.incremental.per_partition_cursor import CursorFactory, PerPartitionCursor
9-
from airbyte_cdk.sources.declarative.incremental.per_partition_with_global import PerPartitionWithGlobalCursor
7+
from airbyte_cdk.sources.declarative.incremental.global_substream_cursor import (
8+
GlobalSubstreamCursor,
9+
)
10+
from airbyte_cdk.sources.declarative.incremental.per_partition_cursor import (
11+
CursorFactory,
12+
PerPartitionCursor,
13+
)
14+
from airbyte_cdk.sources.declarative.incremental.per_partition_with_global import (
15+
PerPartitionWithGlobalCursor,
16+
)
1017
from airbyte_cdk.sources.declarative.incremental.resumable_full_refresh_cursor import (
1118
ChildPartitionResumableFullRefreshCursor,
1219
ResumableFullRefreshCursor,

airbyte_cdk/sources/declarative/partition_routers/__init__.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
33
#
44

5-
from airbyte_cdk.sources.declarative.partition_routers.async_job_partition_router import AsyncJobPartitionRouter
6-
from airbyte_cdk.sources.declarative.partition_routers.cartesian_product_stream_slicer import CartesianProductStreamSlicer
7-
from airbyte_cdk.sources.declarative.partition_routers.list_partition_router import ListPartitionRouter
8-
from airbyte_cdk.sources.declarative.partition_routers.single_partition_router import SinglePartitionRouter
9-
from airbyte_cdk.sources.declarative.partition_routers.substream_partition_router import SubstreamPartitionRouter
5+
from airbyte_cdk.sources.declarative.partition_routers.async_job_partition_router import (
6+
AsyncJobPartitionRouter,
7+
)
8+
from airbyte_cdk.sources.declarative.partition_routers.cartesian_product_stream_slicer import (
9+
CartesianProductStreamSlicer,
10+
)
11+
from airbyte_cdk.sources.declarative.partition_routers.list_partition_router import (
12+
ListPartitionRouter,
13+
)
1014
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
15+
from airbyte_cdk.sources.declarative.partition_routers.single_partition_router import (
16+
SinglePartitionRouter,
17+
)
18+
from airbyte_cdk.sources.declarative.partition_routers.substream_partition_router import (
19+
SubstreamPartitionRouter,
20+
)
1121

1222
__all__ = [
1323
"AsyncJobPartitionRouter",
1424
"CartesianProductStreamSlicer",
1525
"ListPartitionRouter",
1626
"SinglePartitionRouter",
1727
"SubstreamPartitionRouter",
18-
"PartitionRouter"
28+
"PartitionRouter",
1929
]

airbyte_cdk/sources/declarative/requesters/error_handlers/__init__.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
33
#
44

5-
from airbyte_cdk.sources.declarative.requesters.error_handlers.backoff_strategy import BackoffStrategy
6-
from airbyte_cdk.sources.declarative.requesters.error_handlers.composite_error_handler import CompositeErrorHandler
7-
from airbyte_cdk.sources.declarative.requesters.error_handlers.default_error_handler import DefaultErrorHandler
5+
from airbyte_cdk.sources.declarative.requesters.error_handlers.backoff_strategy import (
6+
BackoffStrategy,
7+
)
8+
from airbyte_cdk.sources.declarative.requesters.error_handlers.composite_error_handler import (
9+
CompositeErrorHandler,
10+
)
11+
from airbyte_cdk.sources.declarative.requesters.error_handlers.default_error_handler import (
12+
DefaultErrorHandler,
13+
)
814
from airbyte_cdk.sources.declarative.requesters.error_handlers.error_handler import ErrorHandler
9-
from airbyte_cdk.sources.declarative.requesters.error_handlers.http_response_filter import HttpResponseFilter
15+
from airbyte_cdk.sources.declarative.requesters.error_handlers.http_response_filter import (
16+
HttpResponseFilter,
17+
)
1018

11-
__all__ = ["BackoffStrategy", "CompositeErrorHandler", "DefaultErrorHandler", "ErrorHandler", "HttpResponseFilter"]
19+
__all__ = [
20+
"BackoffStrategy",
21+
"CompositeErrorHandler",
22+
"DefaultErrorHandler",
23+
"ErrorHandler",
24+
"HttpResponseFilter",
25+
]

0 commit comments

Comments
 (0)