nip.parameters.parameters_base.ParameterValue#

class nip.parameters.parameters_base.ParameterValue[source]#

Base class for things which can be used as parameter values.

Methods Summary

_get_param_class_from_dict(param_dict)

Try to get the parameter class from a dictionary of serialised parameters.

from_dict(params_dict[, ignore_extra_keys])

Create a parameter value from a serialised dictionary.

to_dict()

Serialise the parameter value to a dictionary.

Methods

classmethod _get_param_class_from_dict(param_dict: dict) type[ParameterValue] | None[source]#

Try to get the parameter class from a dictionary of serialised parameters.

Parameters:

param_dict (dict) – A dictionary of parameters, which may have come from a to_dict method. This dictionary may contain a _type key, which is used to determine the class of the parameter.

Returns:

param_class (type[ParameterValue] | None) – The class of the parameter, if it can be determined.

Raises:

ValueError – If the class specified in the dictionary is not a valid parameter class.

abstract classmethod from_dict(params_dict: dict, ignore_extra_keys: bool = False) ParameterValue[source]#

Create a parameter value from a serialised dictionary.

abstract to_dict() dict[source]#

Serialise the parameter value to a dictionary.

The original parameter value must be able to be reconstructed from the dictionary using the from_dict method.

The dictionary may contain a _type key, which is used to specify the exact class of the parameter value.