configClass

lsst.ts.wep.utils.configClass(config: Union[str, dict, None, Any], classObj: Any) Any

Configure the class.

This function is a generic wrapper around the process of passing a config to the __init__ function of a class, so that the passed config can take on a variety of types.

If config is a string, it is assumed to be the path to a config file, and this path is passed to the configFile argument of the class constructor. If config is a dictionary, then the contents are passed as keyword arguments. If config is an instance of the class, the instance is returned unchanged. If config is None, then the class is instantiated using its defaults.

Parameters:
configstr, dict, None, or class instance

The configuration for the class. See notes above.

classObjclass

A class that will be instantiated using the provided config. See notes above.

Returns:
class instance

An instance of the classObj class with the provided configuration

Raises:
TypeError

If classObj is not a class