Skip to content

Commit a7e63d1

Browse files
committed
ruff format
1 parent e60ceb1 commit a7e63d1

File tree

1 file changed

+21
-9
lines changed
  • lib/idp_common_pkg/idp_common/classification

1 file changed

+21
-9
lines changed

lib/idp_common_pkg/idp_common/classification/service.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,11 +1250,17 @@ def classify_document(self, document: Document) -> Document:
12501250
].confidence = cached_result.classification.confidence
12511251

12521252
# Copy metadata (including boundary information) to the page
1253-
if hasattr(document.pages[page_id], 'metadata'):
1254-
document.pages[page_id].metadata = cached_result.classification.metadata
1253+
if hasattr(document.pages[page_id], "metadata"):
1254+
document.pages[
1255+
page_id
1256+
].metadata = cached_result.classification.metadata
12551257
else:
12561258
# If the page doesn't have a metadata attribute, add it
1257-
setattr(document.pages[page_id], 'metadata', cached_result.classification.metadata)
1259+
setattr(
1260+
document.pages[page_id],
1261+
"metadata",
1262+
cached_result.classification.metadata,
1263+
)
12581264

12591265
# Merge cached metering data
12601266
page_metering = cached_result.classification.metadata.get(
@@ -1305,11 +1311,17 @@ def classify_document(self, document: Document) -> Document:
13051311
].confidence = page_result.classification.confidence
13061312

13071313
# Copy metadata (including boundary information) to the page
1308-
if hasattr(document.pages[page_id], 'metadata'):
1309-
document.pages[page_id].metadata = page_result.classification.metadata
1314+
if hasattr(document.pages[page_id], "metadata"):
1315+
document.pages[
1316+
page_id
1317+
].metadata = page_result.classification.metadata
13101318
else:
13111319
# If the page doesn't have a metadata attribute, add it
1312-
setattr(document.pages[page_id], 'metadata', page_result.classification.metadata)
1320+
setattr(
1321+
document.pages[page_id],
1322+
"metadata",
1323+
page_result.classification.metadata,
1324+
)
13131325

13141326
# Merge metering data
13151327
page_metering = page_result.classification.metadata.get(
@@ -1393,9 +1405,9 @@ def classify_document(self, document: Document) -> Document:
13931405
current_pages = [sorted_results[0]]
13941406

13951407
for result in sorted_results[1:]:
1396-
boundary = (
1397-
result.classification.metadata.get("document_boundary", "continue").lower()
1398-
)
1408+
boundary = result.classification.metadata.get(
1409+
"document_boundary", "continue"
1410+
).lower()
13991411
if (
14001412
result.classification.doc_type == current_type
14011413
and boundary != "start"

0 commit comments

Comments
 (0)