Normalize pragma comments to the codebase's single-line form

This commit is contained in:
Yiorgis Gozadinos 2026-07-26 20:18:19 +03:00
parent f6acb65e95
commit 7ba78fdde3
No known key found for this signature in database
7 changed files with 17 additions and 26 deletions

View file

@ -570,8 +570,7 @@ def _extract_pdf_attachments(
for i in range(attachment_count):
att = pdf.get_attachment(i)
name = att.get_name()
if not name: # pragma: no cover - pypdfium2 cannot produce a
# nameless attachment, so no craftable PDF reaches this.
if not name: # pragma: no cover - pypdfium2 always names them
continue
data = bytes(att.get_data())
child_uri = f"{parent_uri}#attachment={quote(name, safe='')}"

View file

@ -38,8 +38,7 @@ async def download_models(
yield DownloadProgress(model="docling", status="start")
await asyncio.to_thread(download_models)
yield DownloadProgress(model="docling", status="done")
except ImportError: # pragma: no cover - docling is installed in the test
# environment, and get_package_versions depends on it.
except ImportError: # pragma: no cover - docling installed in test env
pass
# HuggingFace tokenizer

View file

@ -143,9 +143,7 @@ class FSSource:
if path.is_symlink():
try:
resolved = path.resolve(strict=False)
except OSError: # pragma: no cover - strict=False absorbs
# symlink cycles and missing targets, so no real link
# reaches this; kept as a guard against platform drift.
except OSError: # pragma: no cover - strict=False absorbs these
continue
if not resolved.is_relative_to(self.root):
continue

View file

@ -356,8 +356,7 @@ class Sandbox:
return read_toc
for doc in docs:
if not doc.id: # pragma: no cover - rows read from LanceDB always
# carry an id; only a hand-built Document could be id-less.
if not doc.id: # pragma: no cover - stored rows always carry an id
continue
doc_id: str = doc.id
doc_dir = f"/documents/{doc_id}"
@ -438,11 +437,10 @@ class Sandbox:
stdout_lines: list[str] = []
def print_callback(_stream: Literal["stdout"], text: str) -> None:
# pragma: no cover - Monty invokes this from its own Rust-owned
# thread, which coverage cannot trace. The captured stdout is
# asserted by test_execute_simple_code.
stdout_lines.append(text) # pragma: no cover
def print_callback( # pragma: no cover - runs on Monty's Rust thread
_stream: Literal["stdout"], text: str
) -> None:
stdout_lines.append(text)
max_chars = self._config.analysis.max_output_chars

View file

@ -606,9 +606,7 @@ class Store:
for tag in tags.values()
if tag["version"] in timestamps
]
if not tagged: # pragma: no cover - a tag's version is never absent from
# list_versions: vacuum retains every version at or after the
# oldest tag, so a tagged version is never cleaned away.
if not tagged: # pragma: no cover - vacuum never cleans a tagged version
return retention
# LanceDB version timestamps are naive datetimes in local time.

View file

@ -74,8 +74,7 @@ class ChunkMetadata(BaseModel):
continue
for prov_item in prov:
bbox = getattr(prov_item, "bbox", None)
if bbox is None: # pragma: no cover - docling's ProvenanceItem
# always carries a bbox; guards against a shape change.
if bbox is None: # pragma: no cover - prov always carries a bbox
continue
bounding_boxes.append(
BoundingBox(

View file

@ -244,12 +244,18 @@ async def test_convert_dispatches_large_pdfs_through_split_and_merge(
assert called["path"] == pdf
def _write_unsupported(directory):
target = directory / "thing.sqlite3"
target.write_bytes(b"binary")
return target.as_uri()
@pytest.mark.asyncio
@pytest.mark.parametrize(
"make_source,match",
[
(lambda d: (d / "missing.md").as_uri(), "File does not exist"),
(lambda d: _write_unsupported(d), "Unsupported file extension"),
(_write_unsupported, "Unsupported file extension"),
],
ids=["missing_file", "unsupported_extension"],
)
@ -258,9 +264,3 @@ async def test_convert_rejects_bad_file_uris(tmp_path, make_source, match):
with pytest.raises(UnsupportedSourceError, match=match):
await convert(AppConfig(), make_source(tmp_path))
def _write_unsupported(directory):
target = directory / "thing.sqlite3"
target.write_bytes(b"binary")
return target.as_uri()