fumus.queries.itertools_mixin

Classes

ItertoolsMixin

Module Contents

class fumus.queries.itertools_mixin.ItertoolsMixin[source]
NO_SIGNATURE_FUNCTIONS
NO_KWARGS_FUNCTIONS
iterable = None
use(it_function, **kwargs)[source]

Provides integration with itertools methods; pass corresponding parameters as kwargs

_handle_no_signature_functions(it_function, **kwargs)[source]
_handle_no_kwargs_functions(signature, it_function, **kwargs)[source]
_handle_default_signature_functions(signature, it_function, **kwargs)[source]
tabulate(mapper, start=0)[source]

Returns function(0), function(1), …

repeat_func(operation, times=None)[source]

Repeats calls to func with specified arguments

ncycles(count=0)[source]

Returns the query elements n times

consume(n=None)[source]

Advances the iterator n-steps ahead. If n is None, consumes query entirely

take_nth(idx, default=None)[source]

Returns Optional with the nth element of the query or a default value

all_equal(key=None)[source]

Returns True if all elements of the query are equal to each other

view(start=0, stop=None, step=None)[source]

Provides access to a selected part of the query

unique(key=None, reverse=False)[source]

Yields unique elements in sorted order. Supports unhashable inputs

static _unique(iterable, key=None)[source]
unique_just_seen(key=None)[source]

Yields unique elements, preserving order. Remembers only the element just seen

unique_ever_seen(key=None)[source]

Yields unique elements, preserving order. Remembers all elements ever seen

static _unique_ever_seen(iterable, key=None)[source]
sliding_window(n)[source]

Collects data into overlapping fixed-length chunks or blocks

static _sliding_window(iterable, n)[source]
grouper(n, *, incomplete='fill', fill_value=None)[source]

Collects data into non-overlapping fixed-length chunks or blocks

_grouper(n, incomplete='fill', fill_value=None)[source]
round_robin()[source]

Visits input iterables in a cycle until each is exhausted

static _round_robin(iterable)[source]
partition(predicate)[source]

Partitions entries into true and false entries. Returns a query of two nested generators

subslices()[source]

Returns all contiguous non-empty sub-slices

find_indices(value, start=0, stop=None)[source]

Returns indices where a value occurs in a sequence or iterable

static _find_indices(iterable, value, start=0, stop=None)[source]