control.config._process_param

control.config._process_param(name, defval, kwargs, alias_mapping, sigval=None)[source]

Process named parameter, checking aliases and legacy usage.

Helper function to process function arguments by mapping aliases to either their default keywords or to a named argument. The alias mapping is a dictionary that returns a tuple consisting of valid aliases and legacy aliases:

alias_mapping = {
     'argument_name_1': (['alias', ...], ['legacy', ...]),
     ...}

If param is a named keyword in the function signature with default value defval, a typical calling sequence at the start of a function is:

param = _process_param('param', defval, kwargs, function_aliases)

If param is a variable keyword argument (in kwargs), defval can be passed as either None or the default value to use if param is not present in kwargs.

Parameters
namestr

Name of the parameter to be checked.

defvalobject or dict

Default value for the parameter.

kwargsdict

Dictionary of variable keyword arguments.

alias_mappingdict

Dictionary providing aliases and legacy names.

sigvalobject, optional

Default value specified in the function signature (default = None). If specified, an error will be generated if defval is different than sigval and an alias or legacy keyword is given.

Returns
newvalobject

New value of the named parameter.

Raises
TypeError

If multiple keyword aliases are used for the same parameter.

Warns
PendingDeprecationWarning

If legacy name is used to set the value for the variable.