pynenc.invocation.status_graph

Render the invocation status state machine from the status configuration.

Key components:

  • Layout search: ranks statuses from live transitions and chooses compact rows.

  • Straight-edge clipping: attaches arrow endpoints to node boundaries.

  • SVG renderer: draws styled nodes, transitions, and legend from status metadata.

Module Contents

Classes

Layout

Computed geometry for the status graph.

Line

Straight edge segment after clipping to source and target nodes.

Functions

render_svg

Return the SVG representation generated from the current status config.

render_text

Return a plain-text representation of the invocation status graph.

_layout

Compute and validate the compact graph layout.

_rank_nodes

Rank nodes by shortest transition distance from START.

_refine_ranks

Refine shortest-path ranks using ownership semantics from the graph.

_columns_by_rank

Group statuses into ranked columns.

_lane_positions

Return evenly spaced y lanes for the densest computed column.

_x_positions

Return x coordinate per status rank.

_relaxed_row_sets

Return deterministic row targets after neighbor relaxation sweeps.

_seed_rows

Return row seeds from semantic, inverted, and centered preferences.

_neighbor_targets

Return row targets from connected statuses plus semantic bias.

_best_column_rows

Return the best unique lane assignment for one column.

_preferred_lane

Place semantic outliers before the global crossing score takes over.

_positions_from_rows

Build node positions from computed row assignments.

_validate_layout

Validate computed layout before rendering.

_node_bounds

Return node bounds.

_bounds_overlap

Return whether padded bounds overlap.

_edge_crosses_non_endpoint_node

Return the first non-endpoint node crossed by an edge.

_segment_intersects_bounds

Return whether a line crosses rectangle bounds.

_point_inside_bounds

Return whether a point lies inside bounds.

_segments_intersect

Return whether two line segments intersect.

_orientation

Return point orientation relative to a line.

_point_on_segment

Return whether point lies on a segment.

_iter_edges

Return every rendered transition edge.

_svg_header

_defs

_render_edge

_edge_line

Return the best straight boundary-to-boundary edge.

_anchor_candidates

Return boundary anchors for a node, ordered toward the other node.

_anchor_direction_penalty

Score whether an anchor faces the other endpoint.

_anchor_line_score

Score a valid anchor line by direction, length, and straightness.

_clip_circle_endpoint

Clip START edge to its circular boundary.

_line_length

Return the length of a line.

_render_node

_style_for

_badge_for

_split_label

_render_legend

_node_name

Data

API

pynenc.invocation.status_graph.DEFAULT_OUTPUT_PATH: Final[pathlib.Path]

None

pynenc.invocation.status_graph.NodeKey

None

pynenc.invocation.status_graph.CANVAS_WIDTH: Final[int]

1180

pynenc.invocation.status_graph.CANVAS_HEIGHT: Final[int]

620

pynenc.invocation.status_graph.START_X: Final[int]

58

pynenc.invocation.status_graph.STATUS_LEFT_X: Final[int]

210

pynenc.invocation.status_graph.STATUS_RIGHT_X: Final[int]

1050

pynenc.invocation.status_graph.GRAPH_TOP: Final[int]

115

pynenc.invocation.status_graph.GRAPH_BOTTOM: Final[int]

485

pynenc.invocation.status_graph.MAIN_LANE_Y: Final[int]

300

pynenc.invocation.status_graph.LEGEND_TITLE_Y: Final[int]

555

pynenc.invocation.status_graph.LEGEND_BASELINE_Y: Final[int]

575

pynenc.invocation.status_graph.NODE_WIDTH: Final[int]

176

pynenc.invocation.status_graph.NODE_HEIGHT: Final[int]

58

pynenc.invocation.status_graph.NODE_GAP: Final[int]

16

pynenc.invocation.status_graph.START_RADIUS: Final[int]

22

pynenc.invocation.status_graph.RELAXATION_PASSES: Final[int]

8

pynenc.invocation.status_graph.ANCHOR_FRACTIONS: Final[tuple[float, ...]]

(0.0, 0.25, 0.5, 0.75, 1.0)

pynenc.invocation.status_graph.PALETTE: Final[dict[str, tuple[str, str, str]]]

None

class pynenc.invocation.status_graph.Layout[source]

