qudi.core.ConfigOption
- class qudi.core.ConfigOption(name: str | None = None, default: Any | None = None, *, missing: str | None = 'nothing', constructor: Callable | None = None, checker: Callable | None = None, converter: Callable | None = None)[source]
Bases:
builtins.objectThis class represents a configuration entry in the config file that is loaded before module initalisation.
- __init__(name: str | None = None, default: Any | None = None, *, missing: str | None = 'nothing', constructor: Callable | None = None, checker: Callable | None = None, converter: Callable | None = None)[source]
Create a ConfigOption object.
@param name: identifier of the option in the configuration file @param default: default value for the case that the option is not set in the config file @param missing: action to take when the option is not set. ‘nothing’ does nothing, ‘warn’
logs a warning, ‘error’ logs an error and prevents the module from loading
@param constructor: constructor function for complex config option behaviour @param checker: static function that checks if value is ok @param converter: static function that forces type interpretation
Methods
__init__([name, default, missing, ...])Create a ConfigOption object.
check(value)If checker function set, check value.
constructor(func)This is the decorator for declaring a constructor function for this ConfigOption.
convert(value)If converter function set, convert value (pass-through otherwise).
copy(**kwargs)Create a new instance of ConfigOption with copied values and update
Attributes
optional- check(value: Any) bool[source]
If checker function set, check value. Assume everything is ok otherwise.