(iterable: Iterable[Any], n: int)
| 12 | from itertools import islice |
| 13 | |
| 14 | def batched(iterable: Iterable[Any], n: int) -> Iterable[tuple[Any]]: |
| 15 | it = iter(iterable) |
| 16 | while batch := tuple(islice(it, n)): |
| 17 | yield batch |
| 18 | |
| 19 | |
| 20 | if TYPE_CHECKING: # pragma: nocoverage |
no outgoing calls
no test coverage detected
searching dependent graphs…