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__ or BpsConfig.get.

Parameters:
configBpsConfig

Configuration from which to retrieve value.

keystr

Key name.

dataTypetype

We require that the returned value have this type.

defaultoptional

Default value to be provided if key doesn’t exist in the config. A default value of None means that there is no default.

requiredbool, optional

If True, the returned value may come from the configuration or from the default, but it may not be None.

Returns:
value

Value for key in the config` if it exists, otherwise default, if provided.

Raises:
KeyError

If key is not in config and no default is provided but a value is required.

RuntimeError

If the value is not set or is of the wrong type.