Utilities

Package-wide useful routines

class orion.core.utils.Factory(name, bases, namespace, **kwargs)[source]

Instantiate appropriate wrapper for the infrastructure based on input argument, of_type.

Attributes
typesdict of subclasses of cls.__base__

Updated to contain all possible implementations currently. Check out code.

Methods

__call__(of_type, *args, **kwargs)

Create an object, instance of cls.__base__, on first call.

__call__(of_type, *args, **kwargs)[source]

Create an object, instance of cls.__base__, on first call.

Parameters
  • of_type – Name of class, subclass of cls.__base__, wrapper of a database framework that will be instantiated on the first call.

  • args – positional arguments to initialize cls.__base__’s instance (if any)

  • kwargs – keyword arguments to initialize cls.__base__’s instance (if any)

See also

Factory.types keys for values of argument of_type.

See also

Attributes of cls.__base__ and cls.__base__.__init__ for values of args and kwargs.

Note

New object is saved as Factory’s internal state.

Returns

The object which was created on the first call.

orion.core.utils.get_all_subclasses(parent)[source]

Get set of subclasses recursively

orion.core.utils.get_all_types(parent_cls, cls_name)[source]

Get all subclasses and lowercase subclass names

orion.core.utils.nesteddict()[source]

Define type of arbitrary nested defaultdicts Extend defaultdict to arbitrary nested levels.