Abc
Attribute dataclass
Attribute()
Bases: ABC
, Printable
ABC for compile-time values. All attributes are hashable and thus need to implement the __hash__
method.
Pretty Printing
This object is pretty printable via .print()
method.
dialect class-attribute
dialect: Optional[Dialect] = field(
default=None, init=False, repr=False
)
Dialect of the attribute. (default: None)
name class-attribute
name: str = field(init=False, repr=False)
Name of the attribute in printing and other text format.
traits class-attribute
traits: frozenset[Trait[Attribute]] = field(
default=frozenset(), init=False, repr=False
)
Set of Attribute traits.
get_trait
get_trait(trait: type[TraitType]) -> Optional[TraitType]
Get the trait of the attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trait | type[Trait] | the trait to get | required |
Returns:
Type | Description |
---|---|
Optional[TraitType] | Optional[Trait]: the trait if found, None otherwise |
Source code in src/kirin/ir/attrs/abc.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
has_trait classmethod
has_trait(trait_type: type[Trait[Attribute]]) -> bool
Check if the Statement has a specific trait.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trait_type | type[Trait] | The type of trait to check for. | required |
Returns:
Name | Type | Description |
---|---|---|
bool | bool | True if the class has the specified trait, False otherwise. |
Source code in src/kirin/ir/attrs/abc.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
AttributeMeta
Bases: ABCMeta
Metaclass for attributes.
LatticeAttributeMeta
Bases: LatticeMeta
, AttributeMeta
Metaclass for lattice attributes.
SingletonLatticeAttributeMeta
SingletonLatticeAttributeMeta(name, bases, attrs)
Bases: LatticeAttributeMeta
, SingletonMeta
Metaclass for singleton lattice attributes.
Source code in src/kirin/lattice/abc.py
16 17 18 |
|