MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / chunkify

Function chunkify

docling/utils/utils.py:11–16  ·  view source on GitHub ↗

Yield successive chunks of chunk_size from the iterable.

(iterator, chunk_size)

Source from the content-addressed store, hash-verified

9
10
11def chunkify(iterator, chunk_size):
12 """Yield successive chunks of chunk_size from the iterable."""
13 if isinstance(iterator, List):
14 iterator = iter(iterator)
15 for first in iterator: # Take the first element from the iterator
16 yield [first] + list(islice(iterator, chunk_size - 1))
17
18
19def create_file_hash(path_or_stream: Union[BytesIO, Path]) -> str:

Callers 3

_convertMethod · 0.90
_enrich_documentMethod · 0.90
_build_documentMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected