paramspace.yaml_constructors module¶
Defines the yaml constructors for the generation of
ParamSpace
and
ParamDim
during loading of YAML files.
Note that they are not registered in this module but in the
paramspace.yaml
module.
-
paramspace.yaml_constructors.
pspace
(loader, node) → paramspace.paramspace.ParamSpace[source]¶ yaml constructor for creating a ParamSpace object from a mapping.
Suggested tag:
!pspace
-
paramspace.yaml_constructors.
pspace_unsorted
(loader, node) → paramspace.paramspace.ParamSpace[source]¶ yaml constructor for creating a ParamSpace object from a mapping.
Unlike the regular constructor, this one does NOT sort the input before instantiating ParamSpace.
Suggested tag:
!pspace-unsorted
-
paramspace.yaml_constructors.
pdim
(loader, node) → paramspace.paramdim.ParamDim[source]¶ constructor for creating a ParamDim object from a mapping
Suggested tag:
!pdim
-
paramspace.yaml_constructors.
pdim_default
(loader, node) → paramspace.paramdim.ParamDim[source]¶ constructor for creating a ParamDim object from a mapping, but only return the default value.
Suggested tag:
!pdim-default
-
paramspace.yaml_constructors.
coupled_pdim
(loader, node) → paramspace.paramdim.CoupledParamDim[source]¶ constructor for creating a CoupledParamDim object from a mapping
Suggested tag:
!coupled-pdim
-
paramspace.yaml_constructors.
coupled_pdim_default
(loader, node) → paramspace.paramdim.CoupledParamDim[source]¶ constructor for creating a CoupledParamDim object from a mapping, but only return the default value.
Suggested tag:
!coupled-pdim-default
-
paramspace.yaml_constructors.
_pspace_constructor
(loader, node, sort_if_mapping: bool = True) → paramspace.paramspace.ParamSpace[source]¶ Constructor for instantiating ParamSpace from a mapping or a sequence
-
paramspace.yaml_constructors.
_pdim_constructor
(loader, node) → paramspace.paramdim.ParamDim[source]¶ Constructor for creating a ParamDim object from a mapping
For it to be incorported into a ParamSpace, one parent (or higher) of this node needs to be tagged such that the pspace_constructor is invoked.
-
paramspace.yaml_constructors.
_coupled_pdim_constructor
(loader, node) → paramspace.paramdim.ParamDim[source]¶ Constructor for creating a ParamDim object from a mapping
For it to be incorported into a ParamSpace, one parent (or higher) of this node needs to be tagged such that the pspace_constructor is invoked.
-
paramspace.yaml_constructors.
_list_constructor
(loader, node)[source]¶ Constructor for lists, where node can be a mapping or sequence
-
paramspace.yaml_constructors.
recursively_sort_dict
(d: dict) → collections.OrderedDict[source]¶ Recursively sorts a dictionary by its keys, transforming it to an OrderedDict in the process.
From: http://stackoverflow.com/a/22721724/1827608
- Parameters
d (dict) – The dictionary to be sorted
- Returns
the recursively sorted dict
- Return type
OrderedDict