pydio.injector - Dependency injector

class pydio.injector.Injector(provider: pydio.base.IUnboundFactoryRegistry, env: Optional[Hashable] = None)

Bases: pydio.base.IInjector

Dependency injector main class.

Parameters
  • provider – Unbound factory provider to work on

  • env

    Name of the environment this injector will use when making queries to IUnboundFactoryRegistry object given via provider.

    This can be obtained f.e. from environment variable. Once injector is created you will not be able to change this.

    See IUnboundFactoryRegistry.get() for more details.

exception AlreadyClosedError(**kwargs)

Bases: pydio.exc.InjectorError

Raised when operation on a closed injector was performed.

exception NoProviderFoundError(key, env)

Bases: pydio.exc.InjectorError

Raised when there was no matching provider found for given key.

Parameters
  • key – Searched key

  • env – Searched environment

property env
property key
exception OutOfScopeError(key, scope, required_scope)

Bases: pydio.exc.InjectorError

Raised when there was attempt to create object that was registered for different scope.

Parameters
  • key – Searched key

  • scope – Injector’s own scope

  • required_scope – Required scope

property key
property required_scope
property scope
close()Optional[Awaitable[None]]

See pydio.base.IInjector.close().

property env

Environment assigned to this injector.

inject(key)

See IInjector.inject.

is_closed()bool

Return True if this injector was closed or False otherwise.

scoped(scope: Hashable, env: Optional[Hashable] = None)pydio.base.IInjector

See pydio.base.IInjector.scoped().