Skip to content

Scopes

uzi.scopes

Scope

Bases: t.Generic[_T_Injector]

An isolated dependency resolution scope for a given container.

Scopes assemble the dependency graphs of dependencies registered in their container.

Attributes:

Name Type Description
container Container

The container who's scope we are creating

parent Scope

The parent scope. Defaults to None

Parameters:

Name Type Description Default
container Container

The container who's scope we are creating

required
parent Scope

The parent scope. Defaults to NullScope

None

ThreadSafeScope

Bases: Scope[_T_Injector]

A thread safe Scope implementation

ThreadLocalScope

Bases: Scope[_T_Injector]

A scope that uses threading.local to manage injectors

ContextLocalScope

Bases: Scope[_T_Injector]

A scope that uses contextvars.ContextVar to manage injectors

NullScope

Bases: Scope[NullInjector]

A 'noop' Scope used as the parent of root scopes.

Attributes:

Name Type Description
parent None

The parent scope

graph NullGraph
Back to top