Skip to content

Commit 8d75d0d

Browse files
committed
ruff fix
1 parent 418dcb9 commit 8d75d0d

32 files changed

Lines changed: 130 additions & 126 deletions

airbyte_cdk/connector_builder/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def handle_connector_builder_request(
7878
if command == "resolve_manifest":
7979
return resolve_manifest(source)
8080
elif command == "test_read":
81-
assert (
82-
catalog is not None
83-
), "`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
81+
assert catalog is not None, (
82+
"`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
83+
)
8484
return read_stream(source, config, catalog, state, limits)
8585
elif command == "full_resolve_manifest":
8686
return full_resolve_manifest(source, limits)

airbyte_cdk/sources/concurrent_source/concurrent_source.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def create(
4949
too_many_generator = (
5050
not is_single_threaded and initial_number_of_partitions_to_generate >= num_workers
5151
)
52-
assert (
53-
not too_many_generator
54-
), "It is required to have more workers than threads generating partitions"
52+
assert not too_many_generator, (
53+
"It is required to have more workers than threads generating partitions"
54+
)
5555
threadpool = ThreadPoolManager(
5656
concurrent.futures.ThreadPoolExecutor(
5757
max_workers=num_workers, thread_name_prefix="workerpool"

airbyte_cdk/sources/file_based/file_based_source.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
282282
and hasattr(self, "_concurrency_level")
283283
and self._concurrency_level is not None
284284
):
285-
assert (
286-
state_manager is not None
287-
), "No ConnectorStateManager was created, but it is required for incremental syncs. This is unexpected. Please contact Support."
285+
assert state_manager is not None, (
286+
"No ConnectorStateManager was created, but it is required for incremental syncs. This is unexpected. Please contact Support."
287+
)
288288

289289
cursor = self.cursor_cls(
290290
stream_config,

airbyte_cdk/sources/file_based/file_types/avro_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _convert_avro_type_to_json(
154154
# For example: ^-?\d{1,5}(?:\.\d{1,3})?$ would accept 12345.123 and 123456.12345 would be rejected
155155
return {
156156
"type": "string",
157-
"pattern": f"^-?\\d{{{1,max_whole_number_range}}}(?:\\.\\d{1,decimal_range})?$",
157+
"pattern": f"^-?\\d{{{1, max_whole_number_range}}}(?:\\.\\d{1, decimal_range})?$",
158158
}
159159
elif "logicalType" in avro_field:
160160
if avro_field["logicalType"] not in AVRO_LOGICAL_TYPE_TO_JSON:

airbyte_cdk/sources/file_based/stream/concurrent/adapters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ def read(self) -> Iterable[Record]:
284284
def to_slice(self) -> Optional[Mapping[str, Any]]:
285285
if self._slice is None:
286286
return None
287-
assert (
288-
len(self._slice["files"]) == 1
289-
), f"Expected 1 file per partition but got {len(self._slice['files'])} for stream {self.stream_name()}"
287+
assert len(self._slice["files"]) == 1, (
288+
f"Expected 1 file per partition but got {len(self._slice['files'])} for stream {self.stream_name()}"
289+
)
290290
file = self._slice["files"][0]
291291
return {"files": [file]}
292292

airbyte_cdk/sql/shared/sql_processor.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ def _ensure_schema_exists(
326326

327327
if DEBUG_MODE:
328328
found_schemas = schemas_list
329-
assert (
330-
schema_name in found_schemas
331-
), f"Schema {schema_name} was not created. Found: {found_schemas}"
329+
assert schema_name in found_schemas, (
330+
f"Schema {schema_name} was not created. Found: {found_schemas}"
331+
)
332332

333333
def _quote_identifier(self, identifier: str) -> str:
334334
"""Return the given identifier, quoted."""
@@ -617,10 +617,10 @@ def _append_temp_table_to_final_table(
617617
self._execute_sql(
618618
f"""
619619
INSERT INTO {self._fully_qualified(final_table_name)} (
620-
{f',{nl} '.join(columns)}
620+
{f",{nl} ".join(columns)}
621621
)
622622
SELECT
623-
{f',{nl} '.join(columns)}
623+
{f",{nl} ".join(columns)}
624624
FROM {self._fully_qualified(temp_table_name)}
625625
""",
626626
)
@@ -645,8 +645,7 @@ def _swap_temp_table_with_final_table(
645645
deletion_name = f"{final_table_name}_deleteme"
646646
commands = "\n".join(
647647
[
648-
f"ALTER TABLE {self._fully_qualified(final_table_name)} RENAME "
649-
f"TO {deletion_name};",
648+
f"ALTER TABLE {self._fully_qualified(final_table_name)} RENAME TO {deletion_name};",
650649
f"ALTER TABLE {self._fully_qualified(temp_table_name)} RENAME "
651650
f"TO {final_table_name};",
652651
f"DROP TABLE {self._fully_qualified(deletion_name)};",
@@ -686,10 +685,10 @@ def _merge_temp_table_to_final_table(
686685
{set_clause}
687686
WHEN NOT MATCHED THEN INSERT
688687
(
689-
{f',{nl} '.join(columns)}
688+
{f",{nl} ".join(columns)}
690689
)
691690
VALUES (
692-
tmp.{f',{nl} tmp.'.join(columns)}
691+
tmp.{f",{nl} tmp.".join(columns)}
693692
);
694693
""",
695694
)

airbyte_cdk/test/declarative/test_suites/connector_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
ACCEPTANCE_TEST_CONFIG = "acceptance-test-config.yml"
2828
MANIFEST_YAML = "manifest.yaml"
2929

30+
3031
class JavaClass(str):
3132
"""A string that represents a Java class."""
3233

airbyte_cdk/test/declarative/test_suites/source_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_basic_read(
6969
sync_mode=SyncMode.full_refresh,
7070
destination_sync_mode=DestinationSyncMode.append_dedup,
7171
)
72-
for stream in discover_result.catalog.catalog.streams # type: ignore [reportOptionalMemberAccess]
72+
for stream in discover_result.catalog.catalog.streams # type: ignore [reportOptionalMemberAccess]
7373
]
7474
)
7575
result = run_test_job(
@@ -101,8 +101,8 @@ def test_fail_with_bad_catalog(
101101
},
102102
supported_sync_modes=[SyncMode.full_refresh],
103103
),
104-
sync_mode="INVALID", # type: ignore [reportArgumentType]
105-
destination_sync_mode="INVALID", # type: ignore [reportArgumentType]
104+
sync_mode="INVALID", # type: ignore [reportArgumentType]
105+
destination_sync_mode="INVALID", # type: ignore [reportArgumentType]
106106
)
107107
]
108108
)

airbyte_cdk/test/declarative/utils/job_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ def run_test_job(
100100
# Check is expected to fail gracefully without an exception.
101101
# Instead, we assert that we have a CONNECTION_STATUS message with
102102
# a failure status.
103-
assert not result.errors, "Expected no errors from check. Got:\n" + "\n".join([
104-
str(error) for error in result.errors
105-
])
103+
assert not result.errors, "Expected no errors from check. Got:\n" + "\n".join(
104+
[str(error) for error in result.errors]
105+
)
106106
assert len(result.connection_status_messages) == 1, (
107107
"Expected exactly one CONNECTION_STATUS message. Got "
108108
f"{len(result.connection_status_messages)}:\n"

file::memory:?cache=shared

32 KB
Binary file not shown.

0 commit comments

Comments
 (0)