Skip to content

Commit fc6c6b6

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent b4a5fec commit fc6c6b6

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

airbyte_cdk/sources/declarative/checks/check_stream.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
from dataclasses import InitVar, dataclass
88
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
99

10-
from airbyte_cdk.sources.streams.core import Stream
1110
from airbyte_cdk.sources.abstract_source import AbstractSource
1211
from airbyte_cdk.sources.declarative.checks.connection_checker import ConnectionChecker
1312
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
13+
from airbyte_cdk.sources.streams.core import Stream
1414
from airbyte_cdk.sources.streams.http.availability_strategy import HttpAvailabilityStrategy
1515

1616

17-
def evaluate_availability(stream: Union[Stream, AbstractStream], logger: logging.Logger) -> Tuple[bool, Optional[str]]:
17+
def evaluate_availability(
18+
stream: Union[Stream, AbstractStream], logger: logging.Logger
19+
) -> Tuple[bool, Optional[str]]:
1820
"""
1921
As a transition period, we want to support both Stream and AbstractStream until we migrate everything to AbstractStream.
2022
"""
@@ -97,7 +99,10 @@ def check_connection(
9799
return True, None
98100

99101
def _check_stream_availability(
100-
self, stream_name_to_stream: Dict[str, Union[Stream, AbstractStream]], stream_name: str, logger: logging.Logger
102+
self,
103+
stream_name_to_stream: Dict[str, Union[Stream, AbstractStream]],
104+
stream_name: str,
105+
logger: logging.Logger,
101106
) -> Tuple[bool, Any]:
102107
"""Checks if streams are available."""
103108
try:
@@ -112,7 +117,10 @@ def _check_stream_availability(
112117
return True, None
113118

114119
def _check_dynamic_streams_availability(
115-
self, source: AbstractSource, stream_name_to_stream: Dict[str, Union[Stream, AbstractStream]], logger: logging.Logger
120+
self,
121+
source: AbstractSource,
122+
stream_name_to_stream: Dict[str, Union[Stream, AbstractStream]],
123+
logger: logging.Logger,
116124
) -> Tuple[bool, Any]:
117125
"""Checks the availability of dynamic streams."""
118126
dynamic_streams = source.resolved_manifest.get("dynamic_streams", []) # type: ignore[attr-defined] # The source's resolved_manifest manifest is checked before calling this method

airbyte_cdk/sources/streams/concurrent/availability_strategy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class StreamAvailability:
10-
1110
@classmethod
1211
def available(cls) -> "StreamAvailability":
1312
return cls(True)

airbyte_cdk/sources/streams/concurrent/default_stream.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717

1818
class DefaultStream(AbstractStream):
19-
2019
def __init__(
2120
self,
2221
partition_generator: PartitionGenerator,

unit_tests/sources/declarative/checks/test_check_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
from airbyte_cdk.sources.declarative.concurrent_declarative_source import (
1717
ConcurrentDeclarativeSource,
1818
)
19-
from airbyte_cdk.sources.streams.http import HttpStream
2019
from airbyte_cdk.sources.streams.core import Stream
20+
from airbyte_cdk.sources.streams.http import HttpStream
2121
from airbyte_cdk.test.mock_http import HttpMocker, HttpRequest, HttpResponse
2222

2323
logger = logging.getLogger("test")

unit_tests/sources/streams/concurrent/test_default_stream.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,22 @@ def test_given_no_partitions_when_get_availability_then_unavailable(self) -> Non
259259
assert availability.is_available == False
260260
assert "no stream slices were found" in availability.reason
261261

262-
def test_given_AirbyteTracedException_when_generating_partitions_when_get_availability_then_unavailable(self) -> None:
262+
def test_given_AirbyteTracedException_when_generating_partitions_when_get_availability_then_unavailable(
263+
self,
264+
) -> None:
263265
error_message = "error while generating partitions"
264-
self._partition_generator.generate.side_effect = AirbyteTracedException(message=error_message)
266+
self._partition_generator.generate.side_effect = AirbyteTracedException(
267+
message=error_message
268+
)
265269

266270
availability = self._stream.check_availability()
267271

268272
assert availability.is_available == False
269273
assert error_message in availability.reason
270274

271-
def test_given_unknown_error_when_generating_partitions_when_get_availability_then_raise(self) -> None:
275+
def test_given_unknown_error_when_generating_partitions_when_get_availability_then_raise(
276+
self,
277+
) -> None:
272278
"""
273279
I'm not sure why we handle AirbyteTracedException but not other exceptions but this is to keep feature compatibility with HttpAvailabilityStrategy
274280
"""
@@ -292,7 +298,9 @@ def test_given_records_when_get_availability_then_available(self) -> None:
292298

293299
assert availability.is_available == True
294300

295-
def test_given_AirbyteTracedException_when_reading_records_when_get_availability_then_unavailable(self) -> None:
301+
def test_given_AirbyteTracedException_when_reading_records_when_get_availability_then_unavailable(
302+
self,
303+
) -> None:
296304
self._partition_generator.generate.return_value = [self._partition]
297305
error_message = "error while reading records"
298306
self._partition.read.side_effect = AirbyteTracedException(message=error_message)

0 commit comments

Comments
 (0)