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.
- Parameters:
- nameOptional[str], optional
Identifier of the option in the configuration file.
- defaultOptional[Any], optional
Default value for the case that the option is not set in the config file.
- missingOptional[str], optional
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.
- constructorOptional[Callable], optional
Constructor function for complex config option behavior.
- checkerOptional[Callable], optional
Static function that checks if value is okay.
- converterOptional[Callable], optional
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)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
- __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.
- Parameters:
- nameOptional[str], optional
Identifier of the option in the configuration file.
- defaultOptional[Any], optional
Default value for the case that the option is not set in the config file.
- missingOptional[str], optional
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.
- constructorOptional[Callable], optional
Constructor function for complex config option behavior.
- checkerOptional[Callable], optional
Static function that checks if value is okay.
- converterOptional[Callable], optional
Static function that forces type interpretation.
- check(value: Any) bool[source]
If checker function set, check value. Assume everything is ok otherwise.
- constructor(func: Callable) Callable[source]
Decorator for declaring a constructor function for this ConfigOption.
- Parameters:
- funcCallable
Constructor function for this ConfigOption.
- Returns:
- Callable
Returns the original function so it can be used as a decorator.
- copy(**kwargs)[source]
Create a new instance of ConfigOption with copied values and update.
- Parameters:
- **kwargs
Extra arguments or overrides for the constructor of this class.
- property optional: bool
!! processed by numpydoc !!