Skip to content

Commit

Permalink
fix: formatting issues (#8435)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmullapudi authored Dec 2, 2021
1 parent d12f919 commit 0fcc2dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
FulfilledShipmentsReports,
MerchantListingsReports,
Orders,
SellerFeedbackReports,
VendorDirectFulfillmentShipping,
VendorInventoryHealthReports,
SellerFeedbackReports,
)


Expand All @@ -41,7 +41,7 @@ class Config:
period_in_days: int = Field(
30,
description="Will be used for stream slicing for initial full_refresh sync when no updated state is present for reports that support sliced incremental sync.",
examples=["30", "365"]
examples=["30", "365"],
)
refresh_token: str = Field(
description="The refresh token used obtained via authorization (can be passed to the client instead)", airbyte_secret=True
Expand Down Expand Up @@ -84,7 +84,7 @@ def _get_stream_kwargs(self, config: ConnectorConfig) -> Mapping[str, Any]:
"aws_signature": aws_signature,
"replication_start_date": config.replication_start_date,
"marketplace_ids": [marketplace_id],
"period_in_days": config.period_in_days
"period_in_days": config.period_in_days,
}
return stream_kwargs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ class AmazonSPStream(HttpStream, ABC):
data_field = "payload"

def __init__(
self, url_base: str, aws_signature: AWSSignature, replication_start_date: str, marketplace_ids: List[str], period_in_days: Optional[int], *args, **kwargs
self,
url_base: str,
aws_signature: AWSSignature,
replication_start_date: str,
marketplace_ids: List[str],
period_in_days: Optional[int],
*args,
**kwargs,
):
super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -405,10 +412,7 @@ def get_updated_state(self, current_stream_state: MutableMapping[str, Any], late
return {self.cursor_field: latest_benchmark}

def stream_slices(
self,
sync_mode: SyncMode,
cursor_field: List[str] = None,
stream_state: Mapping[str, Any] = None
self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None
) -> Iterable[Optional[Mapping[str, Any]]]:

start_date = pendulum.parse(self._replication_start_date)
Expand All @@ -423,10 +427,12 @@ def stream_slices(

while start_date < end_date:
end_date_slice = start_date.add(days=self.period_in_days)
slices.append({
"dataStartTime": start_date.strftime(DATE_TIME_FORMAT),
"dataEndTime": min(end_date_slice.subtract(seconds=1), end_date).strftime(DATE_TIME_FORMAT)
})
slices.append(
{
"dataStartTime": start_date.strftime(DATE_TIME_FORMAT),
"dataEndTime": min(end_date_slice.subtract(seconds=1), end_date).strftime(DATE_TIME_FORMAT),
}
)
start_date = end_date_slice

return slices
Expand All @@ -438,7 +444,7 @@ class SellerFeedbackReports(IncrementalReportsAmazonSPStream):
"""

name = "GET_SELLER_FEEDBACK_DATA"
cursor_field = 'Date'
cursor_field = "Date"
transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization)

@transformer.registerCustomTransform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def reports_stream():
replication_start_date="2017-01-25T00:00:00Z",
marketplace_ids=["id"],
authenticator=NoAuth(),
period_in_days=0
period_in_days=0,
)
return stream

Expand Down

0 comments on commit 0fcc2dc

Please sign in to comment.