Skip to content

Commit b9a039a

Browse files
committed
Fix failing config test and clean up lint warnings
- tests: align test_default_config_ocr_language with intentional omission of ocr.language from defaults (auto-detected on first run by services.settings._load_language_settings) - nautilus extension: sort imports (ruff I001) - odf_builder, tsv_odf_converter: drop stale noqa directives for rules not enabled in pyproject - window_actions: rename loop variable to avoid PLW2901 reassignment
1 parent 354cff6 commit b9a039a

5 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/bigocrpdf/utils/odf_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ def _render_element(elem: DocElement) -> None:
489489

490490
def _render_table(doc, rows, tbl_s, cell_s, hdr_cell_s, cell_txt_s, cell_txt_l, bold_s, counter):
491491
"""Render a table into the ODF document."""
492-
from odf.style import Style, TableColumnProperties # noqa: F811
493-
from odf.table import Table, TableCell, TableColumn, TableRow # noqa: F811
494-
from odf.text import P, Span # noqa: F811
492+
from odf.style import Style, TableColumnProperties
493+
from odf.table import Table, TableCell, TableColumn, TableRow
494+
from odf.text import P, Span
495495

496496
if not rows:
497497
return

src/bigocrpdf/utils/tsv_odf_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
is_table_line,
1717
split_words_by_columns,
1818
)
19-
from bigocrpdf.utils.logger import logger # noqa: I001
19+
from bigocrpdf.utils.logger import logger
2020
from bigocrpdf.utils.odf_builder import _extract_pdf_images, create_odf
2121
from bigocrpdf.utils.tsv_parser import (
2222
MIN_TABLE_ROWS,

src/bigocrpdf/window_actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ def _on_clipboard_uris_ready(self, clipboard: Gdk.Clipboard, result: Gio.AsyncRe
140140

141141
# Parse URIs — one per line, skip action lines like "copy" or "cut"
142142
file_paths: list[str] = []
143-
for line in raw.strip().splitlines():
144-
line = line.strip()
143+
for raw_line in raw.strip().splitlines():
144+
line = raw_line.strip()
145145
if not line or line in ("copy", "cut"):
146146
continue
147147
parsed = urlparse(line)

tests/test_config_manager.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ def test_nested_key_path(self):
4141
cm.set("a.b.c", 42, save_immediately=False)
4242
assert cm.get("a.b.c") == 42
4343

44-
def test_default_config_has_ocr_language(self):
44+
def test_default_config_ocr_language_absent(self):
45+
# Language is intentionally omitted from defaults so Settings can
46+
# auto-detect from system locale on first run; see config_manager
47+
# DEFAULT_CONFIG and services.settings._load_language_settings.
4548
with tempfile.TemporaryDirectory() as d:
4649
cm = self._make_manager(d)
47-
lang = cm.get("ocr.language")
48-
assert isinstance(lang, str)
50+
assert cm.get("ocr.language") is None
4951

5052
def test_load_existing_config(self):
5153
with tempfile.TemporaryDirectory() as d:

usr/share/nautilus-python/extensions/bigocrpdf-actions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Nautilus extension for BigOCR PDF / BigOCR Image context menu actions."""
22

3-
import os
43
import locale
4+
import os
55
import subprocess
6-
from gi.repository import Nautilus, GObject
6+
7+
from gi.repository import GObject, Nautilus
78

89
# Image MIME types supported by the application
910
_IMAGE_MIMES = frozenset((

0 commit comments

Comments
 (0)