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_type values.

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.
exception orion.core.utils.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.SingletonFactory(name, bases, dictionary)[source]

Wrapping Factory with SingletonType. Keep compatibility with AbstractSingletonType.

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

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

Metaclass that implements the singleton pattern for a Python class.

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.
orion.core.utils.nesteddict()[source]

Extend defaultdict to arbitrary nested levels.