diff --git a/airbyte_cdk/sources/declarative/decoders/json_decoder.py b/airbyte_cdk/sources/declarative/decoders/json_decoder.py index a0690461d..79c9613fb 100644 --- a/airbyte_cdk/sources/declarative/decoders/json_decoder.py +++ b/airbyte_cdk/sources/declarative/decoders/json_decoder.py @@ -25,7 +25,9 @@ class JsonDecoder(Decoder): def is_stream_response(self) -> bool: return False - def decode(self, response: requests.Response) -> Generator[MutableMapping[str, Any], None, None]: + def decode( + self, response: requests.Response + ) -> Generator[MutableMapping[str, Any], None, None]: """ Given the response is an empty string or an emtpy list, the function will return a generator with an empty mapping. """ @@ -61,7 +63,9 @@ class IterableDecoder(Decoder): def is_stream_response(self) -> bool: return True - def decode(self, response: requests.Response) -> Generator[MutableMapping[str, Any], None, None]: + def decode( + self, response: requests.Response + ) -> Generator[MutableMapping[str, Any], None, None]: for line in response.iter_lines(): yield {"record": line.decode()} @@ -77,7 +81,9 @@ class JsonlDecoder(Decoder): def is_stream_response(self) -> bool: return True - def decode(self, response: requests.Response) -> Generator[MutableMapping[str, Any], None, None]: + def decode( + self, response: requests.Response + ) -> Generator[MutableMapping[str, Any], None, None]: # TODO???: set delimiter? usually it is `\n` but maybe it would be useful to set optional? # https://github.com/airbytehq/airbyte-internal-issues/issues/8436 for record in response.iter_lines(): @@ -88,6 +94,8 @@ def decode(self, response: requests.Response) -> Generator[MutableMapping[str, A class GzipJsonDecoder(JsonDecoder): encoding: Optional[str] = "utf-8" - def decode(self, response: requests.Response) -> Generator[MutableMapping[str, Any], None, None]: + def decode( + self, response: requests.Response + ) -> Generator[MutableMapping[str, Any], None, None]: raw_string = decompress(response.content).decode(encoding=self.encoding) yield from self.parse_body_json(orjson.loads(raw_string)) diff --git a/airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py b/airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py index 3b4ce5754..0c30993c1 100644 --- a/airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py +++ b/airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py @@ -4,7 +4,12 @@ from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString from airbyte_cdk.sources.declarative.migrations.state_migration import StateMigration -from airbyte_cdk.sources.declarative.models import DatetimeBasedCursor, SubstreamPartitionRouter, CustomPartitionRouter, CustomIncrementalSync +from airbyte_cdk.sources.declarative.models import ( + DatetimeBasedCursor, + SubstreamPartitionRouter, + CustomPartitionRouter, + CustomIncrementalSync, +) from airbyte_cdk.sources.declarative.models.declarative_component_schema import ParentStreamConfig diff --git a/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py b/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py index 60e4dc3ec..d2929053f 100644 --- a/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +++ b/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py @@ -632,7 +632,7 @@ def create_legacy_to_per_partition_state_migration( partition_router, declarative_stream.incremental_sync, # type: ignore # was already checked. Migration can be applied only to incremental streams. config, - declarative_stream.parameters, # type: ignore + declarative_stream.parameters, # type: ignore ) # type: ignore # The retriever type was already checked def create_session_token_authenticator(