Skip to content

Commit 197a071

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent 568c50a commit 197a071

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,9 @@ def _migrate_state(self, config, model):
21252125
else:
21262126
state_transformations = []
21272127
stream_state = self.apply_stream_state_migrations(state_transformations, stream_state)
2128-
self._connector_state_manager.update_state_for_stream(stream_name=model.name, namespace=None, value=stream_state)
2128+
self._connector_state_manager.update_state_for_stream(
2129+
stream_name=model.name, namespace=None, value=stream_state
2130+
)
21292131

21302132
def _is_stop_condition_on_cursor(self, model: DeclarativeStreamModel) -> bool:
21312133
return bool(

unit_tests/sources/declarative/parsers/test_model_to_component_factory.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,9 +3542,13 @@ def test_create_default_stream_with_datetime_cursor_then_runs_state_migrations()
35423542
)
35433543
]
35443544
)
3545-
factory = ModelToComponentFactory(emit_connector_builder_messages=True, connector_state_manager=connector_state_manager)
3545+
factory = ModelToComponentFactory(
3546+
emit_connector_builder_messages=True, connector_state_manager=connector_state_manager
3547+
)
35463548
stream = factory.create_component(
3547-
model_type=DeclarativeStreamModel, component_definition=YamlDeclarativeSource._parse(content), config=input_config
3549+
model_type=DeclarativeStreamModel,
3550+
component_definition=YamlDeclarativeSource._parse(content),
3551+
config=input_config,
35483552
)
35493553
assert stream.cursor.state["states"] == [
35503554
{"cursor": {"updated_at": stream_state["updated_at"]}, "partition": {"type": "type_1"}},
@@ -3627,9 +3631,7 @@ def test_create_concurrent_cursor_from_perpartition_cursor_runs_state_migrations
36273631

36283632
stream_state = {
36293633
"state": {"updated_at": "2025-01-01T00:00:00.000000+00:00"},
3630-
"parent_state": {
3631-
"parent_stream": {"updated_at": "2025-01-01T00:00:00.000000+00:00"}
3632-
}
3634+
"parent_state": {"parent_stream": {"updated_at": "2025-01-01T00:00:00.000000+00:00"}},
36333635
}
36343636
connector_state_manager = ConnectorStateManager(
36353637
state=[
@@ -3642,14 +3644,19 @@ def test_create_concurrent_cursor_from_perpartition_cursor_runs_state_migrations
36423644
)
36433645
]
36443646
)
3645-
factory = ModelToComponentFactory(emit_connector_builder_messages=True,
3646-
connector_state_manager=connector_state_manager)
3647+
factory = ModelToComponentFactory(
3648+
emit_connector_builder_messages=True, connector_state_manager=connector_state_manager
3649+
)
36473650
stream = factory.create_component(
3648-
model_type=DeclarativeStreamModel, component_definition=YamlDeclarativeSource._parse(content),
3649-
config=input_config
3651+
model_type=DeclarativeStreamModel,
3652+
component_definition=YamlDeclarativeSource._parse(content),
3653+
config=input_config,
36503654
)
36513655
assert stream.cursor.state["lookback_window"] == 20
3652-
assert stream.cursor._partition_router.parent_stream_configs[0].stream.cursor.state["updated_at"] == "2024-02-01T00:00:00.000000+0000"
3656+
assert (
3657+
stream.cursor._partition_router.parent_stream_configs[0].stream.cursor.state["updated_at"]
3658+
== "2024-02-01T00:00:00.000000+0000"
3659+
)
36533660

36543661

36553662
def test_create_concurrent_cursor_uses_min_max_datetime_format_if_defined():

unit_tests/sources/declarative/parsers/testing_components.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
from dataclasses import dataclass, field
6-
from typing import ClassVar, List, Optional, Any, Mapping
6+
from typing import Any, ClassVar, List, Mapping, Optional
77

88
from airbyte_cdk.sources.declarative.extractors import DpathExtractor
99
from airbyte_cdk.sources.declarative.migrations.state_migration import StateMigration
@@ -78,5 +78,7 @@ def should_migrate(self, stream_state: Mapping[str, Any]) -> bool:
7878

7979
def migrate(self, stream_state: Mapping[str, Any]) -> Mapping[str, Any]:
8080
stream_state["lookback_window"] = 20
81-
stream_state["parent_state"]["parent_stream"] = {"updated_at": "2024-02-01T00:00:00.000000+00:00"}
81+
stream_state["parent_state"]["parent_stream"] = {
82+
"updated_at": "2024-02-01T00:00:00.000000+00:00"
83+
}
8284
return stream_state

0 commit comments

Comments
 (0)