class foxes.utils.Factory[source]

Constructs objects from a choice of allowed constructor parameters


base: class

The class of which objects are to be created

name_template: str

The name template, e.g. ‘name_<A>_<B>_<C>’ for variables A, B, C

args: tuple

Fixed arguments for the base class

kwargs: dict

Fixed arguments for the base class

var2arg: dict

Mapping from variable to constructor argument

hints: dict

Hints for print_toc, only for variables for which the options are functions or missing

options: dict

For each variable, e.g. A, B or C, the list or dict or function that maps a str to the actual value

Public members

Factory(base, name_template, args=(), kwargs={}, var2arg={}, ...)[source]


property name_prefix

The beginning of the name template

property name_suffix

The ending of the name template

property variables

The list of variables


String representation


Tests if a name matches the template


Create an object of the base class.