Skip to content

Commit 4e9e7da

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent df8f72a commit 4e9e7da

File tree

5 files changed

+424
-552
lines changed

5 files changed

+424
-552
lines changed

airbyte_cdk/connector_builder/connector_builder_handler.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class TestReadLimits:
4343
def get_limits(config: Mapping[str, Any]) -> TestReadLimits:
4444
command_config = config.get("__test_read_config", {})
4545
max_pages_per_slice = (
46-
command_config.get(MAX_PAGES_PER_SLICE_KEY) or DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE
46+
command_config.get(MAX_PAGES_PER_SLICE_KEY) or DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE
4747
)
4848
max_slices = command_config.get(MAX_SLICES_KEY) or DEFAULT_MAXIMUM_NUMBER_OF_SLICES
4949
max_records = command_config.get(MAX_RECORDS_KEY) or DEFAULT_MAXIMUM_RECORDS
@@ -67,11 +67,11 @@ def create_source(config: Mapping[str, Any], limits: TestReadLimits) -> Manifest
6767

6868

6969
def read_stream(
70-
source: DeclarativeSource,
71-
config: Mapping[str, Any],
72-
configured_catalog: ConfiguredAirbyteCatalog,
73-
state: List[AirbyteStateMessage],
74-
limits: TestReadLimits,
70+
source: DeclarativeSource,
71+
config: Mapping[str, Any],
72+
configured_catalog: ConfiguredAirbyteCatalog,
73+
state: List[AirbyteStateMessage],
74+
limits: TestReadLimits,
7575
) -> AirbyteMessage:
7676
try:
7777
test_read_handler = TestReader(

airbyte_cdk/connector_builder/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
from airbyte_cdk.connector_builder.connector_builder_handler import (
1313
TestReadLimits,
1414
create_source,
15+
full_resolve_manifest,
1516
get_limits,
1617
read_stream,
1718
resolve_manifest,
18-
full_resolve_manifest,
1919
)
2020
from airbyte_cdk.entrypoint import AirbyteEntrypoint
2121
from airbyte_cdk.models import (

airbyte_cdk/sources/declarative/manifest_declarative_source.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ def _dynamic_stream_configs(
398398
# Ensure that each stream is created with a unique name
399399
name = dynamic_stream.get("name")
400400

401-
dynamic_stream["dynamic_stream_name"] = dynamic_definition.get("name", f"dynamic_stream_{dynamic_definition_index}")
401+
dynamic_stream["dynamic_stream_name"] = dynamic_definition.get(
402+
"name", f"dynamic_stream_{dynamic_definition_index}"
403+
)
402404

403405
if not isinstance(name, str):
404406
raise ValueError(

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

+27-45
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,7 @@ class OAuthAuthenticator(BaseModel):
609609
scopes: Optional[List[str]] = Field(
610610
None,
611611
description="List of scopes that should be granted to the access token.",
612-
examples=[
613-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
614-
],
612+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
615613
title="Scopes",
616614
)
617615
token_expiry_date: Optional[str] = Field(
@@ -1085,28 +1083,24 @@ class OAuthConfigSpecification(BaseModel):
10851083
class Config:
10861084
extra = Extra.allow
10871085

1088-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1089-
Field(
1090-
None,
1091-
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 }",
1092-
examples=[
1093-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1094-
{
1095-
"app_id": {
1096-
"type": "string",
1097-
"path_in_connector_config": ["info", "app_id"],
1098-
}
1099-
},
1100-
],
1101-
title="OAuth user input",
1102-
)
1086+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1087+
None,
1088+
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 }",
1089+
examples=[
1090+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1091+
{
1092+
"app_id": {
1093+
"type": "string",
1094+
"path_in_connector_config": ["info", "app_id"],
1095+
}
1096+
},
1097+
],
1098+
title="OAuth user input",
11031099
)
1104-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1105-
Field(
1106-
None,
1107-
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 }',
1108-
title="DeclarativeOAuth Connector Specification",
1109-
)
1100+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1101+
None,
1102+
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 }',
1103+
title="DeclarativeOAuth Connector Specification",
11101104
)
11111105
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
11121106
None,
@@ -1124,9 +1118,7 @@ class Config:
11241118
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
11251119
None,
11261120
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 }",
1127-
examples=[
1128-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1129-
],
1121+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
11301122
title="OAuth input specification",
11311123
)
11321124
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1789,9 +1781,7 @@ class RecordSelector(BaseModel):
17891781
description="Responsible for filtering records to be emitted by the Source.",
17901782
title="Record Filter",
17911783
)
1792-
schema_normalization: Optional[
1793-
Union[SchemaNormalization, CustomSchemaNormalization]
1794-
] = Field(
1784+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
17951785
SchemaNormalization.None_,
17961786
description="Responsible for normalization according to the schema.",
17971787
title="Schema Normalization",
@@ -2018,9 +2008,7 @@ class Config:
20182008
description="Component used to fetch data incrementally based on a time field in the data.",
20192009
title="Incremental Sync",
20202010
)
2021-
name: Optional[str] = Field(
2022-
"", description="The stream name.", example=["Users"], title="Name"
2023-
)
2011+
name: Optional[str] = Field("", description="The stream name.", example=["Users"], title="Name")
20242012
primary_key: Optional[PrimaryKey] = Field(
20252013
"", description="The primary key of the stream.", title="Primary Key"
20262014
)
@@ -2284,9 +2272,7 @@ class ParentStreamConfig(BaseModel):
22842272

22852273
class StateDelegatingStream(BaseModel):
22862274
type: Literal["StateDelegatingStream"]
2287-
name: str = Field(
2288-
..., description="The stream name.", example=["Users"], title="Name"
2289-
)
2275+
name: str = Field(..., description="The stream name.", example=["Users"], title="Name")
22902276
full_refresh_stream: DeclarativeStream = Field(
22912277
...,
22922278
description="Component used to coordinate how records are extracted across stream slices and request pages when the state is empty or not provided.",
@@ -2375,9 +2361,7 @@ class AsyncRetriever(BaseModel):
23752361
)
23762362
download_extractor: Optional[
23772363
Union[CustomRecordExtractor, DpathExtractor, ResponseToFileExtractor]
2378-
] = Field(
2379-
None, description="Responsible for fetching the records from provided urls."
2380-
)
2364+
] = Field(None, description="Responsible for fetching the records from provided urls.")
23812365
creation_requester: Union[CustomRequester, HttpRequester] = Field(
23822366
...,
23832367
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",
@@ -2517,12 +2501,10 @@ class DynamicDeclarativeStream(BaseModel):
25172501
stream_template: DeclarativeStream = Field(
25182502
..., description="Reference to the stream template.", title="Stream Template"
25192503
)
2520-
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = (
2521-
Field(
2522-
...,
2523-
description="Component resolve and populates stream templates with components values.",
2524-
title="Components Resolver",
2525-
)
2504+
components_resolver: Union[HttpComponentsResolver, ConfigComponentsResolver] = Field(
2505+
...,
2506+
description="Component resolve and populates stream templates with components values.",
2507+
title="Components Resolver",
25262508
)
25272509

25282510

0 commit comments

Comments
 (0)