Skip to content

Commit 8bef9dd

Browse files
author
maxime.c
committed
format
1 parent 5bafeca commit 8bef9dd

File tree

3 files changed

+36
-13
lines changed

3 files changed

+36
-13
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,11 @@ def create_custom_component(self, model: Any, config: Config, **kwargs: Any) ->
17481748

17491749
if self._is_component(model_value):
17501750
model_args[model_field] = self._create_nested_component(
1751-
model, model_field, model_value, config, **kwargs,
1751+
model,
1752+
model_field,
1753+
model_value,
1754+
config,
1755+
**kwargs,
17521756
)
17531757
elif isinstance(model_value, list):
17541758
vals = []
@@ -1760,7 +1764,15 @@ def create_custom_component(self, model: Any, config: Config, **kwargs: Any) ->
17601764
if derived_type:
17611765
v["type"] = derived_type
17621766
if self._is_component(v):
1763-
vals.append(self._create_nested_component(model, model_field, v, config, **kwargs,))
1767+
vals.append(
1768+
self._create_nested_component(
1769+
model,
1770+
model_field,
1771+
v,
1772+
config,
1773+
**kwargs,
1774+
)
1775+
)
17641776
else:
17651777
vals.append(v)
17661778
model_args[model_field] = vals
@@ -2525,7 +2537,9 @@ def create_dynamic_schema_loader(
25252537
config=config,
25262538
name=name,
25272539
primary_key=None,
2528-
partition_router=self._build_stream_slicer_from_partition_router(model.retriever, config),
2540+
partition_router=self._build_stream_slicer_from_partition_router(
2541+
model.retriever, config
2542+
),
25292543
transformations=[],
25302544
use_cache=True,
25312545
log_formatter=(
@@ -3238,7 +3252,9 @@ def _get_url(req: Requester) -> str:
32383252

32393253
if not request_options_provider:
32403254
request_options_provider = DefaultRequestOptionsProvider(parameters={})
3241-
if isinstance(request_options_provider, DefaultRequestOptionsProvider) and isinstance(partition_router, PartitionRouter):
3255+
if isinstance(request_options_provider, DefaultRequestOptionsProvider) and isinstance(
3256+
partition_router, PartitionRouter
3257+
):
32423258
request_options_provider = partition_router
32433259

32443260
paginator = (
@@ -3705,9 +3721,7 @@ def create_parent_stream_config_with_substream_wrapper(
37053721
self, model: ParentStreamConfigModel, config: Config, *, stream_name: str, **kwargs: Any
37063722
) -> Any:
37073723
# getting the parent state
3708-
child_state = self._connector_state_manager.get_stream_state(
3709-
stream_name, None
3710-
)
3724+
child_state = self._connector_state_manager.get_stream_state(stream_name, None)
37113725

37123726
# This flag will be used exclusively for StateDelegatingStream when a parent stream is created
37133727
has_parent_state = bool(

unit_tests/sources/declarative/incremental/test_concurrent_perpartitioncursor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,9 +2133,7 @@ def test_incremental_parent_state_migration(
21332133
"states": [
21342134
{
21352135
"partition": {"id": 1, "parent_slice": {}},
2136-
"cursor": {
2137-
"updated_at": START_DATE
2138-
},
2136+
"cursor": {"updated_at": START_DATE},
21392137
}
21402138
],
21412139
"lookback_window": 0,

unit_tests/sources/declarative/parsers/test_model_to_component_factory.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,12 +2106,20 @@ def test_custom_components_do_not_contain_extra_fields():
21062106
}
21072107

21082108
custom_substream_partition_router = factory.create_component(
2109-
CustomPartitionRouterModel, custom_substream_partition_router_manifest, input_config, stream_name="child_stream_name",
2109+
CustomPartitionRouterModel,
2110+
custom_substream_partition_router_manifest,
2111+
input_config,
2112+
stream_name="child_stream_name",
21102113
)
21112114
assert isinstance(custom_substream_partition_router, TestingCustomSubstreamPartitionRouter)
21122115

21132116
assert len(custom_substream_partition_router.parent_stream_configs) == 1
2114-
assert isinstance(custom_substream_partition_router.parent_stream_configs[0].stream.cursor._message_repository, StateFilteringMessageRepository)
2117+
assert isinstance(
2118+
custom_substream_partition_router.parent_stream_configs[
2119+
0
2120+
].stream.cursor._message_repository,
2121+
StateFilteringMessageRepository,
2122+
)
21152123
assert custom_substream_partition_router.parent_stream_configs[0].parent_key.eval({}) == "id"
21162124
assert (
21172125
custom_substream_partition_router.parent_stream_configs[0].partition_field.eval({})
@@ -2174,7 +2182,10 @@ def test_parse_custom_component_fields_if_subcomponent():
21742182
}
21752183

21762184
custom_substream_partition_router = factory.create_component(
2177-
CustomPartitionRouterModel, custom_substream_partition_router_manifest, input_config, stream_name="child_stream_name"
2185+
CustomPartitionRouterModel,
2186+
custom_substream_partition_router_manifest,
2187+
input_config,
2188+
stream_name="child_stream_name",
21782189
)
21792190
assert isinstance(custom_substream_partition_router, TestingCustomSubstreamPartitionRouter)
21802191
assert custom_substream_partition_router.custom_field == "here"

0 commit comments

Comments
 (0)