Qudi
Public Member Functions | Public Attributes | List of all members
core.module.ConfigOption Class Reference

This class represents a configuration entry in the config file that is loaded before module initalisation. More...

Public Member Functions

def __init__ (self, name=None, default=None, var_name=None, missing='nothing', constructor=None, checker=None, converter=None)
 Create a ConfigOption object. More...
 
def copy (self, kwargs)
 Create a new instance of ConfigOption with copied values and update. More...
 
def check (self, value)
 If checker function set, check value. More...
 
def convert (self, value)
 If converter function set, convert value. More...
 
def constructor (self, func)
 This is the decorator for declaring a constructor function for this ConfigOption. More...
 

Public Attributes

 missing
 
 var_name
 
 name
 
 default
 
 constructor_function
 
 checker
 
 converter
 

Detailed Description

This class represents a configuration entry in the config file that is loaded before module initalisation.

Constructor & Destructor Documentation

◆ __init__()

def core.module.ConfigOption.__init__ (   self,
  name = None,
  default = None,
  var_name = None,
  missing = 'nothing',
  constructor = None,
  checker = None,
  converter = None 
)

Create a ConfigOption object.

Parameters
nameidentifier of the option in the configuration file
defaultdefault value for the case that the option is not set in the config file
var_namename of the variable inside a running module. Only set this if you know what you are doing!
missingaction 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
constructorconstructor function for complex config option behaviour
checkerstatic function that checks if value is ok
converterstatic function that forces type interpretation

Member Function Documentation

◆ check()

def core.module.ConfigOption.check (   self,
  value 
)

If checker function set, check value.

Else assume everything is ok.

◆ constructor()

def core.module.ConfigOption.constructor (   self,
  func 
)

This is the decorator for declaring a constructor function for this ConfigOption.

Parameters
funcconstructor function for this ConfigOption
Returns
: return the original function so this can be used as a decorator

◆ convert()

def core.module.ConfigOption.convert (   self,
  value 
)

If converter function set, convert value.

Needs to raise exception on error.

       @param value: value to convert (or not)

       @return: converted value (or passthrough)

◆ copy()

def core.module.ConfigOption.copy (   self,
  kwargs 
)

Create a new instance of ConfigOption with copied values and update.

Parameters
kwargsextra arguments or overrides for the constructor of this class

The documentation for this class was generated from the following file: