Singleton helpers and boilerplate

class orion.core.utils.singleton.AbstractSingletonType(name, bases, dictionary)[source]

This will create singleton base classes, that need to be subclassed and implemented.

exception orion.core.utils.singleton.SingletonAlreadyInstantiatedError(name)[source]

Exception to be raised when someone provides arguments to build an object from a already-instantiated SingletonType class.

class orion.core.utils.singleton.SingletonFactory(name, bases, dictionary)[source]

Wrapping orion.core.utils.Factory with SingletonType. Keep compatibility with AbstractSingletonType.

exception orion.core.utils.singleton.SingletonNotInstantiatedError(name)[source]

Exception to be raised when someone try to access an instance of a singleton that has not been instantiated yet

class orion.core.utils.singleton.SingletonType(name, bases, dictionary)[source]

Metaclass that implements the singleton pattern for a Python class.


__call__(*args, **kwargs) Create an object if does not already exist, otherwise return what there is.

Replace singletons by given values and return previous singleton objects