Skip to content

Commit 1afbe1f

Browse files
committed
fix lint
f
1 parent f7d652b commit 1afbe1f

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
1616
uses: actions/setup-python@v2
1717
with:
1818
python-version: '3.10'
19+
- name: Set up JDK
20+
uses: actions/setup-java@v6
21+
with:
22+
distribution: 'temurin'
23+
java-version: '25'
1924

2025
- name: Install dependencies
2126
run: |

dedoc/readers/pdf_reader/pdf_auto_reader/txtlayer_detector.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def __classify_all_pages(
7272
# by the time the second read would reference them.
7373
pages_reusable = (
7474
not reusable
75-
and start == 1
76-
and get_param_pdf_with_txt_layer(parameters) == "auto_tabby"
77-
and not get_param_with_attachments(parameters)
75+
and start == 1 # noqa W503
76+
and get_param_pdf_with_txt_layer(parameters) == "auto_tabby" # noqa W503
77+
and not get_param_with_attachments(parameters) # noqa W503
7878
)
7979
detected_pages = [] if pages_reusable else None
8080
if reusable:
@@ -98,8 +98,16 @@ def __classify_all_pages(
9898
first_page_lines = [line for line in document.lines if line.metadata.page_id == 0]
9999
first_page_correct = txtlayer_classifier.predict([first_page_lines])[0]
100100
if first_page_correct:
101-
return [TxtLayerResult(correct=True, start=start, end=end, document=reuse_document,
102-
detected_pages=detected_pages, detected_last_page=detected_last_page)]
101+
return [
102+
TxtLayerResult(
103+
correct=True,
104+
start=start,
105+
end=end,
106+
document=reuse_document,
107+
detected_pages=detected_pages,
108+
detected_last_page=detected_last_page
109+
)
110+
]
103111
else:
104112
# the leading pages are not read as one chunk here, so the detection extraction cannot be reused as-is
105113
return [TxtLayerResult(correct=False, start=start, end=start), TxtLayerResult(correct=True, start=start + 1, end=end)]

dedoc/readers/pdf_reader/pdf_txtlayer_reader/pdf_tabby_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def __process_pdf(self,
416416
import os
417417

418418
self.__run(path=path, start_page=start_page, end_page=end_page, tmp_dir=tmp_dir, remove_frame=remove_frame, gost_json_path=gost_json_path)
419-
with open(os.path.join(tmp_dir, "data.json"), "r", encoding="utf-8") as response: # encoding= : data.json is UTF-8, avoids cp1251 breakage on RU-locale Windows
419+
with open(os.path.join(tmp_dir, "data.json"), "r", encoding="utf-8") as response:
420420
return json.load(response)
421421

422422
def _process_one_page(self,

0 commit comments

Comments
 (0)