les_iterables package

Submodules:

Summary

__all__ Functions:

alternate_with

Generate a series from items, alternating with an alternate item.

append

Yield an iterable followed by an item.

append_if

Yield an iterable, conditionally followed by an item.

append_unique

Append an item to a sequence if it is not already present.

concat

Concatenate one of more sequences of compatible types.

duplicates

Find duplicate items.

ensure_contains

Yield items, followed by ensured_item, if ensured_item is not already present.

expand_numbered_list

Expands a string containing numbered items into a list of integers.

extend

Extend an iterable by yielding items returned by a factory.

extend_unique

Extend a sequence with items which are not already present.

first_matching

The first item matching a predicate.

generate

A decorator factory to make a generator return a fully realised collection.

group_by_terminator

Group the items of of an iterable series, starting a new group after each terminator.

insert_unique

Insert an item into a sequence if it is not already present.

join_with

Generate a series of items, with separators taken from a second series.

nth_matching

The nth item matching a predicate.

one

Yield an iterable series of one item.

pairwise_padded

Each item in an iterable series with its successor.

partition

partition_tail

Lazily partition an iterable series into a head, and tail of no more than specified length.

pop_n

Remove n items from the end of a sequence.

prepend

Yield an item followed by an iterable.

prepend_if

Conditionally yield an item, followed by an iterable.

prepend_unique

Prepend an item to a sequence if it is not already present.

range_from_text

A range of integers from a textual description.

reject_falsy

Reject those items which evaluate to False in a boolean context.

reject_if

Retain those items for which predicate evaluates to True.

reject_if_none

Reject those items which are None.

reject_truthy

Reject those items which evaluate to True in a boolean context.

repeat_first

Repeat the first item from an iterable on the end.

replace_range

Replace the elements of s in a range with a new sequence.

retain_falsy

Retain those items which evaluate to False in a boolean context.

retain_if

Retain those items for which predicate evaluates to True.

retain_if_not_none

Retain those items which are not None.

retain_truthy

Retain those items which evaluate to True in a boolean context.

separate_with

Generate a series from items, where the original items are separated by another item.

single

skip_while

Skip leading items while the predicate matches.

split_after_first

Split the iterable after the element matching the predicate.

split_around

Split an iterable series into groups around specific items.

take_after_inclusive

Yield items starting with the first match.

take_after_last_match

Yield items in an iterable series after the last matching.

take_before_exclusive

Yield items up to but excluding including the first match.

take_before_inclusive

Yield items up to and including the first match.

take_between_inclusive

A list of items from the first matching to the last matching inclusive.

take_between_inclusive_values

A list of items from the first matching to the last matching inclusive.

take_until_exclusive

Yield items up to but excluding the first match.

take_until_inclusive

Yield items up and including the first match.

transform_if

Apply a transformation to items which match a predicate.