Skip to content

Commit 1e0f777

Browse files
authored
chore: resolve ruff lint issues (#16)
1 parent f024c77 commit 1e0f777

File tree

8 files changed

+9
-47
lines changed

8 files changed

+9
-47
lines changed

airbyte_cdk/models/airbyte_protocol.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
from typing import Annotated, Any, Dict, List, Mapping, Optional, Union
77

88
from airbyte_cdk.models.file_transfer_record_message import AirbyteFileTransferRecordMessage
9-
from airbyte_protocol_dataclasses.models import *
9+
from airbyte_protocol_dataclasses.models import * # noqa: F403 # Allow '*'
1010
from serpyco_rs.metadata import Alias
1111

12+
# ruff: noqa: F405 # ignore fuzzy import issues with 'import *'
13+
1214

1315
@dataclass
1416
class AirbyteStateBlob:

airbyte_cdk/models/well_known_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
33
#
44

5-
from airbyte_protocol_dataclasses.models.well_known_types import *
5+
from airbyte_protocol_dataclasses.models.well_known_types import * # noqa: F403 # Allow '*'

airbyte_cdk/sources/declarative/datetime/min_max_datetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MinMaxDatetime:
3232
parameters: InitVar[Mapping[str, Any]]
3333
# datetime_format is a unique case where we inherit it from the parent if it is not specified before using the default value
3434
# which is why we need dedicated getter/setter methods and private dataclass field
35-
datetime_format: str = ""
35+
datetime_format: str
3636
_datetime_format: str = field(init=False, repr=False, default="")
3737
min_datetime: Union[InterpolatedString, str] = ""
3838
max_datetime: Union[InterpolatedString, str] = ""

airbyte_cdk/sources/file_based/file_types/csv_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,22 +362,22 @@ def _cast_types(
362362
else:
363363
warnings.append(_format_warning(key, value, prop_type))
364364

365-
elif python_type == bool:
365+
elif python_type is bool:
366366
try:
367367
cast_value = _value_to_bool(
368368
value, config_format.true_values, config_format.false_values
369369
)
370370
except ValueError:
371371
warnings.append(_format_warning(key, value, prop_type))
372372

373-
elif python_type == dict:
373+
elif python_type is dict:
374374
try:
375375
# we don't re-use _value_to_object here because we type the column as object as long as there is only one object
376376
cast_value = orjson.loads(value)
377377
except orjson.JSONDecodeError:
378378
warnings.append(_format_warning(key, value, prop_type))
379379

380-
elif python_type == list:
380+
elif python_type is list:
381381
try:
382382
cast_value = _value_to_list(value)
383383
except (ValueError, json.JSONDecodeError):

airbyte_cdk/sources/file_based/file_types/excel_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def dtype_to_json_type(current_type: Optional[str], dtype: dtype_) -> str:
151151
if current_type == "string":
152152
# Previous column values were of the string type, no need to look further.
153153
return current_type
154-
if dtype == object:
154+
if dtype is object:
155155
return "string"
156156
if dtype in number_types and (not current_type or current_type == "number"):
157157
return "number"

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ skip = ["__init__.py"] # TODO: Remove after this is fixed: https://github.com/a
104104
[tool.ruff]
105105
exclude = ["__init__.py"] # TODO: Remove after this is fixed: https://github.com/airbytehq/airbyte-python-cdk/issues/12
106106

107-
# Setting python version to at least 3.10 avoids `from __future__ import annotations`.
108107
target-version = "py310"
109-
# This is consistent with airbytehq/airbyte root pyproject.toml Black rule defined.
110108
line-length = 100
111109

112110
[tool.poe.tasks]

unit_tests/sources/streams/concurrent/test_concurrent_read_processor.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -735,35 +735,6 @@ def test_given_partition_completion_is_not_success_then_do_not_close_partition(s
735735

736736
assert self._an_open_partition.close.call_count == 0
737737

738-
def test_given_partition_completion_is_not_success_then_do_not_close_partition(self):
739-
stream_instances_to_read_from = [self._stream, self._another_stream]
740-
741-
handler = ConcurrentReadProcessor(
742-
stream_instances_to_read_from,
743-
self._partition_enqueuer,
744-
self._thread_pool_manager,
745-
self._logger,
746-
self._slice_logger,
747-
self._message_repository,
748-
self._partition_reader,
749-
)
750-
751-
handler.start_next_partition_generator()
752-
handler.on_partition(self._an_open_partition)
753-
list(
754-
handler.on_partition_generation_completed(
755-
PartitionGenerationCompletedSentinel(self._stream)
756-
)
757-
)
758-
759-
list(
760-
handler.on_partition_complete_sentinel(
761-
PartitionCompleteSentinel(self._an_open_partition, not _IS_SUCCESSFUL)
762-
)
763-
)
764-
765-
assert self._an_open_partition.close.call_count == 0
766-
767738
def test_is_done_is_false_if_there_are_any_instances_to_read_from(self):
768739
stream_instances_to_read_from = [self._stream]
769740

unit_tests/test/mock_http/test_mocker.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,6 @@ def decorated_function(http_mocker):
266266
with pytest.raises(ValueError):
267267
decorated_function()
268268

269-
def test_given_unknown_request_when_assert_number_of_calls_then_raise(self):
270-
@HttpMocker()
271-
def decorated_function(http_mocker):
272-
http_mocker.get(HttpRequest(_A_URL), _A_RESPONSE)
273-
http_mocker.assert_number_of_calls(HttpRequest(_ANOTHER_URL), 1)
274-
275-
with pytest.raises(ValueError):
276-
decorated_function()
277-
278269
def test_given_request_already_mocked_when_decorate_then_raise(self):
279270
with HttpMocker() as http_mocker:
280271
a_request = HttpRequest(_A_URL, _SOME_QUERY_PARAMS, _SOME_HEADERS)

0 commit comments

Comments
 (0)