Computed geometry for the status graph.

positions: dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]]

None

width: int

None

height: int

None

class pynenc.invocation.status_graph.Line[source]

Straight edge segment after clipping to source and target nodes.

start_x: float

None

start_y: float

None

end_x: float

None

end_y: float

None

pynenc.invocation.status_graph.render_svg() str[source]

Return the SVG representation generated from the current status config.

pynenc.invocation.status_graph.render_text() str[source]

Return a plain-text representation of the invocation status graph.

pynenc.invocation.status_graph._layout() pynenc.invocation.status_graph.Layout[source]

Compute and validate the compact graph layout.

pynenc.invocation.status_graph._rank_nodes(edges: list[tuple[pynenc.invocation.status_graph.NodeKey, pynenc.invocation.status.InvocationStatus]]) dict[pynenc.invocation.status_graph.NodeKey, int][source]

Rank nodes by shortest transition distance from START.

pynenc.invocation.status_graph._refine_ranks(ranks: dict[pynenc.invocation.status_graph.NodeKey, int], edges: list[tuple[pynenc.invocation.status_graph.NodeKey, pynenc.invocation.status.InvocationStatus]]) dict[pynenc.invocation.status_graph.NodeKey, int][source]

Refine shortest-path ranks using ownership semantics from the graph.

pynenc.invocation.status_graph._columns_by_rank(ranks: dict[pynenc.invocation.status_graph.NodeKey, int]) dict[int, tuple[pynenc.invocation.status.InvocationStatus, ...]][source]

Group statuses into ranked columns.

pynenc.invocation.status_graph._lane_positions(max_column_size: int) tuple[int, ...][source]

Return evenly spaced y lanes for the densest computed column.

pynenc.invocation.status_graph._x_positions(max_rank: int) dict[int, float][source]

Return x coordinate per status rank.

pynenc.invocation.status_graph._relaxed_row_sets(columns: dict[int, tuple[pynenc.invocation.status.InvocationStatus, ...]], lanes: tuple[int, ...], edges: list[tuple[pynenc.invocation.status_graph.NodeKey, pynenc.invocation.status.InvocationStatus]]) list[dict[pynenc.invocation.status.InvocationStatus, int]][source]

Return deterministic row targets after neighbor relaxation sweeps.

pynenc.invocation.status_graph._seed_rows(columns: dict[int, tuple[pynenc.invocation.status.InvocationStatus, ...]], lanes: tuple[int, ...]) list[dict[pynenc.invocation.status.InvocationStatus, int]][source]

Return row seeds from semantic, inverted, and centered preferences.

pynenc.invocation.status_graph._neighbor_targets(column: tuple[pynenc.invocation.status.InvocationStatus, ...], rows: dict[pynenc.invocation.status.InvocationStatus, int], edges: list[tuple[pynenc.invocation.status_graph.NodeKey, pynenc.invocation.status.InvocationStatus]]) dict[pynenc.invocation.status.InvocationStatus, float][source]

Return row targets from connected statuses plus semantic bias.

pynenc.invocation.status_graph._best_column_rows(column: tuple[pynenc.invocation.status.InvocationStatus, ...], lanes: tuple[int, ...], targets: collections.abc.Mapping[pynenc.invocation.status.InvocationStatus, float]) dict[pynenc.invocation.status.InvocationStatus, int][source]

Return the best unique lane assignment for one column.

pynenc.invocation.status_graph._preferred_lane(status: pynenc.invocation.status.InvocationStatus) int[source]

Place semantic outliers before the global crossing score takes over.

pynenc.invocation.status_graph._positions_from_rows(rows: dict[pynenc.invocation.status.InvocationStatus, int], x_positions: dict[int, float], ranks: dict[pynenc.invocation.status_graph.NodeKey, int]) dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]][source]

Build node positions from computed row assignments.

pynenc.invocation.status_graph._validate_layout(layout: pynenc.invocation.status_graph.Layout) None[source]

Validate computed layout before rendering.

pynenc.invocation.status_graph._node_bounds(positions: dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]], node: pynenc.invocation.status_graph.NodeKey) tuple[float, float, float, float][source]

Return node bounds.

