angelos.lib.ioc

The Inversion of Control (IoC) framework is used as a central part of both the server and client. It is used to start application services and make them available in the whole application.

class angelos.lib.ioc.Config

Bases: object

Mixin for a Configuration class that might load and prepare the Container.

class angelos.lib.ioc.Container(config: dict = {})

Bases: object

The IoC Container class is responsible for initializing and globally enabling access to application services.

Parameters

config (dict) – The configuration being loaded into the IoC.

__config

Internal IoC configuration.

Type

dict

__instances

Instanced application services.

Type

dict

class angelos.lib.ioc.ContainerAware(ioc: angelos.lib.ioc.Container)

Bases: object

Mixin that makes its inheritors aware of the IoC container.

Parameters

ioc (Container) – The IoC Container.

__ioc

Internal reference to the IoC.

Type

type

property ioc

Makes the IoC container accessible publically.

Returns

The IoC container.

Return type

Container

class angelos.lib.ioc.Handle(_type: Any)

Bases: object

The Handle class allows application services to be instanciated at a later state, rather than on boot. This allows processes that are dependent on user input to make choises about services at runtime. The service in this handle can be set multiple times. Handle implements the Descriptor Protocol.

Parameters

_type (Any) – The service class type that should be put here.

__type

Internally the class type supported at runtime.

Type

Any

__value

Internally the instance of the application service class.

Type

Any

__name

Internally the name of the service.

Type

str

class angelos.lib.ioc.LogAware(ioc: angelos.lib.ioc.Container)

Bases: angelos.lib.ioc.ContainerAware

Mixin for log awareness, drop-in for ContainerAware.

CRITICAL = (41,)
NORMAL = (21,)
WARNING = (31,)
critical(msg, *args, **kwargs)

Log dangerous event.

log(msg, *args, **kwargs)

Log an event, not supposed to be used directly.

normal(msg, *args, **kwargs)

Log normal event.

warning(msg, *args, **kwargs)

Log suspicious event.

class angelos.lib.ioc.StaticHandle(_type: Any)

Bases: angelos.lib.ioc.Handle

The static handle works the same way as the Handle, except it can only be set once.