Skip to content

Commit

Permalink
feat: Add repr for Then
Browse files Browse the repository at this point in the history
No longer inherited
  • Loading branch information
dangotbanned committed Sep 15, 2024
1 parent 969e0e3 commit 8cad6af
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,17 @@ def to_dict(self, *args: Any, **kwds: Any) -> _Conditional[_C]:
def __deepcopy__(self, memo: Any) -> Self:
return type(self)(_Conditional(condition=_deepcopy(self.condition, memo)))

def __repr__(self) -> str:
name = type(self).__name__
COND = "condition: "
LB, RB = "{", "}"
if len(self.condition) == 1:
args = f"{COND}{self.condition!r}".replace("\n", "\n ")
else:
conds = "\n ".join(f"{c!r}" for c in self.condition)
args = f"{COND}[\n " f"{conds}\n ]"
return f"{name}({LB}\n {args}\n{RB})"


class ChainedWhen(_BaseWhen):
"""
Expand Down

0 comments on commit 8cad6af

Please sign in to comment.