Skip to content

Commit

Permalink
style: fix formatting and linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-ai-integration[bot] and natikgadzhi committed Feb 7, 2025
1 parent 9b439fd commit e1907ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions airbyte_cdk/sources/declarative/decoders/csv_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def decode(
return

# First validate CSV structure
lines = response.text.strip().split('\n')
lines = response.text.strip().split("\n")
if not lines:
yield {}
return
Expand All @@ -55,7 +55,7 @@ def decode(
iterator=True,
dtype=object,
delimiter=self.delimiter,
encoding=self.encoding
encoding=self.encoding,
)
except (pd.errors.EmptyDataError, pd.errors.ParserError):
yield {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
from airbyte_cdk.sources.declarative.datetime import MinMaxDatetime
from airbyte_cdk.sources.declarative.declarative_stream import DeclarativeStream
from airbyte_cdk.sources.declarative.decoders import (
CsvDecoder,
Decoder,
GzipJsonDecoder,
IterableDecoder,
JsonDecoder,
JsonlDecoder,
PaginationDecoderDecorator,
XmlDecoder,
CsvDecoder,
ZipfileDecoder,
)
from airbyte_cdk.sources.declarative.decoders.composite_raw_decoder import (
Expand Down Expand Up @@ -155,6 +155,9 @@
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
ConstantBackoffStrategy as ConstantBackoffStrategyModel,
)
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
CsvDecoder as CsvDecoderModel,
)
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
CsvParser as CsvParserModel,
)
Expand Down Expand Up @@ -367,9 +370,6 @@
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
XmlDecoder as XmlDecoderModel,
)
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
CsvDecoder as CsvDecoderModel,
)
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
ZipfileDecoder as ZipfileDecoderModel,
)
Expand Down
6 changes: 5 additions & 1 deletion unit_tests/sources/declarative/decoders/test_csv_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
("name;age\nJohn;30", [{"name": "John", "age": "30"}], ";"),
("", [{}], ","), # Empty response
("invalid,csv,data\nno,columns", [{}], ","), # Malformed CSV
("name,age\nJohn,30\nJane,25", [{"name": "John", "age": "30"}, {"name": "Jane", "age": "25"}], ","), # Multiple rows
(
"name,age\nJohn,30\nJane,25",
[{"name": "John", "age": "30"}, {"name": "Jane", "age": "25"}],
",",
), # Multiple rows
],
)
def test_csv_decoder(requests_mock, response_body, expected, delimiter):
Expand Down

0 comments on commit e1907ff

Please sign in to comment.