Skip to content

modules

Classes:

NamespaceKind

Bases: str, Enum

Distinguish the semantic origin of one namespace-valued binding while keeping the user-facing expression model uniform.

NamespaceType

NamespaceType(
    namespace_key: str,
    *,
    namespace_kind: NamespaceKind = MODULE,
    display_name: str | None = None,
)

Bases: AnyType

Represent one imported namespace value during semantic analysis and lowering without modeling it as a user-defined runtime aggregate. attributes: namespace_key: type: str namespace_kind: type: NamespaceKind display_name: type: str | None

Methods:

Attributes:

Source code in src/irx/astx/modules.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
def __init__(
    self,
    namespace_key: str,
    *,
    namespace_kind: NamespaceKind = NamespaceKind.MODULE,
    display_name: str | None = None,
) -> None:
    """
    title: Initialize one namespace type.
    parameters:
      namespace_key:
        type: str
      namespace_kind:
        type: NamespaceKind
      display_name:
        type: str | None
    """
    super().__init__()
    self.namespace_key = namespace_key
    self.namespace_kind = namespace_kind
    self.display_name = display_name

module_key property

module_key: str

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/astx/modules.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Build one repr structure for a namespace type.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    visible_name = self.display_name or self.namespace_key
    key = f"NAMESPACE[{self.namespace_kind.value}:{visible_name}]"
    return self._prepare_struct(key, visible_name, simplified)