Skip to content

Commit

Permalink
docs: impl repr for kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Jun 28, 2024
1 parent ab198c5 commit 5b22902
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hugr-py/src/hugr/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def port_kind(self, port: InPort | OutPort) -> tys.Kind:
Example:
>>> op = Const(val.TRUE)
>>> op.port_kind(OutPort(Node(0), 0))
ConstKind(ty=Bool)
ConstKind(Bool)
"""
... # pragma: no cover

Expand Down
12 changes: 12 additions & 0 deletions hugr-py/src/hugr/tys.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,22 +400,34 @@ def __repr__(self) -> str:
class ValueKind:
"""Dataflow value edges."""

#: Type of the value.
ty: Type

def __repr__(self) -> str:
return f"ValueKind({self.ty})"


@dataclass(frozen=True)
class ConstKind:
"""Static constant value edges."""

#: Type of the constant.
ty: Type

def __repr__(self) -> str:
return f"ConstKind({self.ty})"


@dataclass(frozen=True)
class FunctionKind:
"""Statically defined function edges."""

#: Type of the function.
ty: PolyFuncType

def __repr__(self) -> str:
return f"FunctionKind({self.ty})"


@dataclass(frozen=True)
class CFKind:
Expand Down

0 comments on commit 5b22902

Please sign in to comment.