Skip to content

Commit 2a34b81

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent 1953fba commit 2a34b81

File tree

5 files changed

+97
-97
lines changed

5 files changed

+97
-97
lines changed

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,7 @@ class OAuthAuthenticator(BaseModel):
604604
scopes: Optional[List[str]] = Field(
605605
None,
606606
description="List of scopes that should be granted to the access token.",
607-
examples=[
608-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
609-
],
607+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
610608
title="Scopes",
611609
)
612610
token_expiry_date: Optional[str] = Field(
@@ -1000,28 +998,24 @@ class OAuthConfigSpecification(BaseModel):
1000998
class Config:
1001999
extra = Extra.allow
10021000

1003-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1004-
Field(
1005-
None,
1006-
description="OAuth specific blob. This is a Json Schema used to validate Json configurations used as input to OAuth.\nMust be a valid non-nested JSON that refers to properties from ConnectorSpecification.connectionSpecification\nusing special annotation 'path_in_connector_config'.\nThese are input values the user is entering through the UI to authenticate to the connector, that might also shared\nas inputs for syncing data via the connector.\nExamples:\nif no connector values is shared during oauth flow, oauth_user_input_from_connector_config_specification=[]\nif connector values such as 'app_id' inside the top level are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['app_id']\n }\n }\nif connector values such as 'info.app_id' nested inside another object are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['info', 'app_id']\n }\n }",
1007-
examples=[
1008-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1009-
{
1010-
"app_id": {
1011-
"type": "string",
1012-
"path_in_connector_config": ["info", "app_id"],
1013-
}
1014-
},
1015-
],
1016-
title="OAuth user input",
1017-
)
1001+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1002+
None,
1003+
description="OAuth specific blob. This is a Json Schema used to validate Json configurations used as input to OAuth.\nMust be a valid non-nested JSON that refers to properties from ConnectorSpecification.connectionSpecification\nusing special annotation 'path_in_connector_config'.\nThese are input values the user is entering through the UI to authenticate to the connector, that might also shared\nas inputs for syncing data via the connector.\nExamples:\nif no connector values is shared during oauth flow, oauth_user_input_from_connector_config_specification=[]\nif connector values such as 'app_id' inside the top level are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['app_id']\n }\n }\nif connector values such as 'info.app_id' nested inside another object are used to generate the API url for the oauth flow,\n oauth_user_input_from_connector_config_specification={\n app_id: {\n type: string\n path_in_connector_config: ['info', 'app_id']\n }\n }",
1004+
examples=[
1005+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1006+
{
1007+
"app_id": {
1008+
"type": "string",
1009+
"path_in_connector_config": ["info", "app_id"],
1010+
}
1011+
},
1012+
],
1013+
title="OAuth user input",
10181014
)
1019-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1020-
Field(
1021-
None,
1022-
description='The DeclarativeOAuth specific blob.\nPertains to the fields defined by the connector relating to the OAuth flow.\n\nInterpolation capabilities:\n- The variables placeholders are declared as `{{my_var}}`.\n- The nested resolution variables like `{{ {{my_nested_var}} }}` is allowed as well.\n\n- The allowed interpolation context is:\n + base64Encoder - encode to `base64`, {{ {{my_var_a}}:{{my_var_b}} | base64Encoder }}\n + base64Decorer - decode from `base64` encoded string, {{ {{my_string_variable_or_string_value}} | base64Decoder }}\n + urlEncoder - encode the input string to URL-like format, {{ https://test.host.com/endpoint | urlEncoder}}\n + urlDecorer - decode the input url-encoded string into text format, {{ urlDecoder:https%3A%2F%2Fairbyte.io | urlDecoder}}\n + codeChallengeS256 - get the `codeChallenge` encoded value to provide additional data-provider specific authorisation values, {{ {{state_value}} | codeChallengeS256 }}\n\nExamples:\n - The TikTok Marketing DeclarativeOAuth spec:\n {\n "oauth_connector_input_specification": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "consent_url": "https://ads.tiktok.com/marketing_api/auth?{{client_id_key}}={{client_id_value}}&{{redirect_uri_key}}={{ {{redirect_uri_value}} | urlEncoder}}&{{state_key}}={{state_value}}",\n "access_token_url": "https://business-api.tiktok.com/open_api/v1.3/oauth2/access_token/",\n "access_token_params": {\n "{{ auth_code_key }}": "{{ auth_code_value }}",\n "{{ client_id_key }}": "{{ client_id_value }}",\n "{{ client_secret_key }}": "{{ client_secret_value }}"\n },\n "access_token_headers": {\n "Content-Type": "application/json",\n "Accept": "application/json"\n },\n "extract_output": ["data.access_token"],\n "client_id_key": "app_id",\n "client_secret_key": "secret",\n "auth_code_key": "auth_code"\n }\n }\n }',
1023-
title="DeclarativeOAuth Connector Specification",
1024-
)
1015+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1016+
None,
1017+
description='The DeclarativeOAuth specific blob.\nPertains to the fields defined by the connector relating to the OAuth flow.\n\nInterpolation capabilities:\n- The variables placeholders are declared as `{{my_var}}`.\n- The nested resolution variables like `{{ {{my_nested_var}} }}` is allowed as well.\n\n- The allowed interpolation context is:\n + base64Encoder - encode to `base64`, {{ {{my_var_a}}:{{my_var_b}} | base64Encoder }}\n + base64Decorer - decode from `base64` encoded string, {{ {{my_string_variable_or_string_value}} | base64Decoder }}\n + urlEncoder - encode the input string to URL-like format, {{ https://test.host.com/endpoint | urlEncoder}}\n + urlDecorer - decode the input url-encoded string into text format, {{ urlDecoder:https%3A%2F%2Fairbyte.io | urlDecoder}}\n + codeChallengeS256 - get the `codeChallenge` encoded value to provide additional data-provider specific authorisation values, {{ {{state_value}} | codeChallengeS256 }}\n\nExamples:\n - The TikTok Marketing DeclarativeOAuth spec:\n {\n "oauth_connector_input_specification": {\n "type": "object",\n "additionalProperties": false,\n "properties": {\n "consent_url": "https://ads.tiktok.com/marketing_api/auth?{{client_id_key}}={{client_id_value}}&{{redirect_uri_key}}={{ {{redirect_uri_value}} | urlEncoder}}&{{state_key}}={{state_value}}",\n "access_token_url": "https://business-api.tiktok.com/open_api/v1.3/oauth2/access_token/",\n "access_token_params": {\n "{{ auth_code_key }}": "{{ auth_code_value }}",\n "{{ client_id_key }}": "{{ client_id_value }}",\n "{{ client_secret_key }}": "{{ client_secret_value }}"\n },\n "access_token_headers": {\n "Content-Type": "application/json",\n "Accept": "application/json"\n },\n "extract_output": ["data.access_token"],\n "client_id_key": "app_id",\n "client_secret_key": "secret",\n "auth_code_key": "auth_code"\n }\n }\n }',
1018+
title="DeclarativeOAuth Connector Specification",
10251019
)
10261020
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
10271021
None,
@@ -1039,9 +1033,7 @@ class Config:
10391033
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
10401034
None,
10411035
description="OAuth specific blob. This is a Json Schema used to validate Json configurations persisted as Airbyte Server configurations.\nMust be a valid non-nested JSON describing additional fields configured by the Airbyte Instance or Workspace Admins to be used by the\nserver when completing an OAuth flow (typically exchanging an auth code for refresh token).\nExamples:\n complete_oauth_server_input_specification={\n client_id: {\n type: string\n },\n client_secret: {\n type: string\n }\n }",
1042-
examples=[
1043-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1044-
],
1036+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
10451037
title="OAuth input specification",
10461038
)
10471039
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1627,9 +1619,7 @@ class RecordSelector(BaseModel):
16271619
description="Responsible for filtering records to be emitted by the Source.",
16281620
title="Record Filter",
16291621
)
1630-
schema_normalization: Optional[
1631-
Union[SchemaNormalization, CustomSchemaNormalization]
1632-
] = Field(
1622+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
16331623
SchemaNormalization.None_,
16341624
description="Responsible for normalization according to the schema.",
16351625
title="Schema Normalization",
@@ -1803,16 +1793,12 @@ class Config:
18031793
description="Component used to coordinate how records are extracted across stream slices and request pages.",
18041794
title="Retriever",
18051795
)
1806-
incremental_sync: Optional[Union[CustomIncrementalSync, DatetimeBasedCursor]] = (
1807-
Field(
1808-
None,
1809-
description="Component used to fetch data incrementally based on a time field in the data.",
1810-
title="Incremental Sync",
1811-
)
1812-
)
1813-
name: Optional[str] = Field(
1814-
"", description="The stream name.", example=["Users"], title="Name"
1796+
incremental_sync: Optional[Union[CustomIncrementalSync, DatetimeBasedCursor]] = Field(
1797+
None,
1798+
description="Component used to fetch data incrementally based on a time field in the data.",
1799+
title="Incremental Sync",
18151800
)
1801+
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
18161802
primary_key: Optional[PrimaryKey] = Field(
18171803
"", description="The primary key of the stream.", title="Primary Key"
18181804
)
@@ -2133,11 +2119,7 @@ class SimpleRetriever(BaseModel):
21332119
CustomPartitionRouter,
21342120
ListPartitionRouter,
21352121
SubstreamPartitionRouter,
2136-
List[
2137-
Union[
2138-
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
2139-
]
2140-
],
2122+
List[Union[CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter]],
21412123
]
21422124
] = Field(
21432125
[],
@@ -2181,9 +2163,7 @@ class AsyncRetriever(BaseModel):
21812163
)
21822164
download_extractor: Optional[
21832165
Union[CustomRecordExtractor, DpathExtractor, ResponseToFileExtractor]
2184-
] = Field(
2185-
None, description="Responsible for fetching the records from provided urls."
2186-
)
2166+
] = Field(None, description="Responsible for fetching the records from provided urls.")
21872167
creation_requester: Union[CustomRequester, HttpRequester] = Field(
21882168
...,
21892169
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",
@@ -2217,11 +2197,7 @@ class AsyncRetriever(BaseModel):
22172197
CustomPartitionRouter,
22182198
ListPartitionRouter,
22192199
SubstreamPartitionRouter,
2220-
List[
2221-
Union[
2222-
CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter
2223-
]
2224-
],
2200+
List[Union[CustomPartitionRouter, ListPartitionRouter, SubstreamPartitionRouter]],
22252201
]
22262202
] = Field(
22272203
[],
@@ -2289,12 +2265,10 @@ class DynamicDeclarativeStream(BaseModel):
22892265
stream_template: DeclarativeStream = Field(
22902266
..., description="Reference to the stream template.", title="Stream Template"
22912267
)
2292-
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = (
2293-
Field(
2294-
...,
2295-
description="Component resolve and populates stream templates with components values.",
2296-
title="Components Resolver",
2297-
)
2268+
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = Field(
2269+
...,
2270+
description="Component resolve and populates stream templates with components values.",
2271+
title="Components Resolver",
22982272
)
22992273

23002274

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@
244244
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
245245
InlineSchemaLoader as InlineSchemaLoaderModel,
246246
)
247+
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
248+
ItemsTypeMap as ItemsTypeMapModel,
249+
)
247250
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
248251
IterableDecoder as IterableDecoderModel,
249252
)
@@ -310,6 +313,9 @@
310313
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
311314
ParentStreamConfig as ParentStreamConfigModel,
312315
)
316+
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
317+
PropertyTypesMap as PropertyTypesMapModel,
318+
)
313319
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
314320
RecordFilter as RecordFilterModel,
315321
)
@@ -353,12 +359,6 @@
353359
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
354360
TypesMap as TypesMapModel,
355361
)
356-
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
357-
PropertyTypesMap as PropertyTypesMapModel,
358-
)
359-
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
360-
ItemsTypeMap as ItemsTypeMapModel,
361-
)
362362
from airbyte_cdk.sources.declarative.models.declarative_component_schema import ValueType
363363
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
364364
WaitTimeFromHeader as WaitTimeFromHeaderModel,
@@ -438,11 +438,11 @@
438438
DefaultSchemaLoader,
439439
DynamicSchemaLoader,
440440
InlineSchemaLoader,
441+
ItemsTypeMap,
441442
JsonFileSchemaLoader,
443+
PropertyTypesMap,
442444
SchemaTypeIdentifier,
443445
TypesMap,
444-
PropertyTypesMap,
445-
ItemsTypeMap,
446446
)
447447
from airbyte_cdk.sources.declarative.spec import Spec
448448
from airbyte_cdk.sources.declarative.stream_slicers import StreamSlicer
@@ -1904,29 +1904,34 @@ def create_inline_schema_loader(
19041904
) -> InlineSchemaLoader:
19051905
return InlineSchemaLoader(schema=model.schema_ or {}, parameters={})
19061906

