Skip to content

Commit

Permalink
Composite Decoder: fmt mypy
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
  • Loading branch information
artem1205 committed Dec 19, 2024
1 parent 1984ef1 commit 8d3f82a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions airbyte_cdk/sources/declarative/decoders/composite_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def parse(
) -> Generator[MutableMapping[str, Any], None, None]:
for line in data:
try:
yield json.loads(line.decode(self.encoding))
yield json.loads(line.decode(encoding=self.encoding))
except json.JSONDecodeError:
logger.warning(f"Cannot decode/parse line {line} as JSON")
logger.warning(f"Cannot decode/parse line {line!r} as JSON")
# Handle invalid JSON lines gracefully (e.g., log and skip)
pass

Expand All @@ -73,7 +73,9 @@ def parse(
"""
Parse CSV data from decompressed bytes.
"""
reader = pd.read_csv(data, sep=self.delimiter, iterator=True, dtype=object)
reader = pd.read_csv(
data, sep=self.delimiter, iterator=True, dtype=object, encoding=self.encoding
)
for chunk in reader:
chunk = chunk.replace({nan: None}).to_dict(orient="records")
for row in chunk:
Expand Down

0 comments on commit 8d3f82a

Please sign in to comment.