pyrio.iterators.stream_generator

Classes

StreamGenerator

Helper class wrapping generator-based operations for lazy evaluation

Module Contents

class pyrio.iterators.stream_generator.StreamGenerator

Helper class wrapping generator-based operations for lazy evaluation

static concat(*streams)

Concatenates multiple iterables into a single sequence

static filter(iterable, predicate)

Yields elements that satisfy the predicate

static map(iterable, mapper)

Applies mapper function to each element

static filter_map(iterable, mapper, discard_falsy=False)

Filters out None (or falsy) values and applies mapper to remaining elements

static flat_map(iterable, mapper)

Applies mapper and flattens the resulting iterables

classmethod flatten(iterable)

Recursively flattens nested iterables into a single sequence

static peek(iterable, operation)

Performs operation on each element without consuming the stream

static iterate(seed, operation, condition=None)

Generates sequence by repeatedly applying operation to seed

static generate(supplier)

Generates infinite sequence using supplier function

static range(start, stop, step=1)

Yields values from start to stop with given step

static distinct(iterable)

Yields unique elements preserving first occurrence order

static skip(iterable, count)

Skips first n elements and yields the rest

static limit(iterable, count)

Yields at most n elements

static tail(iterable, count)

Yields the last n elements

static take_while(iterable, predicate)

Yields elements while predicate is true

static drop_while(iterable, predicate)

Skips elements while predicate is true, then yields the rest

static sort(iterable, comparator=None, reverse=False)

Yields elements in sorted order

static enumerate(iterable, start=0)

Yields index-element pairs starting from given index