Skip to content

Commit

Permalink
correct CI applying gradlew format (airbytehq#6390)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcos Marx <marcosmarx@MacBook-Pro-de-Marcos.local>
  • Loading branch information
marcosmarxm and Marcos Marx authored Sep 23, 2021
1 parent 98b1900 commit 5861b6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions airbyte-cdk/python/airbyte_cdk/sources/streams/http/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import requests
import vcr
import vcr.cassette as Cassette

from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.streams.core import Stream
from requests.auth import AuthBase
Expand Down Expand Up @@ -71,7 +70,7 @@ def cache_filename(self):
"""
Override if needed. Return the name of cache file
"""
return f'{self.name}.yml'
return f"{self.name}.yml"

@property
def use_cache(self):
Expand Down Expand Up @@ -382,7 +381,6 @@ def read_records(


class HttpSubStream(HttpStream, ABC):

def __init__(self, parent: HttpStream, **kwargs):
"""
:param parent: should be the instance of HttpStream class
Expand All @@ -394,18 +392,13 @@ def stream_slices(
self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None
) -> Iterable[Optional[Mapping[str, Any]]]:
parent_stream_slices = self.parent.stream_slices(
sync_mode=SyncMode.full_refresh,
cursor_field=cursor_field,
stream_state=stream_state
sync_mode=SyncMode.full_refresh, cursor_field=cursor_field, stream_state=stream_state
)

# iterate over all parent stream_slices
for stream_slice in parent_stream_slices:
parent_records = self.parent.read_records(
sync_mode=SyncMode.full_refresh,
cursor_field=cursor_field,
stream_slice=stream_slice,
stream_state=stream_state
sync_mode=SyncMode.full_refresh, cursor_field=cursor_field, stream_slice=stream_slice, stream_state=stream_state
)

# iterate over all parent records with current stream_slice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,12 @@ def test_cache_response(mocker):
mocker.patch.object(stream, "url_base", "https://google.com/")
list(stream.read_records(sync_mode=SyncMode.full_refresh))

with open(stream.cache_filename, 'r') as f:
with open(stream.cache_filename, "r") as f:
assert f.read()


class CacheHttpStreamWithSlices(CacheHttpStream):
paths = ['', 'search']
paths = ["", "search"]

def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str:
return f'{stream_slice.get("path")}'
Expand Down

0 comments on commit 5861b6f

Please sign in to comment.