Skip to content

Commit e6f053a

Browse files
committed
Pre-commit fixes
1 parent 1f97a45 commit e6f053a

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src/odoo_data_flow/import_threaded.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import concurrent.futures
99
import csv
1010
import sys
11-
import time # noqa
11+
import time
1212
from collections.abc import Generator, Iterable
1313
from concurrent.futures import ThreadPoolExecutor, as_completed # noqa
1414
from typing import Any, Optional, TextIO, Union
@@ -691,8 +691,8 @@ def _execute_load_batch(
691691
or "poolerror" in error_str.lower()
692692
):
693693
log.warning(
694-
f"Database connection pool exhaustion detected. "
695-
f"Reducing chunk size and retrying to reduce server load."
694+
"Database connection pool exhaustion detected. "
695+
"Reducing chunk size and retrying to reduce server load."
696696
)
697697
is_scalable_error = True
698698

src/odoo_data_flow/lib/relational_import.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ def run_direct_relational_import(
196196

197197
# Check if the field exists in the DataFrame
198198
if field not in source_df.columns:
199-
log.error(f"Field '{field}' not found in source DataFrame. Available columns: {source_df.columns}")
199+
log.error(
200+
f"Field '{field}' not found in source DataFrame. Available columns: {source_df.columns}"
201+
)
200202
return None
201203

202204
# 2. Prepare the related model's IDs using the resolver
@@ -269,14 +271,18 @@ def _prepare_link_dataframe(
269271

270272
# Check if the field exists in the DataFrame
271273
if field not in source_df.columns:
272-
log.error(f"Field '{field}' not found in source DataFrame. Available columns: {source_df.columns}")
274+
log.error(
275+
f"Field '{field}' not found in source DataFrame. Available columns: {source_df.columns}"
276+
)
273277
# Return an empty DataFrame with the expected schema
274-
return pl.DataFrame(schema={
275-
"external_id": pl.Utf8,
276-
field: pl.Utf8,
277-
owning_model_fk: pl.Int64,
278-
f"{related_model_fk}/id": pl.Int64
279-
})
278+
return pl.DataFrame(
279+
schema={
280+
"external_id": pl.Utf8,
281+
field: pl.Utf8,
282+
owning_model_fk: pl.Int64,
283+
f"{related_model_fk}/id": pl.Int64,
284+
}
285+
)
280286

281287
# Create the link table DataFrame
282288
link_df = source_df.select(["id", field]).rename({"id": "external_id"})
@@ -343,7 +349,9 @@ def run_write_tuple_import(
343349

344350
# Check if the field exists in the DataFrame
345351
if field not in source_df.columns:
346-
log.error(f"Field '{field}' not found in source DataFrame. Available columns: {source_df.columns}")
352+
log.error(
353+
f"Field '{field}' not found in source DataFrame. Available columns: {source_df.columns}"
354+
)
347355
return False
348356

349357
# 2. Prepare the related model's IDs using the resolver

0 commit comments

Comments
 (0)