Module rpu.iterables

Functions

def chunk(iterable: Iterable[~T], max_size: int) ‑> Iterable[list[~T]]

|iterable|

Chunks the given iterable into chunks of the given size

Parameters

iterable : typing.Iterable
The iterable you want to chunk
max_size : int
the max size of the chunks

Notes

If the given iterable is async, use <code><a title="rpu.async_.iterables.chunk" href="async_/iterables.html#rpu.async_.iterables.chunk">chunk()</a></code> instead
def get(iterable: Iterable[~T], /, **attrs: Any) ‑> Optional[~T]

Gets an item from the given iterable with sertain attributes

Parameters

iterable : typing.Iterable
The item you want to be iterated through
**attrs : typing.Any
The attribute(s) to check for

Notes

If the given iterable is async, use <code><a title="rpu.async_.iterables.get" href="async_/iterables.html#rpu.async_.iterables.get">get()</a></code> instead