MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / chunk

Function chunk

tortoise/utils.py:49–57  ·  view source on GitHub ↗

Generate iterable chunk by batch_size # noqa: DAR301

(instances: Iterable[Any], batch_size: int | None = None)

Source from the content-addressed store, hash-verified

47
48
49def chunk(instances: Iterable[Any], batch_size: int | None = None) -> Iterable[Iterable[Any]]:
50 """
51 Generate iterable chunk by batch_size
52 # noqa: DAR301
53 """
54 if not batch_size:
55 yield instances
56 else:
57 yield from batched(instances, batch_size)

Callers 2

_make_queriesMethod · 0.90
_execute_manyMethod · 0.90

Calls 1

batchedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…