kirin.ir.attrs.abc.Attribute
← Module overview
class
method
sourcemethod
sourcemethod
source
classAttribute¶source
kirin.ir.attrs.abc.Attribute
Bases: ABC, Printable
ABC for compile-time values. All attributes are hashable and thus need to implement the `__hash__` method.
class Attribute!!! note “Pretty Printing” This object is pretty printable via .print() method.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
dialect | Optional[Dialect] | field(default=None, init=False, repr=False) | Dialect of the attribute. (default: None) |
name | str | field(init=False, repr=False) | Name of the attribute in printing and other text format. |
traits | frozenset[Trait[Attribute]] | field(default=(frozenset()), init=False, repr=False) | Set of Attribute traits. |
TraitType | — | TypeVar('TraitType', bound=(Trait['Attribute'])) |
methodis_structurally_equal¶source
kirin.ir.attrs.abc.Attribute.is_structurally_equal
Signature
def is_structurally_equal(other: Self, context: dict | None = None) -> boolParameters
| Name | Type | Default | Description |
|---|---|---|---|
other | Self | required | |
context | dict | None | None |
Returns
bool
methodhas_trait¶source
kirin.ir.attrs.abc.Attribute.has_trait
def has_trait(trait_type: type[Trait[Attribute]]) -> boolCheck if the Statement has a specific trait.
Parameters
| Name | Type | Description |
|---|---|---|
trait_type | type[Trait[Attribute]] | The type of trait to check for. |
Returns
boolbool: True if the class has the specified trait, False otherwise.
methodget_trait¶source
kirin.ir.attrs.abc.Attribute.get_trait
def get_trait(trait: type[TraitType]) -> Optional[TraitType]Get the trait of the attribute.
Parameters
| Name | Type | Description |
|---|---|---|
trait | type[TraitType] | the trait to get |
Returns
Optional[TraitType]Optional[Trait]: the trait if found, None otherwise