Skip to content

Commit aaee739

Browse files
fix: apply ruff 0.11.5 formatting to resolve CI format check discrepancy
Co-Authored-By: AJ Steers <[email protected]>
1 parent 03fb2d8 commit aaee739

File tree

22 files changed

+121
-119
lines changed

22 files changed

+121
-119
lines changed

airbyte_cdk/connector_builder/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def handle_connector_builder_request(
8080
if command == "resolve_manifest":
8181
return resolve_manifest(source)
8282
elif command == "test_read":
83-
assert (
84-
catalog is not None
85-
), "`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
83+
assert catalog is not None, (
84+
"`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
85+
)
8686
return read_stream(source, config, catalog, state, limits)
8787
elif command == "full_resolve_manifest":
8888
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
@@ -51,9 +51,9 @@ def create(
5151
too_many_generator = (
5252
not is_single_threaded and initial_number_of_partitions_to_generate >= num_workers
5353
)
54-
assert (
55-
not too_many_generator
56-
), "It is required to have more workers than threads generating partitions"
54+
assert not too_many_generator, (
55+
"It is required to have more workers than threads generating partitions"
56+
)
5757
threadpool = ThreadPoolManager(
5858
concurrent.futures.ThreadPoolExecutor(
5959
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/stream/concurrent/adapters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ def read(self) -> Iterable[Record]:
277277
def to_slice(self) -> Optional[Mapping[str, Any]]:
278278
if self._slice is None:
279279
return None
280-
assert (
281-
len(self._slice["files"]) == 1
282-
), f"Expected 1 file per partition but got {len(self._slice['files'])} for stream {self.stream_name()}"
280+
assert len(self._slice["files"]) == 1, (
281+
f"Expected 1 file per partition but got {len(self._slice['files'])} for stream {self.stream_name()}"
282+
)
283283
file = self._slice["files"][0]
284284
return {"files": [file]}
285285

airbyte_cdk/sql/shared/sql_processor.py

Lines changed: 3 additions & 3 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."""

unit_tests/connector_builder/test_connector_builder_handler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,9 +1267,9 @@ def test_handle_read_external_requests(deployment_mode, url_base, expected_error
12671267
source, config, catalog, _A_PER_PARTITION_STATE, limits
12681268
).record.data
12691269
if expected_error:
1270-
assert (
1271-
len(output_data["logs"]) > 0
1272-
), "Expected at least one log message with the expected error"
1270+
assert len(output_data["logs"]) > 0, (
1271+
"Expected at least one log message with the expected error"
1272+
)
12731273
error_message = output_data["logs"][0]
12741274
assert error_message["level"] == "ERROR"
12751275
assert expected_error in error_message["stacktrace"]
@@ -1363,9 +1363,9 @@ def test_handle_read_external_oauth_request(deployment_mode, token_url, expected
13631363
source, config, catalog, _A_PER_PARTITION_STATE, limits
13641364
).record.data
13651365
if expected_error:
1366-
assert (
1367-
len(output_data["logs"]) > 0
1368-
), "Expected at least one log message with the expected error"
1366+
assert len(output_data["logs"]) > 0, (
1367+
"Expected at least one log message with the expected error"
1368+
)
13691369
error_message = output_data["logs"][0]
13701370
assert error_message["level"] == "ERROR"
13711371
assert expected_error in error_message["stacktrace"]

unit_tests/destinations/test_destination.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def test_successful_parse(
5858
self, arg_list: List[str], expected_output: Mapping[str, Any], destination: Destination
5959
):
6060
parsed_args = vars(destination.parse_args(arg_list))
61-
assert (
62-
parsed_args == expected_output
63-
), f"Expected parsing {arg_list} to return parsed args {expected_output} but instead found {parsed_args}"
61+
assert parsed_args == expected_output, (
62+
f"Expected parsing {arg_list} to return parsed args {expected_output} but instead found {parsed_args}"
63+
)
6464

6565
@pytest.mark.parametrize(
6666
("arg_list"),

unit_tests/legacy/sources/declarative/partition_routers/test_parent_state_stream.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,11 @@ def run_incremental_parent_state_test(
340340
expected_records_set = list(
341341
{orjson.dumps(record): record for record in expected_records}.values()
342342
)
343-
assert (
344-
sorted(cumulative_records_state_deduped, key=lambda x: orjson.dumps(x))
345-
== sorted(expected_records_set, key=lambda x: orjson.dumps(x))
346-
), f"Records mismatch with intermediate state {state}. Expected {expected_records}, got {cumulative_records_state_deduped}"
343+
assert sorted(
344+
cumulative_records_state_deduped, key=lambda x: orjson.dumps(x)
345+
) == sorted(expected_records_set, key=lambda x: orjson.dumps(x)), (
346+
f"Records mismatch with intermediate state {state}. Expected {expected_records}, got {cumulative_records_state_deduped}"
347+
)
347348

348349
# Store the final state after each intermediate read
349350
final_state_intermediate = [
@@ -355,9 +356,9 @@ def run_incremental_parent_state_test(
355356

356357
# Assert that the final state matches the expected state for all runs
357358
for i, final_state in enumerate(final_states):
358-
assert (
359-
final_state in expected_states
360-
), f"Final state mismatch at run {i + 1}. Expected {expected_states}, got {final_state}"
359+
assert final_state in expected_states, (
360+
f"Final state mismatch at run {i + 1}. Expected {expected_states}, got {final_state}"
361+
)
361362

362363

363364
@pytest.mark.parametrize(

unit_tests/source_declarative_manifest/test_source_declarative_w_custom_components.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def get_py_components_config_dict(
9797

9898
manifest_dict = yaml.safe_load(manifest_yaml_path.read_text())
9999
assert manifest_dict, "Failed to load the manifest file."
100-
assert isinstance(
101-
manifest_dict, Mapping
102-
), f"Manifest file is type {type(manifest_dict).__name__}, not a mapping: {manifest_dict}"
100+
assert isinstance(manifest_dict, Mapping), (
101+
f"Manifest file is type {type(manifest_dict).__name__}, not a mapping: {manifest_dict}"
102+
)
103103

104104
custom_py_code = custom_py_code_path.read_text()
105105
combined_config_dict = {

unit_tests/sources/declarative/incremental/test_concurrent_perpartitioncursor.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ def run_mocked_test(
389389
request_count = len(
390390
[req for req in m.request_history if unquote(req.url) == unquote(url)]
391391
)
392-
assert (
393-
request_count == 1
394-
), f"URL {url} was called {request_count} times, expected exactly once."
392+
assert request_count == 1, (
393+
f"URL {url} was called {request_count} times, expected exactly once."
394+
)
395395

396396

397397
def _run_read(
@@ -1137,10 +1137,11 @@ def run_incremental_parent_state_test(
11371137
expected_records_set = list(
11381138
{orjson.dumps(record): record for record in expected_records}.values()
11391139
)
1140-
assert (
1141-
sorted(cumulative_records_state_deduped, key=lambda x: x["id"])
1142-
== sorted(expected_records_set, key=lambda x: x["id"])
1143-
), f"Records mismatch with intermediate state {state}. Expected {expected_records}, got {cumulative_records_state_deduped}"
1140+
assert sorted(cumulative_records_state_deduped, key=lambda x: x["id"]) == sorted(
1141+
expected_records_set, key=lambda x: x["id"]
1142+
), (
1143+
f"Records mismatch with intermediate state {state}. Expected {expected_records}, got {cumulative_records_state_deduped}"
1144+
)
11441145

11451146
# Store the final state after each intermediate read
11461147
final_state_intermediate = [
@@ -1151,9 +1152,9 @@ def run_incremental_parent_state_test(
11511152

11521153
# Assert that the final state matches the expected state for all runs
11531154
for i, final_state in enumerate(final_states):
1154-
assert (
1155-
final_state in expected_states
1156-
), f"Final state mismatch at run {i + 1}. Expected {expected_states}, got {final_state}"
1155+
assert final_state in expected_states, (
1156+
f"Final state mismatch at run {i + 1}. Expected {expected_states}, got {final_state}"
1157+
)
11571158

11581159

11591160
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)