Functions | |
| Iterable[Any] | chunked (Iterable iterable, int chunked_num) |
| Iterable[Any] | chunked_or_all (Collection[Any] iterable, int chunked_num) |
| list[Any] | take (int take_num, Iterable iterable) |
Helpers for working with collections.
| Iterable[Any] homeassistant.util.collection.chunked | ( | Iterable | iterable, |
| int | chunked_num | ||
| ) |
Break *iterable* into lists of length *n*. From more-itertools
Definition at line 17 of file collection.py.
| Iterable[Any] homeassistant.util.collection.chunked_or_all | ( | Collection[Any] | iterable, |
| int | chunked_num | ||
| ) |
Break *collection* into iterables of length *n*. Returns the collection if its length is less than *n*. Unlike chunked, this function requires a collection so it can determine the length of the collection and return the collection if it is less than *n*.
Definition at line 25 of file collection.py.
| list[Any] homeassistant.util.collection.take | ( | int | take_num, |
| Iterable | iterable | ||
| ) |
Return first n items of the iterable as a list. From itertools recipes
Definition at line 9 of file collection.py.