Skip to content

bagof.factories.collections

Factories for collection types (sequences, mappings, sets, etc.).

Classes

SequenceFactory

Bases: Factory[SEQUENCE]

Factory for [Sequence][bagof.factories.collections.abc.Sequence] hints (a list).

MappingFactory

Bases: Factory[MAPPING]

Factory for [Mapping][bagof.factories.collections.abc.Mapping] hints (a dict).

DictFactory

Bases: MappingFactory

Factory for dict hints (an empty dict).

SetFactory

Bases: Factory[ITERABLE]

Factory for [Set][bagof.factories.collections.abc.Set] hints (a set).

IterableFactory

Bases: Factory[ITERABLE]

Factory for [Iterable][bagof.factories.collections.abc.Iterable] hints (a list).

Also covers [Collection][bagof.factories.collections.abc.Collection], [Reversible][bagof.factories.collections.abc.Reversible] and [Container][bagof.factories.collections.abc.Container].

IteratorFactory

Bases: Factory[ITERABLE]

Factory for [Iterator][bagof.factories.collections.abc.Iterator] (an empty iterator).

Methods:

__call__
__call__() -> Iterator

Return an empty iterator.

TupleFactory

Bases: Factory[TUPLE]

Factory for tuple hints.

A fixed-length tuple builds a value for each element (Tuple[int, str] -> (0, "")).

Note

A variadic tuple (Tuple[int, ...]), an unparametrised tuple, or the empty tuple (Tuple[()]) builds an empty tuple, since no length is implied.

Methods:

__call__
__call__() -> TUPLE

Build a value for each element of a fixed-length tuple.