Model
hexa.model
Summary
Shared neutral model for hexa port trees.
All utilities (parse_yaml, generate_abc, parse_abc,
generate_yaml, check_matches) serialize through this single model.
Notes
- The model is NOT tied to any sample — any port tree fits.
Classes
MethodSpec
dataclass
Specification of a single abstract method.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the method. |
args |
list[str]
|
Positional parameter names. |
kwargs |
dict[str, str]
|
Keyword-only parameter names mapped to their type expressions. |
PortNode
dataclass
A node in the hexa port tree.
Each node is a leaf (no children), a port (has nested port slots), or the parent root of the tree. Every node carries a concrete typed shape derived from an ABC class name.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Slot name, e.g. |
port_cls |
str
|
ABC class name that gives this port its shape, e.g.
|
kind |
str
|
One of |
attributes |
dict[str, ConfigValue]
|
Annotated attributes: |
children |
list[PortNode]
|
Nested port slots. |
methods |
dict[str, MethodSpec]
|
Abstract methods keyed by method name. |
Functions
diff
Return a list of human-readable difference strings.
An empty list means the trees are equal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
PortNode
|
Tree to compare against. |
required |
path |
str
|
Path prefix used when recursing into nested nodes; defaults to the root path. |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Human-readable difference strings, one per discrepancy. |
find
Find a direct child by slot name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Slot name of the child to look up. |
required |
Returns:
| Type | Description |
|---|---|
PortNode | None
|
PortNode | None:
The matching child node, or |