- class foxes.utils.Factory[source]
Constructs objects from a choice of allowed constructor parameters
Attributes¶
- 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
- example: str
An example name
- 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¶
- property name_prefix
The beginning of the name template
- property name_suffix
The ending of the name template
- property variables
The list of variables
- get_examples(**var_values)[source]
Create example names from given values
-
check_match(name, error=
False
, ret_pars=False
)[source] Tests if a name matches the template and constructs parameters