getInstanceOf

lsst.daf.butler.core.utils.getInstanceOf(typeOrName: Union[Type[CT_co], str], *args, **kwargs) → Any

Given the type name or a type, instantiate an object of that type.

If a type name is given, an attempt will be made to import the type.

Parameters:
typeOrName : str or Python class

A string describing the Python class to load or a Python type.

args : tuple

Positional arguments to use pass to the object constructor.

kwargs : dict

Keyword arguments to pass to object constructor.

Returns:
instance : object

Instance of the requested type, instantiated with the provided parameters.