faust.utils.functional

Functional utilities.

faust.utils.functional.consecutive_numbers(it: Iterable[int]) → Iterator[Sequence[int]][source]

Find runs of consecutive numbers.

Notes

See https://docs.python.org/2.6/library/itertools.html#examples

Return type

Iterator[Sequence[int]]

faust.utils.functional.deque_prune(l: Deque[T], max: int = None) → Optional[T][source]

Prune oldest element in deque if size exceeds max.

Return type

Optional[~T]

faust.utils.functional.deque_pushpopmax(l: Deque[T], item: T, max: int = None) → Optional[T][source]

Append to deque and remove oldest element if size exceeds max.

Return type

Optional[~T]