bagof.factories.collections
Factories for collection types (sequences, mappings, sets, etc.).
Classes
SequenceFactory
MappingFactory
DictFactory
SetFactory
MutableSetFactory
IterableFactory
IteratorFactory
TupleFactory
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:
NamedTupleFactory
Factory for NamedTuple subclasses.
Builds a real instance, taking each field's declared default where
there is one and otherwise building a value from the field's
annotation -- the same shape
TypedDictFactory
has for dicts.
Note
A NamedTuple is a plain tuple subclass at runtime, so it cannot
be a registry key of its own;
TupleFactory
recognises one and delegates here.
Example