Utilities¶
Utility modules
orion.core.utils – Package-wide useful routines¶
-
class
orion.core.utils.AbstractSingletonType(name, bases, dictionary)[source]¶ This will create singleton base classes, that need to be subclassed and implemented.
Methods
__call__(*args, **kwargs)Create an object if does not already exist, otherwise return what there is. mro(/)Return a type’s method resolution order. register(subclass)Register a virtual subclass of an ABC.
-
class
orion.core.utils.Factory(names, bases, dictionary)[source]¶ Instantiate appropriate wrapper for the infrastructure based on input argument,
of_type.Attributes: - types : list of subclasses of
cls.__base__ Updated to contain all possible implementations currently. Check out code.
- typenames : list of str
Names of implemented wrapper classes, correspond to possible
of_typevalues.
Methods
__call__(of_type, *args, **kwargs)Create an object, instance of cls.__base__, on first call.mro(/)Return a type’s method resolution order. register(subclass)Register a virtual subclass of an ABC. - types : list of subclasses of
-
exception
orion.core.utils.SingletonAlreadyInstantiatedError(name)[source]¶ Exception to be raised when someone provides arguments to build an object from a already-instantiated
SingletonTypeclass.
-
class
orion.core.utils.SingletonFactory(name, bases, dictionary)[source]¶ Wrapping
FactorywithSingletonType. Keep compatibility withAbstractSingletonType.Methods
__call__(*args, **kwargs)Create an object if does not already exist, otherwise return what there is. mro(/)Return a type’s method resolution order. register(subclass)Register a virtual subclass of an ABC.
-
exception
orion.core.utils.SingletonNotInstantiatedError(name)[source]¶ Exception to be raised when someone try to access an instance of a singleton that has not been instantiated yet