Source code for semi_cr.core.lab.station.graphing.models
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
from enum import StrEnum
NodeId = str
EdgeId = tuple[NodeId, NodeId]
[docs]
@dataclass(frozen=True)
class Node:
id: NodeId
kind: str
name: str | None = None
obj: Any | None = None
attrs: dict[str, Any] = field(default_factory=dict)
[docs]
@dataclass(frozen=True)
class Edge:
source: NodeId
target: NodeId
kind: str
state: str | None = None
attrs: dict[str, Any] = field(default_factory=dict)
[docs]
class GraphRelation(StrEnum):
CONTAINS = "contains"
DEPENDENCY = "dependency"
CONNECTION = "connection"
REPRESENTS = "represents"
INTERNAL_CONNECTION = "internal_connection"
PHYSICAL = "physical"
DEVICE = "device"