phenotypic.gui.builder._state.Edge#

class phenotypic.gui.builder._state.Edge(edge_id: str, source_block_id: str, source_port: str = 'out', target_block_id: str = '', target_port: str = '', target_slot: int | None = None, kind: Literal['image', 'aux'] = 'image')[source]#

Bases: object

One wire between two block ports within a scope.

Wires connect either an image-out port to an image-in port (kind == "image") or an image-out port to an aux-in port (kind == "aux"). target_slot is set for list-typed aux ports (0-based) and None for scalar aux + all image-flow edges.

Parameters:
  • edge_id (str)

  • source_block_id (str)

  • source_port (str)

  • target_block_id (str)

  • target_port (str)

  • target_slot (int | None)

  • kind (Literal['image', 'aux'])

edge_id#

Stable identifier. Generated as uuid.uuid4().hex on creation but accepted as-is on JSON round-trip.

Type:

str

source_block_id#

block_id of the upstream block.

Type:

str

source_port#

Source port name — currently always "out" (one image-output per block). Field kept for future multi-output ops.

Type:

str

target_block_id#

block_id of the downstream block. The default of "" is a dataclass-ordering artifact (Python forbids non-default fields after defaulted ones); the __post_init__ asserts the value is non-empty.

Type:

str

target_port#

Target port name: "in" for image-flow, "<param>" for aux (scalar or list — list slot index is in target_slot).

Type:

str

target_slot#

List-aux slot index (0-based); None for scalar aux and for image-flow.

Type:

int | None

kind#

Edge kind — "image" for blue image-flow wires, "aux" for purple consumer-into-aux wires. Redundant with target_port semantics but kept explicit for fast validation.

Type:

Literal[‘image’, ‘aux’]

Methods

__init__

Attributes

edge_id: str#
source_block_id: str#
source_port: str = 'out'#
target_block_id: str = ''#
target_port: str = ''#
target_slot: int | None = None#
kind: Literal['image', 'aux'] = 'image'#