pydox.set_params

Contents

pydox.set_params#

set_params(param_or_grp: str, value: Any | Dict = None, **kwargs) → None[source]#

Set the value of a configuration parameter or (sub)group of parameters

Parameter or (sub)groups of parameters are modified in place.

Parameters:
  • param_or_grp (str) –

    The parameter name or (sub)group of parameters to assign value(s) to. Use a string-dotted notation if necessary, eg:

    • argo.qcflags.doxy set a single parameter value,

    • argo.qcflags set a subgroup of parameters, expect value as a dict or with keyword arguments.

    • argo set a group of parameters, expect value as a dict or with keyword arguments.

  • value (Any, Dict, default=None) – The value to be assigned to param_or_grp. If set to None, assume to be setting a group of parameters using keyword arguments (see examples below).

  • **kwargs – Use keyword arguments to set parameters for a (sub)group (see examples below).

  • config (None | Config) – The configuration object to set parameters to. By default, use the global configuration object pydox.params.

Examples

Listing 1 Set one parameter value#
# Directly:
do.set_params('argo.qcflags.psal', [1, 2, 8])

# or at the subgroup level:
do.set_params('argo.qcflags', psal=[1, 2, 8])

# or at the group level:
do.set_params('argo', qcflags={'psal': [1, 2, 8]})
Listing 2 Set a (sub)group of parameter values at the group level#
# with keywords:
do.set_params('argo', qcflags={'psal': [1, 2, 8], 'temp': [1, 2, 8]})

# or a nested dictionary:
do.set_params('argo', {'qcflags': {'psal': [1, 2, 8], 'temp': [1, 2, 8]}})
Listing 3 Set a (sub)group of parameter values at the subgroup level#
# with keywords:
do.set_params('argo.qcflags', psal=[1, 2, 8], temp=[1, 2, 8])

# or a dictionary:
do.set_params('argo.qcflags', {'psal': [1, 2, 8], 'temp': [1, 2, 8]})