get_bps_config_value¶
- lsst.ctrl.bps.parsl.get_bps_config_value(config: BpsConfig, key: str, dataType: type[T], default: T) T ¶
- lsst.ctrl.bps.parsl.get_bps_config_value(config: BpsConfig, key: str, dataType: type[T], default: T | None = None, *, required: Literal[True]) T
- lsst.ctrl.bps.parsl.get_bps_config_value(config: BpsConfig, key: str, dataType: type[T], default: T | None = None) T | None
Get a value from the BPS configuration.
I find this more useful than
BpsConfig.__getitem__
orBpsConfig.get
.- Parameters:
- config
BpsConfig
Configuration from which to retrieve value.
- key
str
Key name.
- dataType
type
We require that the returned value have this type.
- defaultoptional
Default value to be provided if
key
doesn’t exist in theconfig
. A default value ofNone
means that there is no default.- required
bool
, optional If
True
, the returned value may come from the configuration or from the default, but it may not beNone
.
- config
- Returns:
- value
Value for
key
in theconfig`
if it exists, otherwisedefault
, if provided.
- Raises:
- KeyError
If
key
is not inconfig
and no default is provided but a value isrequired
.- RuntimeError
If the value is not set or is of the wrong type.