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): for i in range(attachment_count):
att = pdf.get_attachment(i) att = pdf.get_attachment(i)
name = att.get_name() name = att.get_name()
if not name: # pragma: no cover - pypdfium2 cannot produce a if not name: # pragma: no cover - pypdfium2 always names them
# nameless attachment, so no craftable PDF reaches this.
continue continue
data = bytes(att.get_data()) data = bytes(att.get_data())
child_uri = f"{parent_uri}#attachment={quote(name, safe='')}" 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") yield DownloadProgress(model="docling", status="start")
await asyncio.to_thread(download_models) await asyncio.to_thread(download_models)
yield DownloadProgress(model="docling", status="done") yield DownloadProgress(model="docling", status="done")
except ImportError: # pragma: no cover - docling is installed in the test except ImportError: # pragma: no cover - docling installed in test env
# environment, and get_package_versions depends on it.
pass pass
# HuggingFace tokenizer # HuggingFace tokenizer

View file

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

View file

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

View file

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

View file

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

View file

@ -244,12 +244,18 @@ async def test_convert_dispatches_large_pdfs_through_split_and_merge(
assert called["path"] == pdf 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.asyncio
@pytest.mark.parametrize( @pytest.mark.parametrize(
"make_source,match", "make_source,match",
[ [
(lambda d: (d / "missing.md").as_uri(), "File does not exist"), (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"], 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): with pytest.raises(UnsupportedSourceError, match=match):
await convert(AppConfig(), make_source(tmp_path)) await convert(AppConfig(), make_source(tmp_path))
def _write_unsupported(directory):
target = directory / "thing.sqlite3"
target.write_bytes(b"binary")
return target.as_uri()