construction
construction
#
How a node class is built and how a node instance is constructed.
Three pieces, all about turning a node class into a well-behaved frozen, keyword-only dataclass and a call into a coerced, validated node:
- [NODE_REGISTRY][] — every node class by its JSON
kind(== class name). - [make_procedure][] — the class decorator: frozen, keyword-only dataclass
(no field equality — identity is by
uuid), immutable after construction, and self-registering intoNODE_REGISTRY. - [ProcedureMeta][] — the construction hook: for each
Inputfield it coerces the value to aProcedure(a raw literal lifts to aConstant, aPathposition used as a value resolves to the node that wrote it).
ProcedureMeta
#
Bases: type
Construction hook: coerce input values on the way in.
Calling any node routes through here. A Path handed to a concrete-typed
Input resolves to the procedure that wrote that slot; a generic
Input[T] or an Input[Path] field keeps its position untouched.
Source code in capturegraph-lib/capturegraph/procedures/procedure/type_checking/construction.py
__call__(*args, **kwargs)
#
Construct a validated cls instance, coercing each Input field.
Source code in capturegraph-lib/capturegraph/procedures/procedure/type_checking/construction.py
make_procedure(cls)
#
Declare a procedure node class as a frozen, keyword-only dataclass.
Apply to every Procedure subclass. Field-wise equality and repr are
disabled so Procedure's own versions win (__eq__ compares by uuid;
__repr__ is the node's JSON); the frozen __setattr__ is replaced by the
one the Procedure body declares, which absorbs the |= / &= rebind.
The dataclass_transform deliberately omits frozen_default so the type
checker treats nodes as mutable enough to allow path.field |= value while
the runtime stays frozen.