Skip to content

Commit

Permalink
Auto-fix lint and format issues
Browse files Browse the repository at this point in the history
  • Loading branch information
octavia-squidington-iii committed Nov 13, 2024
1 parent 8e7242f commit 4bb8f12
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
16 changes: 12 additions & 4 deletions airbyte_cdk/sources/declarative/decoders/json_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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()}

Expand All @@ -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():
Expand All @@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4bb8f12

Please sign in to comment.