ParameterInfo
- class app.util.helpers.generics.ParameterInfo[source]
Bases:
NamedTuple
Metadata describing a generic type parameter for a class or alias.
Inheritance Diagram for ParameterInfo
Methods
Return the raw argument bound to this parameter for the originating class.
Return the currently bound argument metadata for this parameter.
narrow
(target_cls, param)Resolve arbitrary parameter identifiers into a concrete
ParameterInfo
.Attributes
Return the evaluated bound of the underlying
TypeVar
orTypeAlias
if present.Return
True
if this parameter was declared on the originating class.Return the parameter name derived from the underlying
TypeVar
.The originating generic class or alias where the parameter was declared.
Return the typing origin for the originating class or alias.
Zero-based position of the parameter within the generic declaration.
The declared
TypeVar
for the parameter, if known.Return the evaluated value currently bound to the parameter.
- static __new__(_cls, position: int, raw_value: TypeVar | TypeAliasType | None, owner: type | GenericAlias)
Create new instance of ParameterInfo(position, raw_value, owner)
- Parameters:
position (int)
raw_value (TypeVar | TypeAliasType | None)
owner (type | GenericAlias)
- property bound: BoundType
Return the evaluated bound of the underlying
TypeVar
orTypeAlias
if present.
- get_argument() ArgType [source]
Return the raw argument bound to this parameter for the originating class.
- Return type:
ArgType
- get_argument_info() ArgumentInfo [source]
Return the currently bound argument metadata for this parameter.
- Return type:
- classmethod narrow(target_cls: ConcreteArgType, param: ParamType) ParameterInfo [source]
Resolve arbitrary parameter identifiers into a concrete
ParameterInfo
.- Raises:
GenericsError – If param is not declared on target_cls.
- Parameters:
target_cls (ConcreteArgType)
param (ParamType)
- Return type:
- owner: type | GenericAlias
The originating generic class or alias where the parameter was declared.
- raw_value: TypeVar | TypeAliasType | None
The declared
TypeVar
for the parameter, if known.
- property value: ArgType
Return the evaluated value currently bound to the parameter.