State
Kind: class
Source: src/graphrefly/_facade.py:641
Description
Section titled “Description”A state node: the only place host input enters a graph.
Methods
Section titled “Methods”set(value: T | Callable[[T], T]) -> NoneWrite a value; given an updater, compute it from the state’s value when the write runs in request order.
An updater is a function, a method or a functools.partial; a class or an
object with __call__ is written as a value. The updater gets
graphrefly.SENTINEL when the state holds no value (not None, which is
valid DATA in Python; TS passes undefined and Rust None for the same
absence). An updater that returns the value it was given writes nothing: the
same object, or an equal bool, int, float, str or bytes
(NaN counts as itself, -0.0 differs from 0.0). To store a function as
the value, wrap it: set(lambda _: fn) (graphrefly-py:D11).
Source: src/graphrefly/_facade.py:644
invalidate
Section titled “invalidate”invalidate() -> NoneRemove the state’s value and invalidate its dependents.
Source: src/graphrefly/_facade.py:675
complete
Section titled “complete”complete() -> NoneEnd the state with COMPLETE; later host input is refused.
Source: src/graphrefly/_facade.py:682
error(error: object) -> NoneEnd the state with ERROR carrying error; later host input is refused.
Source: src/graphrefly/_facade.py:689