Skip to content

Commit c8f2042

Browse files
committed
format fixes
1 parent d6b8277 commit c8f2042

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

airbyte-integrations/connectors/source-orb/source_orb/source.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
33
#
44

5-
import re
65
from abc import ABC
76
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple
87

@@ -327,7 +326,7 @@ def request_params(self, stream_state: Mapping[str, Any], stream_slice: Mapping[
327326
params = {
328327
"granularity": "day",
329328
"timeframe_start": to_utc_isoformat(stream_slice["timeframe_start"]),
330-
"timeframe_end": to_utc_isoformat(stream_slice["timeframe_end"])
329+
"timeframe_end": to_utc_isoformat(stream_slice["timeframe_end"]),
331330
}
332331

333332
if self.subscription_usage_grouping_key:
@@ -416,7 +415,11 @@ def stream_slices(self, stream_state: Mapping[str, Any] = None, **kwargs) -> Ite
416415

417416
# create one slice for each day of usage between the start and end date
418417
for period in chunk_date_range(start_date=start_date, end_date=end_date):
419-
slice = {"subscription_id": subscription_id, "timeframe_start": to_utc_isoformat(period.start), "timeframe_end": to_utc_isoformat(period.end)}
418+
slice = {
419+
"subscription_id": subscription_id,
420+
"timeframe_start": to_utc_isoformat(period.start),
421+
"timeframe_end": to_utc_isoformat(period.end),
422+
}
420423

421424
# if using a group_by key, yield one slice per billable_metric_id.
422425
# otherwise, yield slices without a billable_metric_id because

airbyte-integrations/connectors/source-orb/unit_tests/test_incremental_streams.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import responses
99
from airbyte_cdk.models import SyncMode
1010
from pytest import fixture
11-
from source_orb.source import CreditsLedgerEntries, Customers, IncrementalOrbStream, OrbStream, Subscriptions, SubscriptionUsage, Plans
11+
from source_orb.source import CreditsLedgerEntries, Customers, IncrementalOrbStream, OrbStream, Plans, Subscriptions, SubscriptionUsage
1212

1313

1414
@fixture
@@ -326,7 +326,7 @@ def test_subscription_usage_stream_slices(mocker):
326326
Subscriptions, "read_records", return_value=iter([
327327
{"id": "1", "plan_id": "2"},
328328
{"id": "11", "plan_id": "2"},
329-
{"id": "111", "plan_id": "3"} # should be ignored because plan_id set to 2
329+
{"id": "111", "plan_id": "3"} # should be ignored because plan_id set to 2
330330
])
331331
)
332332
stream = SubscriptionUsage(plan_id="2", start_date="2022-01-25T12:00:00+00:00", end_date="2022-01-26T12:00:00+00:00")
@@ -343,7 +343,7 @@ def test_subscription_usage_stream_slices_with_grouping_key(mocker):
343343
Subscriptions, "read_records", return_value=iter([
344344
{"id": "1", "plan_id": "2"},
345345
{"id": "11", "plan_id": "2"},
346-
{"id": "111", "plan_id": "3"} # should be ignored because plan_id set to 2
346+
{"id": "111", "plan_id": "3"} # should be ignored because plan_id set to 2
347347
])
348348
)
349349

@@ -353,7 +353,7 @@ def test_subscription_usage_stream_slices_with_grouping_key(mocker):
353353
{"billable_metric": {"id": "billableMetricIdA"}},
354354
{"billable_metric": {"id": "billableMetricIdB"}}
355355
]},
356-
{"id": "3", "prices": [ # should be ignored because plan_id is set to 2
356+
{"id": "3", "prices": [ # should be ignored because plan_id is set to 2
357357
{"billable_metric": {"id": "billableMetricIdC"}}
358358
]}
359359
])
@@ -374,7 +374,6 @@ def test_subscription_usage_stream_slices_with_grouping_key(mocker):
374374
assert list(stream.stream_slices(**inputs)) == expected_stream_slice
375375

376376

377-
378377
@pytest.mark.parametrize(
379378
("current_stream_state", "current_stream_slice", "grouping_key"),
380379
[
@@ -499,6 +498,7 @@ def test_subscription_usage_yield_transformed_subrecords(mocker):
499498

500499
assert actual_output == expected
501500

501+
502502
def test_subscription_usage_yield_transformed_subrecords_with_grouping(mocker):
503503
stream = SubscriptionUsage(start_date="2022-01-25T12:00:00+00:00", end_date="2022-01-26T12:00:00+00:00", subscription_usage_grouping_key="grouping_key")
504504

@@ -567,6 +567,7 @@ def test_subscription_usage_yield_transformed_subrecords_with_grouping(mocker):
567567

568568
assert actual_output == expected
569569

570+
570571
def test_supports_incremental(patch_incremental_base_class, mocker):
571572
mocker.patch.object(IncrementalOrbStream, "cursor_field", "dummy_field")
572573
stream = IncrementalOrbStream()

airbyte-integrations/connectors/source-orb/unit_tests/test_streams.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_credit_ledger_entries_schema(patch_base_class, mocker, event_properties
7171
for property_key in event_properties_keys:
7272
assert property_key in json_schema["properties"]["event"]["properties"]["properties"]["properties"]
7373

74+
7475
@pytest.mark.parametrize("group_by_key", ["foo-key", None])
7576
def test_subscription_usage_schema(patch_base_class, mocker, group_by_key):
7677
stream = SubscriptionUsage(subscription_usage_grouping_key=group_by_key)

0 commit comments

Comments
 (0)