Skip to content

Commit

Permalink
Use carats for UGen class reprs
Browse files Browse the repository at this point in the history
  • Loading branch information
josephine-wolf-oberholtzer committed May 1, 2024
1 parent d204561 commit 36cf736
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions supriya/ugens/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3601,7 +3601,7 @@ def __len__(self):
return len(self.ugens)

def __repr__(self):
return "{}({{{}}})".format(type(self).__name__, len(self))
return f"<{type(self).__name__}([{', '.join(repr(x) for x in self)}])>"

### PUBLIC PROPERTIES ###

Expand Down Expand Up @@ -3643,7 +3643,7 @@ def __len__(self) -> int:
return 1

def __repr__(self) -> str:
return "{!r}[{}]".format(self.source, self.output_index)
return repr(self.source).replace(">", f"[{self.output_index}]>")

### PRIVATE METHODS ###

Expand Down Expand Up @@ -3809,7 +3809,7 @@ def __repr__(self):
Returns string.
"""
return f"{type(self).__name__}.{self.calculation_rate.token}()"
return f"<{type(self).__name__}.{self.calculation_rate.token}()>"

### PRIVATE METHODS ###

Expand Down Expand Up @@ -4190,11 +4190,10 @@ class UnaryOpUGen(UGen):
UnaryOperator.ABSOLUTE_VALUE
"""

### CLASS VARIABLES ###

source = param()

### PUBLIC PROPERTIES ###
def __repr__(self) -> str:
return f"<{type(self).__name__}.{self.calculation_rate.token}({self.operator.name})>"

@property
def operator(self) -> UnaryOperator:
Expand Down Expand Up @@ -4250,6 +4249,9 @@ def __init__(
special_index=special_index,
)

def __repr__(self) -> str:
return f"<{type(self).__name__}.{self.calculation_rate.token}({self.operator.name})>"

@classmethod
def _new_single(
cls, calculation_rate=None, special_index=None, left=None, right=None, **kwargs
Expand Down

0 comments on commit 36cf736

Please sign in to comment.