GenericIntrospectionMethod
- class app.util.helpers.generics.GenericIntrospectionMethod[source]
Bases:
classmethod
[Any
, …,type
[R
]],Generic
Descriptor that resolves generic parent arguments on demand.
Inheritance Diagram for GenericIntrospectionMethod
Methods
__init__
([param])Initialise the descriptor and capture default keyword arguments.
Attributes
Resolve and cache the concrete parent argument defined by the descriptor.
- __init__(param: TypeVar | None = None, **kwargs: Unpack[GetConcreteParentArgumentKwargs]) None [source]
Initialise the descriptor and capture default keyword arguments.
- Parameters:
param (TypeVar | None)
kwargs (Unpack[GetConcreteParentArgumentKwargs])
- Return type:
None
- property introspect: type[R][source]
Resolve and cache the concrete parent argument defined by the descriptor.
The descriptor caches the result per owning class via
instance_lru_cache()
so repeated introspections remain constant time.- Raises:
GenericsError – If the underlying parent argument cannot be resolved to a concrete type.