1907-
def create_property_types_map(self, model: PropertyTypesMapModel, config: Config, **kwargs: Any) -> PropertyTypesMap:
1907+
def create_property_types_map(
1908+
self, model: PropertyTypesMapModel, config: Config, **kwargs: Any
1909+
) -> PropertyTypesMap:
19081910
type_mapping = self._create_component_from_model(model=model.type_mapping, config=config)
19091911
model_property_type_pointer: List[Union[InterpolatedString, str]] = (
19101912
[x for x in model.property_type_pointer] if model.property_type_pointer else []
19111913
)
19121914
return PropertyTypesMap(
19131915
property_name=model.property_name,
19141916
property_type_pointer=model_property_type_pointer,
1915-
type_mapping=type_mapping
1917+
type_mapping=type_mapping,
19161918
)
19171919

1918-
def create_items_type_map(self, model: ItemsTypeMapModel, config: Config, **kwargs: Any) -> ItemsTypeMap:
1920+
def create_items_type_map(
1921+
self, model: ItemsTypeMapModel, config: Config, **kwargs: Any
1922+
) -> ItemsTypeMap:
19191923
type_mapping = self._create_component_from_model(model=model.type_mapping, config=config)
19201924
model_items_type_pointer: List[Union[InterpolatedString, str]] = (
19211925
[x for x in model.items_type_pointer] if model.items_type_pointer else []
19221926
)
1923-
return ItemsTypeMap(
1924-
items_type_pointer=model_items_type_pointer,
1925-
type_mapping=type_mapping
1926-
)
1927+
return ItemsTypeMap(items_type_pointer=model_items_type_pointer, type_mapping=type_mapping)
19271928

19281929
def create_types_map(self, model: TypesMapModel, config: Config, **kwargs: Any) -> TypesMap:
1929-
items_type = self._create_component_from_model(model=model.items_type, config=config) if model.items_type else model.items_type
1930+
items_type = (
1931+
self._create_component_from_model(model=model.items_type, config=config)
1932+
if model.items_type
1933+
else model.items_type
1934+
)
19301935

19311936
properties_types = []
19321937
if model.properties_types:

airbyte_cdk/sources/declarative/schema/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from airbyte_cdk.sources.declarative.schema.default_schema_loader import DefaultSchemaLoader
66
from airbyte_cdk.sources.declarative.schema.dynamic_schema_loader import (
77
DynamicSchemaLoader,
8+
ItemsTypeMap,
9+
PropertyTypesMap,
810
SchemaTypeIdentifier,
911
TypesMap,
10-
PropertyTypesMap,
11-
ItemsTypeMap,
1212
)
1313
from airbyte_cdk.sources.declarative.schema.inline_schema_loader import InlineSchemaLoader
1414
from airbyte_cdk.sources.declarative.schema.json_file_schema_loader import JsonFileSchemaLoader

0 commit comments

Comments
 (0)