Markers¶
uzi.markers
¶
T_Injected = t.TypeVar('T_Injected', covariant=True)
module-attribute
¶
The injected type.
T_Default = t.TypeVar('T_Default')
module-attribute
¶
Default value type.
T_Injectable = t.TypeVar('T_Injectable', bound='Injectable', covariant=True)
module-attribute
¶
An Injectable type.
PUBLIC: AccessModifier = AccessModifier.public
module-attribute
¶
public access modifier
PROTECTED: AccessModifier = AccessModifier.protected
module-attribute
¶
protected access modifier
GUARDED: AccessModifier = AccessModifier.guarded
module-attribute
¶
guarded access modifier
PRIVATE: AccessModifier = AccessModifier.private
module-attribute
¶
private access modifier
ONLY_SELF: ScopePredicate = ScopePredicate.only_self
module-attribute
¶
Only inject from the current scope without considering parents
SKIP_SELF: ScopePredicate = ScopePredicate.skip_self
module-attribute
¶
Skip the current scope and resolve from it's parent instead.
Injectable
¶
Abstract base class for injectable types.
An injectable is an object that can be used to represent a dependency.
Builtin injectable types:- type, TypeVar, FunctionType, MethodType,
GenericAlias
NonInjectable
¶
Abstract base class for non-injectable types.
DependencyMarker
¶
Bases: Injectable, t.Generic[T_Injectable]
Abstract base class for dependency markers.
Dependency markers are used reperesent and/or annotate dependencies.
AccessModifier
¶
Bases: ProEnumPredicate, Enum
Access modifier for dependencies
Attributes:
| Name | Type | Description |
|---|---|---|
public |
AccessModifier
|
public |
protected |
AccessModifier
|
protected |
guarded |
AccessModifier
|
guarded |
private |
AccessModifier
|
private |
ScopePredicate
¶
Bases: ProEnumPredicate, Enum
The context in which to provider resolution.
ProSlice
¶
Bases: ProPredicate, t.Generic[_T_Start, _T_Stop, _T_Step]
Represents a slice or the Provider resolution order
PureDep
¶
Bases: DependencyMarker, t.Generic[T_Injectable]
Explicitly marks given injectable as a dependency.
Attributes:
| Name | Type | Description |
|---|---|---|
abstract |
T_Injectable
|
the marked dependency. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
abstract |
T_Injectable
|
the dependency to mark. |
required |
Lookup
¶
Bases: DependencyMarker, BaseLookup
Represents a lazy lookup of a given dependency.
Attributes:
| Name | Type | Description |
|---|---|---|
__abstract__ |
Injectable
|
the dependency to lookup. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
abstract |
Injectable
|
the dependency to lookup. |
required |
is_injectable(obj)
¶
Returns True if the given type annotation is injectable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ |
type
|
The type annotation to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
is_injectable_annotation(typ)
¶
Returns True if the given type annotation is injectable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ |
type
|
The type annotation to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
is_dependency_marker(obj: t.Any, ind = 0) -> bool
¶
Check if object is a DependencyMarker
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj |
Any
|
the object to check |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|