From 68e3d3251054da90b084551a780abfd37337278e Mon Sep 17 00:00:00 2001 From: pnilan Date: Wed, 6 Nov 2024 15:21:33 -0800 Subject: [PATCH] chore: format code --- .../source-hubspot/source_hubspot/components.py | 12 ++++++++---- .../source-hubspot/source_hubspot/streams.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py b/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py index dff2ac9e161f..1b52d50b120e 100644 --- a/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py +++ b/airbyte-integrations/connectors/source-hubspot/source_hubspot/components.py @@ -7,17 +7,21 @@ from airbyte_cdk.sources.declarative.transformations import RecordTransformation from airbyte_cdk.sources.types import Config, StreamSlice, StreamState - NEW_TO_LEGACY_FIELDS_MAPPING = { "hs_lifecyclestage_": "hs_v2_date_entered_", "hs_date_entered_": "hs_v2_date_entered_", "hs_date_exited_": "hs_v2_date_exited_", - "hs_time_in_": "h2_v2_latest_time_in_" + "hs_time_in_": "h2_v2_latest_time_in_", } -class NewToLegacyFieldTransformation(RecordTransformation): - def transform(self, record: Dict[str, Any], config: Optional[Config] = None, stream_state: Optional[StreamState] = None, stream_slice: Optional[StreamSlice] = None, +class NewToLegacyFieldTransformation(RecordTransformation): + def transform( + self, + record: Dict[str, Any], + config: Optional[Config] = None, + stream_state: Optional[StreamState] = None, + stream_slice: Optional[StreamSlice] = None, ) -> Mapping[str, Any]: updated_record = copy.deepcopy(record) for field_name, field_value in record.get("properties", {}).items(): diff --git a/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py b/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py index 6bddeb354311..6f9b76b69634 100644 --- a/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py +++ b/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py @@ -18,6 +18,7 @@ from airbyte_cdk.entrypoint import logger from airbyte_cdk.models import FailureType, SyncMode from airbyte_cdk.sources import Source +from airbyte_cdk.sources.declarative.transformations import RecordTransformation from airbyte_cdk.sources.streams import CheckpointMixin, Stream from airbyte_cdk.sources.streams.availability_strategy import AvailabilityStrategy from airbyte_cdk.sources.streams.core import StreamData @@ -29,6 +30,7 @@ from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer from airbyte_cdk.utils import AirbyteTracedException from requests import HTTPError, codes +from source_hubspot.components import NewToLegacyFieldTransformation from source_hubspot.constants import OAUTH_CREDENTIALS, PRIVATE_APP_CREDENTIALS from source_hubspot.errors import HubspotAccessDenied, HubspotInvalidAuth, HubspotRateLimited, HubspotTimeout, InvalidStartDateConfigError from source_hubspot.helpers import ( @@ -41,8 +43,6 @@ IURLPropertyRepresentation, StoreAsIs, ) -from source_hubspot.components import NewToLegacyFieldTransformation -from airbyte_cdk.sources.declarative.transformations import RecordTransformation # we got this when provided API Token has incorrect format CLOUDFLARE_ORIGIN_DNS_ERROR = 530