Skip to content

Commit c868fdb

Browse files
refactor: move inline imports to module level in default_stream.py and concurrent_declarative_source.py
Co-Authored-By: unknown <>
1 parent 0874f12 commit c868fdb

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

airbyte_cdk/sources/declarative/concurrent_declarative_source.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
from airbyte_cdk.sources.declarative.parsers.model_to_component_factory import (
7777
ModelToComponentFactory,
7878
)
79+
from airbyte_cdk.sources.declarative.partition_routers.substream_partition_router import (
80+
SubstreamPartitionRouter,
81+
)
7982
from airbyte_cdk.sources.declarative.resolvers import COMPONENTS_RESOLVER_TYPE_MAPPING
8083
from airbyte_cdk.sources.declarative.spec.spec import Spec
8184
from airbyte_cdk.sources.declarative.types import Config, ConnectionDefinition
@@ -433,10 +436,6 @@ def _apply_stream_groups(self, streams: List[AbstractStream]) -> None:
433436
against actual created stream instances by name. Validates that no stream shares a
434437
group with any of its parent streams, which would cause a deadlock.
435438
"""
436-
from airbyte_cdk.sources.declarative.partition_routers.substream_partition_router import (
437-
SubstreamPartitionRouter,
438-
)
439-
440439
stream_groups = self._source_config.get("stream_groups", {})
441440
if not stream_groups:
442441
return

airbyte_cdk/sources/streams/concurrent/default_stream.py

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

55
from logging import Logger
6-
from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Mapping, Optional, Union
7-
8-
if TYPE_CHECKING:
9-
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
6+
from typing import Any, Callable, Iterable, List, Mapping, Optional, Union
107

118
from airbyte_cdk.models import AirbyteStream, SyncMode
9+
from airbyte_cdk.sources.declarative.incremental.concurrent_partition_cursor import (
10+
ConcurrentPerPartitionCursor,
11+
)
12+
from airbyte_cdk.sources.declarative.partition_routers.partition_router import PartitionRouter
13+
from airbyte_cdk.sources.declarative.stream_slicers.declarative_partition_generator import (
14+
StreamSlicerPartitionGenerator,
15+
)
1216
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
1317
from airbyte_cdk.sources.streams.concurrent.availability_strategy import StreamAvailability
1418
from airbyte_cdk.sources.streams.concurrent.cursor import Cursor, CursorField
@@ -108,15 +112,8 @@ def block_simultaneous_read(self) -> str:
108112
def block_simultaneous_read(self, value: str) -> None:
109113
self._block_simultaneous_read = value
110114

111-
def get_partition_router(self) -> "PartitionRouter | None":
115+
def get_partition_router(self) -> PartitionRouter | None:
112116
"""Return the partition router for this stream, or None if not available."""
113-
from airbyte_cdk.sources.declarative.incremental.concurrent_partition_cursor import (
114-
ConcurrentPerPartitionCursor,
115-
)
116-
from airbyte_cdk.sources.declarative.stream_slicers.declarative_partition_generator import (
117-
StreamSlicerPartitionGenerator,
118-
)
119-
120117
if not isinstance(self._stream_partition_generator, StreamSlicerPartitionGenerator):
121118
return None
122119
stream_slicer = self._stream_partition_generator._stream_slicer

0 commit comments

Comments
 (0)