Skip to content
PACKAGES

Ctx

Kind: class

Source: src/graphrefly/_facade.py:453

Ctx(ctx: _k.Ctx, graph: Graph)

What an advanced node callback receives for one invocation.

deps reads the invocation’s inputs, state keeps the lifetime’s private state, and :meth:emit and :meth:down send output. It never sends anything upstream.

NameTypeDescription
depstuple[Dep, ...]Return this invocation’s dependency views during setup or function execution. Reads through this ctx or its saved views are refused after this invocation returns, including while a later invocation of the same node runs.
has_stateboolReturn whether this lifetime’s private state is set (to anything but None).
state`objectNone`
signal_k.SignalReturn the lifetime’s abort signal, aborted when this lifetime closes.
emit(*values: object) -> None

Send one array of DATA, one message per value.

Source: src/graphrefly/_facade.py:483

down(array: Sequence[Message[Any]]) -> None

Send one array, a list of messages: (DATA, v), (ERROR, e), (INVALIDATE,) or (COMPLETE,).

START, PENDING and RESOLVED are the kernel’s alone and are rejected, as is a terminal that is not last; the kernel checks the array before anything is sent.

Source: src/graphrefly/_facade.py:495

rewire(deps: Iterable[Node[Any]]) -> None

Change this node’s own dependencies for its current lifetime.

It runs after the current wave and is undone when the lifetime closes.

Source: src/graphrefly/_facade.py:540