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
- optsdict
Dictionary of optional keyword arguments
- defaultsdict
Dictionary of defaul values
- keyslist
List of keys to extract whose value can be directly updated from the defaults
- multikeyslist
List of keys to extract whose value must be recursively updated from the defaults dictionary (namely, value of a multikey is a dictionary itself)
- emptychecboolean
Whether to rise an error if items remain in opts after processing.
- Returns
- eoptsdict
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.