Skip to content

Commit 1f64c8f

Browse files
style: apply ruff formatting to generated Python models
Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent f18ce99 commit 1f64c8f

File tree

1 file changed

+45
-65
lines changed

1 file changed

+45
-65
lines changed

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 45 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,7 @@ class OAuthAuthenticator(BaseModel):
633633
scopes: Optional[List[str]] = Field(
634634
None,
635635
description="List of scopes that should be granted to the access token.",
636-
examples=[
637-
["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]
638-
],
636+
examples=[["crm.list.read", "crm.objects.contacts.read", "crm.schema.contacts.read"]],
639637
title="Scopes",
640638
)
641639
token_expiry_date: Optional[str] = Field(
@@ -1146,28 +1144,24 @@ class OAuthConfigSpecification(BaseModel):
11461144
class Config:
11471145
extra = Extra.allow
11481146

1149-
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = (
1150-
Field(
1151-
None,
1152-
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 }",
1153-
examples=[
1154-
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1155-
{
1156-
"app_id": {
1157-
"type": "string",
1158-
"path_in_connector_config": ["info", "app_id"],
1159-
}
1160-
},
1161-
],
1162-
title="OAuth user input",
1163-
)
1147+
oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = Field(
1148+
None,
1149+
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 }",
1150+
examples=[
1151+
{"app_id": {"type": "string", "path_in_connector_config": ["app_id"]}},
1152+
{
1153+
"app_id": {
1154+
"type": "string",
1155+
"path_in_connector_config": ["info", "app_id"],
1156+
}
1157+
},
1158+
],
1159+
title="OAuth user input",
11641160
)
1165-
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = (
1166-
Field(
1167-
None,
1168-
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 }',
1169-
title="DeclarativeOAuth Connector Specification",
1170-
)
1161+
oauth_connector_input_specification: Optional[OauthConnectorInputSpecification] = Field(
1162+
None,
1163+
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 }',
1164+
title="DeclarativeOAuth Connector Specification",
11711165
)
11721166
complete_oauth_output_specification: Optional[Dict[str, Any]] = Field(
11731167
None,
@@ -1185,9 +1179,7 @@ class Config:
11851179
complete_oauth_server_input_specification: Optional[Dict[str, Any]] = Field(
11861180
None,
11871181
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 }",
1188-
examples=[
1189-
{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}
1190-
],
1182+
examples=[{"client_id": {"type": "string"}, "client_secret": {"type": "string"}}],
11911183
title="OAuth input specification",
11921184
)
11931185
complete_oauth_server_output_specification: Optional[Dict[str, Any]] = Field(
@@ -1692,9 +1684,7 @@ class CustomConfigTransformation(BaseModel):
16921684
class_name: str = Field(
16931685
...,
16941686
description="Fully-qualified name of the class that will be implementing the custom config transformation. The format is `source_<name>.<package>.<class_name>`.",
1695-
examples=[
1696-
"source_declarative_manifest.components.MyCustomConfigTransformation"
1697-
],
1687+
examples=["source_declarative_manifest.components.MyCustomConfigTransformation"],
16981688
)
16991689
parameters: Optional[Dict[str, Any]] = Field(
17001690
None,
@@ -2093,9 +2083,7 @@ class RecordSelector(BaseModel):
20932083
description="Responsible for filtering records to be emitted by the Source.",
20942084
title="Record Filter",
20952085
)
2096-
schema_normalization: Optional[
2097-
Union[SchemaNormalization, CustomSchemaNormalization]
2098-
] = Field(
2086+
schema_normalization: Optional[Union[SchemaNormalization, CustomSchemaNormalization]] = Field(
20992087
None,
21002088
description="Responsible for normalization according to the schema.",
21012089
title="Schema Normalization",
@@ -2131,12 +2119,10 @@ class DpathValidator(BaseModel):
21312119
],
21322120
title="Field Path",
21332121
)
2134-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2135-
Field(
2136-
...,
2137-
description="The condition that the specified config value will be evaluated against",
2138-
title="Validation Strategy",
2139-
)
2122+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2123+
...,
2124+
description="The condition that the specified config value will be evaluated against",
2125+
title="Validation Strategy",
21402126
)
21412127

21422128

@@ -2153,12 +2139,10 @@ class PredicateValidator(BaseModel):
21532139
],
21542140
title="Value",
21552141
)
2156-
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = (
2157-
Field(
2158-
...,
2159-
description="The validation strategy to apply to the value.",
2160-
title="Validation Strategy",
2161-
)
2142+
validation_strategy: Union[ValidateAdheresToSchema, CustomValidationStrategy] = Field(
2143+
...,
2144+
description="The validation strategy to apply to the value.",
2145+
title="Validation Strategy",
21622146
)
21632147

21642148

@@ -2348,9 +2332,9 @@ class Config:
23482332

23492333
type: Literal["DeclarativeSource"]
23502334
check: Union[CheckStream, CheckDynamicStream]
2351-
streams: Optional[
2352-
List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]
2353-
] = None
2335+
streams: Optional[List[Union[ConditionalStreams, DeclarativeStream, StateDelegatingStream]]] = (
2336+
None
2337+
)
23542338
dynamic_streams: List[DynamicDeclarativeStream]
23552339
version: str = Field(
23562340
...,
@@ -2672,20 +2656,18 @@ class HttpRequester(BaseModelWithDeprecations):
26722656
description="For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.",
26732657
title="Query Properties",
26742658
)
2675-
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = (
2676-
Field(
2677-
None,
2678-
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2679-
examples=[
2680-
{"unit": "day"},
2681-
{
2682-
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2683-
},
2684-
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2685-
{"sort_by[asc]": "updated_at"},
2686-
],
2687-
title="Query Parameters",
2688-
)
2659+
request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field(
2660+
None,
2661+
description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.",
2662+
examples=[
2663+
{"unit": "day"},
2664+
{
2665+
"query": 'last_event_time BETWEEN TIMESTAMP "{{ stream_interval.start_time }}" AND TIMESTAMP "{{ stream_interval.end_time }}"'
2666+
},
2667+
{"searchIn": "{{ ','.join(config.get('search_in', [])) }}"},
2668+
{"sort_by[asc]": "updated_at"},
2669+
],
2670+
title="Query Parameters",
26892671
)
26902672
request_headers: Optional[Union[Dict[str, str], str]] = Field(
26912673
None,
@@ -2953,9 +2935,7 @@ class AsyncRetriever(BaseModel):
29532935
)
29542936
download_extractor: Optional[
29552937
Union[DpathExtractor, CustomRecordExtractor, ResponseToFileExtractor]
2956-
] = Field(
2957-
None, description="Responsible for fetching the records from provided urls."
2958-
)
2938+
] = Field(None, description="Responsible for fetching the records from provided urls.")
29592939
creation_requester: Union[HttpRequester, CustomRequester] = Field(
29602940
...,
29612941
description="Requester component that describes how to prepare HTTP requests to send to the source API to create the async server-side job.",

0 commit comments

Comments
 (0)