Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Seyon Sivarajah <[email protected]>
  • Loading branch information
aborgna-q and ss2165 authored Aug 29, 2024
1 parent 9766c48 commit 7e2fd15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions hugr-py/src/hugr/tys.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ def __init__(self, ok: Iterable[Type], err: Iterable[Type]):
self.variant_rows = [list(ok), list(err)]

def __repr__(self) -> str:
ok = self.variant_rows[0]
err = self.variant_rows[1]
ok, err = self.variant_rows
ok_str = ok[0] if len(ok) == 1 else tuple(ok)
err_str = err[0] if len(err) == 1 else tuple(err)
return f"Result({ok_str}, {err_str})"
Expand Down
4 changes: 2 additions & 2 deletions hugr-py/src/hugr/val.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __init__(self, vals: Iterable[Value], err_typ: Iterable[tys.Type]):

def __repr__(self) -> str:
vals_str = self.vals[0] if len(self.vals) == 1 else tuple(self.vals)
err = self.typ.variant_rows[1]
_, err = self.typ.variant_rows
err_str = err[0] if len(err) == 1 else tuple(err)
return f"Ok({vals_str}, {err_str})"

Expand Down Expand Up @@ -253,7 +253,7 @@ def __init__(self, ok_typ: Iterable[tys.Type], vals: Iterable[Value]):
)

def __repr__(self) -> str:
ok = self.typ.variant_rows[1]
ok, _ = self.typ.variant_rows
ok_str = ok[0] if len(ok) == 1 else tuple(ok)
vals_str = self.vals[0] if len(self.vals) == 1 else tuple(self.vals)
return f"Err({ok_str}, {vals_str})"
Expand Down

0 comments on commit 7e2fd15

Please sign in to comment.