Tighten _merge_picture_chunks type annotations
Restore the typing the merge logic carried inline before extraction: text_chunks: list[Chunk], existing_picture_data: dict[str, bytes] | None, -> list[Chunk], and first_pos(c: Chunk) -> int. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c59f88bcd6
commit
141e288b83
1 changed files with 5 additions and 5 deletions
|
|
@ -169,11 +169,11 @@ async def convert(
|
||||||
|
|
||||||
|
|
||||||
def _merge_picture_chunks(
|
def _merge_picture_chunks(
|
||||||
docling_document,
|
docling_document: "DoclingDocument",
|
||||||
text_chunks: list,
|
text_chunks: list[Chunk],
|
||||||
document_id: str | None,
|
document_id: str | None,
|
||||||
existing_picture_data: dict | None,
|
existing_picture_data: dict[str, bytes] | None,
|
||||||
) -> list:
|
) -> list[Chunk]:
|
||||||
picture_chunks = build_picture_chunks(
|
picture_chunks = build_picture_chunks(
|
||||||
docling_document,
|
docling_document,
|
||||||
document_id=document_id,
|
document_id=document_id,
|
||||||
|
|
@ -190,7 +190,7 @@ def _merge_picture_chunks(
|
||||||
for pos, (item, _level) in enumerate(docling_document.iterate_items())
|
for pos, (item, _level) in enumerate(docling_document.iterate_items())
|
||||||
}
|
}
|
||||||
|
|
||||||
def first_pos(c):
|
def first_pos(c: Chunk) -> int:
|
||||||
refs = (c.metadata or {}).get("doc_item_refs") or []
|
refs = (c.metadata or {}).get("doc_item_refs") or []
|
||||||
return positions.get(refs[0], len(positions)) if refs else len(positions)
|
return positions.get(refs[0], len(positions)) if refs else len(positions)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue