Spaces:
Running
Running
Download python_embed/Lib/site-packages/fontTools/misc/iterTools.py from Aluode/PerceptionLabPortable: direct link, hf CLI and curl.
- Browser
- Download file 402 Bytes
-
https://huggingface.co/spaces/Aluode/PerceptionLabPortable/resolve/main/python_embed/Lib/site-packages/fontTools/misc/iterTools.py
- Command line
-
hf download hf://spaces/Aluode/PerceptionLabPortable/python_embed/Lib/site-packages/fontTools/misc/iterTools.py
-
curl -L -o iterTools.py https://huggingface.co/spaces/Aluode/PerceptionLabPortable/resolve/main/python_embed/Lib/site-packages/fontTools/misc/iterTools.py
402 Bytes
| from itertools import * | |
| # Python 3.12: | |
| if "batched" not in globals(): | |
| # https://docs.python.org/3/library/itertools.html#itertools.batched | |
| def batched(iterable, n): | |
| # batched('ABCDEFG', 3) --> ABC DEF G | |
| if n < 1: | |
| raise ValueError("n must be at least one") | |
| it = iter(iterable) | |
| while batch := tuple(islice(it, n)): | |
| yield batch | |