pynenc.invocation.status_graph._bounds_overlap(first: tuple[float, float, float, float], second: tuple[float, float, float, float], padding: int) bool[source]

Return whether padded bounds overlap.

pynenc.invocation.status_graph._edge_crosses_non_endpoint_node(positions: dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]], source: pynenc.invocation.status_graph.NodeKey, target: pynenc.invocation.status.InvocationStatus, line: pynenc.invocation.status_graph.Line) pynenc.invocation.status_graph.NodeKey | None[source]

Return the first non-endpoint node crossed by an edge.

pynenc.invocation.status_graph._segment_intersects_bounds(line: pynenc.invocation.status_graph.Line, bounds: tuple[float, float, float, float]) bool[source]

Return whether a line crosses rectangle bounds.

pynenc.invocation.status_graph._point_inside_bounds(point_x: float, point_y: float, bounds: tuple[float, float, float, float]) bool[source]

Return whether a point lies inside bounds.

pynenc.invocation.status_graph._segments_intersect(first: pynenc.invocation.status_graph.Line, second: pynenc.invocation.status_graph.Line) bool[source]

Return whether two line segments intersect.

pynenc.invocation.status_graph._orientation(line: pynenc.invocation.status_graph.Line, point_x: float, point_y: float) int[source]

Return point orientation relative to a line.

pynenc.invocation.status_graph._point_on_segment(line: pynenc.invocation.status_graph.Line, point_x: float, point_y: float) bool[source]

Return whether point lies on a segment.

pynenc.invocation.status_graph._iter_edges() list[tuple[pynenc.invocation.status_graph.NodeKey, pynenc.invocation.status.InvocationStatus]][source]

Return every rendered transition edge.

pynenc.invocation.status_graph._svg_header(layout: pynenc.invocation.status_graph.Layout) str[source]
pynenc.invocation.status_graph._defs() str[source]
pynenc.invocation.status_graph._render_edge(layout: pynenc.invocation.status_graph.Layout, source: pynenc.invocation.status_graph.NodeKey, target: pynenc.invocation.status.InvocationStatus) str[source]
pynenc.invocation.status_graph._edge_line(positions: dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]], source: pynenc.invocation.status_graph.NodeKey, target: pynenc.invocation.status.InvocationStatus) pynenc.invocation.status_graph.Line[source]

Return the best straight boundary-to-boundary edge.

pynenc.invocation.status_graph._anchor_candidates(positions: dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]], node: pynenc.invocation.status_graph.NodeKey, other: pynenc.invocation.status_graph.NodeKey) tuple[tuple[float, float], ...][source]

Return boundary anchors for a node, ordered toward the other node.

pynenc.invocation.status_graph._anchor_direction_penalty(anchor: tuple[float, float], center: tuple[float, float], other: tuple[float, float]) float[source]

Score whether an anchor faces the other endpoint.

pynenc.invocation.status_graph._anchor_line_score(positions: dict[pynenc.invocation.status_graph.NodeKey, tuple[float, float]], source: pynenc.invocation.status_graph.NodeKey, target: pynenc.invocation.status.InvocationStatus, line: pynenc.invocation.status_graph.Line) tuple[float, ...][source]

Score a valid anchor line by direction, length, and straightness.

pynenc.invocation.status_graph._clip_circle_endpoint(center: tuple[float, float], target: tuple[float, float]) tuple[float, float][source]

Clip START edge to its circular boundary.

pynenc.invocation.status_graph._line_length(line: pynenc.invocation.status_graph.Line) float[source]

Return the length of a line.

pynenc.invocation.status_graph._render_node(layout: pynenc.invocation.status_graph.Layout, node: pynenc.invocation.status_graph.NodeKey) str[source]
pynenc.invocation.status_graph._style_for(status: pynenc.invocation.status.InvocationStatus, definition: pynenc.invocation.status.StatusDefinition) str[source]
pynenc.invocation.status_graph._badge_for(definition: pynenc.invocation.status.StatusDefinition) str[source]
pynenc.invocation.status_graph._split_label(label: str) list[str][source]
pynenc.invocation.status_graph._render_legend(layout: pynenc.invocation.status_graph.Layout) str[source]
pynenc.invocation.status_graph._node_name(node: pynenc.invocation.status_graph.NodeKey) str[source]