Typing Base Classes¶
- 
class Any¶
- Type that can be matched to any other type. 
- 
class BlackBox(contents)¶
- All BlackBoxes are the same. 
- 
class EnumerableGenericMeta¶
- Bases: - pygears.typing.base.GenericMeta- Base class for all types that are iterable. - 
items()¶
- Generator that yields (key, element) pairs. 
 - 
keys()¶
- Returns a list of keys that can be used for indexing the type. 
 - 
property width¶
- Calculates the bit width of the type. - >>> int(Tuple[Uint[1], Uint[2]]) 3 
 
- 
- 
class GenericMeta¶
- Bases: - pygears.typing.base.TypingMeta- Base class for all types that have a generic parameter. - 
property args¶
- Returns a list of values supplied for each generic parameter. - >>> Tuple[Uint[1], Uint[2]].args [Uint[1], Uint[2]] 
 - 
property base¶
- Returns base generic class of the type. - >>> assert Uint[16].base == Uint 
 - 
property fields¶
- Returns the names of the generic parameters. - >>> Tuple[Uint[1], Uint[2]].fields ('f0', 'f1') - >>> Tuple[{'u1': Uint[1], 'u2': Uint[2]}].fields ('u0', 'u1') 
 - 
is_generic()¶
- Return True if no values have been supplied for the generic parameters. - >>> Uint.is_generic() True - >>> Uint['template'].is_generic() False 
 - 
property specified¶
- Return True if all generic parameters were supplied concrete values. - >>> Uint['template'].specified False - >>> Uint[16].specified True 
 - 
property templates¶
- Returns a list of templated generic variables within the type. The type is searched recursively. Each template is reported only once. - >>> Tuple[Tuple['T1', 'T2'], 'T1'].templates ['T1', 'T2'] 
 
- 
property 
- 
exception TemplateArgumentsError¶
- Bases: - Exception
- 
exception TemplatedTypeUnspecified¶
- Bases: - Exception
- 
class TypingMeta¶
- Bases: - type- Base class all types. 
- 
class hashabledict¶
- Bases: - dict
- 
typeof(obj, t)¶
- Check if a specific type instance is a subclass of the type. - Parameters:
- obj – Concrete type instance 
- t – Base type class 
 
 
