smarts.core.utils.class_factory module

class smarts.core.utils.class_factory.ClassFactory(name, entrypoint=None, **kwargs)[source]

A named factory that can preconfigure generation of objects.

make(**kwargs)[source]

Provides an object from the entrypoint. Overriding predefined keyword arguments with the given keyword arguments.

class smarts.core.utils.class_factory.ClassRegister[source]

A listing of key named class factories.

all()[source]

Lists all available factory objects.

find_factory(locator)[source]

Locates a factory given a locator.

make(locator, **kwargs)[source]

Calls the factory with locator name key supplying the keyword arguments as argument overrides.

register(name, entry_point=None, **kwargs)[source]

Registers a new factory with the given locator as the key. :param locator: The key value of the factory. :param entry_point: The factory method. :param kwargs: Predefined arguments to the factory method.

smarts.core.utils.class_factory.find_attribute_spec(name)[source]

Finds the attribute specification from a reachable module. :param name: The module and attribute name (i.e. smarts.core.lidar:Lidar, …)

smarts.core.utils.class_factory.is_valid_locator(locator: str)[source]

Validate the given locator.