Identity semantics bound onto Procedure.
A node is equal only to itself: field-wise dataclass equality is disabled and
identity is the uuid stamped at construction, so two identically-configured
nodes are still two distinct DAG nodes.
__eq__(self, other)
Two procedures are equal iff they are the same node (same uuid).
Source code in capturegraph-lib/capturegraph/procedures/procedure/methods/identity.py
| def __eq__(self: Procedure, other: object) -> bool:
"""Two procedures are equal iff they are the same node (same ``uuid``)."""
from capturegraph.procedures.procedure import (
Procedure,
)
return isinstance(other, Procedure) and self._uuid == other._uuid
|
__hash__(self)
Hash by node identity (the uuid), consistent with __eq__.
Source code in capturegraph-lib/capturegraph/procedures/procedure/methods/identity.py
| def __hash__(self: Procedure) -> int:
"""Hash by node identity (the ``uuid``), consistent with ``__eq__``."""
return hash(self._uuid)
|
__str__(self)
"label (Kind)", or just "Kind" when unlabeled.
Source code in capturegraph-lib/capturegraph/procedures/procedure/methods/identity.py
| def __str__(self: Procedure) -> str:
"""``"label (Kind)"``, or just ``"Kind"`` when unlabeled."""
return f"{self.label} ({self.kind.__name__})" if self.label else self.kind.__name__
|