ABCInfo
- class app.util.helpers.abc_info.ABCInfo[source]
Bases:
NamedTuple
Detailed information about a collection ABC or concrete collection type.
Inheritance Diagram for ABCInfo
Methods
create
(abc)Construct
ABCInfo
directly from an ABC instance.matches
(abc)Return whether the info is compatible with the supplied ABC(s).
Attributes
Return the primary ABC associated with this info entry.
Return all ABCs satisfied by
source
.Return
True
if the collection satisfiescollections.abc.Container
.Return
True
if the collection satisfiescollections.abc.Generator
.Return
True
when the collection describes explicit key types.Return
True
when the collection exposes a derived value type.Return
True
if the collection satisfiescollections.abc.Hashable
.Return
True
if the collection satisfiescollections.abc.Iterable
.Return
True
if the collection satisfiescollections.abc.Iterator
.Return
True
when the key type is a concrete type and not a type variable or forward reference.Return the origin type for the declared key if one exists.
Concrete or generic alias describing the key type if applicable.
Lookup metadata describing the ABC hierarchy and possible bases.
Return
True
for mapping-like collections.Return
True
when the collection advertises mutable semantics.Return
True
for sequence-like collections.Return
True
for set-like collections.Source runtime type or generic alias inspected for ABC details.
Return the non-aliased origin for
source
.Return
True
when the collection is specialised with value types.Return
True
when the value type is a concrete type and not a type variable or forward reference.Return the origin type for the declared value if one exists.
Concrete or generic alias describing the value type if applicable.
- static __new__(_cls, source: type | GenericAlias, lookup: ABCLookupInfo, key_type: type | GenericAlias | ForwardRef | None, value_type: type | GenericAlias | ForwardRef | None)
Create new instance of ABCInfo(source, lookup, key_type, value_type)
- Parameters:
source (type | GenericAlias)
lookup (ABCLookupInfo)
key_type (type | GenericAlias | ForwardRef | None)
value_type (type | GenericAlias | ForwardRef | None)
- property container: bool
Return
True
if the collection satisfiescollections.abc.Container
.
- classmethod create(abc: ABCType) ABCInfo [source]
Construct
ABCInfo
directly from an ABC instance.- Parameters:
abc (ABCType)
- Return type:
- property generator: bool
Return
True
if the collection satisfiescollections.abc.Generator
.
- property hashable: bool
Return
True
if the collection satisfiescollections.abc.Hashable
.
- property iterable: bool
Return
True
if the collection satisfiescollections.abc.Iterable
.
- property iterator: bool
Return
True
if the collection satisfiescollections.abc.Iterator
.
- property key_concrete: bool
Return
True
when the key type is a concrete type and not a type variable or forward reference.
- key_type: type | GenericAlias | ForwardRef | None
Concrete or generic alias describing the key type if applicable.
- lookup: ABCLookupInfo
Lookup metadata describing the ABC hierarchy and possible bases.
- matches(abc: type[ABCType] | tuple[ABCType, ...]) bool [source]
Return whether the info is compatible with the supplied ABC(s).