Skip to content

Commit 813a467

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint issues (unsafe)
1 parent 7a51c10 commit 813a467

File tree

20 files changed

+26
-26
lines changed

20 files changed

+26
-26
lines changed

airbyte_cdk/destinations/vector_db_based/embedder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def embed_documents(self, documents: list[Document]) -> list[list[float] | None]
252252
message=f"Record {str(data)[:250]}... in stream {document.record.stream} does not contain embedding vector field {self.config.field_name}. Please check your embedding configuration, the embedding vector field has to be set correctly on every record.",
253253
)
254254
field = data[self.config.field_name]
255-
if not isinstance(field, list) or not all(isinstance(x, (int, float)) for x in field):
255+
if not isinstance(field, list) or not all(isinstance(x, int | float) for x in field):
256256
raise AirbyteTracedException(
257257
internal_message="Embedding vector field not a list of numbers",
258258
failure_type=FailureType.config_error,

airbyte_cdk/sources/declarative/auth/oauth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def __post_init__(self, parameters: Mapping[str, Any]) -> None:
125125
)
126126
try:
127127
if (
128-
isinstance(self.token_expiry_date, (int, str))
128+
isinstance(self.token_expiry_date, int | str)
129129
and str(self.token_expiry_date).isdigit()
130130
):
131131
self._token_expiry_date = ab_datetime_parse(self.token_expiry_date)

airbyte_cdk/sources/declarative/declarative_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def _get_checkpoint_reader(
230230
checkpoint_mode = self._checkpoint_mode
231231

232232
if isinstance(
233-
cursor, (GlobalSubstreamCursor, PerPartitionCursor, PerPartitionWithGlobalCursor)
233+
cursor, GlobalSubstreamCursor | PerPartitionCursor | PerPartitionWithGlobalCursor
234234
):
235235
self.has_multiple_slices = True
236236
return CursorBasedCheckpointReader(

airbyte_cdk/sources/declarative/interpolation/macros.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def timestamp(dt: float | str) -> int | float:
6262
:param dt: datetime to convert to timestamp
6363
:return: unix timestamp
6464
"""
65-
if isinstance(dt, (int, float)):
65+
if isinstance(dt, int | float):
6666
return int(dt)
6767
else:
6868
return str_to_datetime(dt).astimezone(pytz.utc).timestamp()

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def create_legacy_to_per_partition_state_migration(
872872
)
873873
partition_router = retriever.partition_router
874874
if not isinstance(
875-
partition_router, (SubstreamPartitionRouterModel, CustomPartitionRouterModel)
875+
partition_router, SubstreamPartitionRouterModel | CustomPartitionRouterModel
876876
):
877877
raise ValueError(
878878
f"LegacyToPerPartitionStateMigrations can only be applied on a SimpleRetriever with a Substream partition router. Got {type(partition_router)}"
@@ -1755,7 +1755,7 @@ def create_declarative_stream(
17551755
cursor = (
17561756
combined_slicers
17571757
if isinstance(
1758-
combined_slicers, (PerPartitionWithGlobalCursor, GlobalSubstreamCursor)
1758+
combined_slicers, PerPartitionWithGlobalCursor | GlobalSubstreamCursor
17591759
)
17601760
else self._create_component_from_model(model=model.incremental_sync, config=config)
17611761
)
@@ -2394,7 +2394,7 @@ def _get_parser(model: BaseModel, config: Config) -> Parser:
23942394
inner_parser=ModelToComponentFactory._get_parser(model.decoder, config)
23952395
)
23962396
elif isinstance(
2397-
model, (CustomDecoderModel, IterableDecoderModel, XmlDecoderModel, ZipfileDecoderModel)
2397+
model, CustomDecoderModel | IterableDecoderModel | XmlDecoderModel | ZipfileDecoderModel
23982398
):
23992399
raise ValueError(f"Decoder type {model} does not have parser associated to it")
24002400

@@ -3479,7 +3479,7 @@ def create_config_components_resolver(
34793479
)
34803480

34813481
def _is_supported_decoder_for_pagination(self, decoder: Decoder) -> bool:
3482-
if isinstance(decoder, (JsonDecoder, XmlDecoder)):
3482+
if isinstance(decoder, JsonDecoder | XmlDecoder):
34833483
return True
34843484
elif isinstance(decoder, CompositeRawDecoder):
34853485
return self._is_supported_parser_for_pagination(decoder.parser)

airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def _migrate_child_state_to_parent_state(self, stream_state: StreamState) -> Str
373373
substream_state = substream_state_values[0] if substream_state_values else {}
374374

375375
# Ignore per-partition states or invalid formats.
376-
if isinstance(substream_state, (list, dict)) or len(substream_state_values) != 1:
376+
if isinstance(substream_state, list | dict) or len(substream_state_values) != 1:
377377
# If a global state is present under the key "state", use its first value.
378378
if (
379379
"state" in stream_state

airbyte_cdk/sources/declarative/requesters/error_handlers/default_http_response_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def matches(
2424
) -> ErrorResolution | None:
2525
default_mapped_error_resolution = None
2626

27-
if isinstance(response_or_exception, (requests.Response, Exception)):
27+
if isinstance(response_or_exception, requests.Response | Exception):
2828
mapped_key: int | type = (
2929
response_or_exception.status_code
3030
if isinstance(response_or_exception, requests.Response)

airbyte_cdk/sources/declarative/requesters/error_handlers/http_response_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def matches(
8080
else response_or_exception.__class__
8181
)
8282

83-
if isinstance(mapped_key, (int, Exception)):
83+
if isinstance(mapped_key, int | Exception):
8484
default_mapped_error_resolution = self._match_default_error_mapping(mapped_key)
8585
else:
8686
default_mapped_error_resolution = None

airbyte_cdk/sources/declarative/requesters/http_job_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def fetch_records(self, job: AsyncJob) -> Iterable[Mapping[str, Any]]:
230230
elif isinstance(message, AirbyteMessage):
231231
if message.type == Type.RECORD:
232232
yield message.record.data # type: ignore # message.record won't be None here as the message is a record
233-
elif isinstance(message, (dict, Mapping)):
233+
elif isinstance(message, dict | Mapping):
234234
yield message
235235
else:
236236
raise TypeError(f"Unknown type `{type(message)}` for message")

airbyte_cdk/sources/declarative/requesters/http_requester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def _request_params(
291291
raise ValueError("Request params cannot be a string")
292292

293293
for k, v in options.items():
294-
if isinstance(v, (dict,)):
294+
if isinstance(v, dict):
295295
raise ValueError(
296296
f"Invalid value for `{k}` parameter. The values of request params cannot be an object."
297297
)

0 commit comments

Comments
 (0)