pydsm.utilities.digested_options¶
- pydsm.utilities.digested_options(opts, defaults, keys=[], multikeys=[], emptycheck=True)¶
Helper function for the management of default options
This is used to validate and pre-digest the parameters of functions taking a variable number of keyword arguments with the **kwargs syntax.
Parameters: opts : dict
Dictionary of optional keyword arguments
defaults : dict
Dictionary of defaul values
keys : list
List of keys to extract whose value can be directly updated from the defaults
multikeys : list
List of keys to extract whose value must be recursively updated from the defaults dictionary (namely, value of a multikey is a dictionary itself)
emptychec : boolean
Whether to rise an error if items remain in opts after processing.
Returns: eopts : dict
Dictionary of extracted and validated options. This dictionary contains the values from the defaults dictionary, updated with the values passed in opts.
Notes
On exit, the input dictionary opt is changed, with all the validated options removed from it.