Skip to content

Commit

Permalink
Fixup typing
Browse files Browse the repository at this point in the history
  • Loading branch information
josiah-wolf-oberholtzer committed Jan 16, 2024
1 parent 8e2cd94 commit eab193a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
50 changes: 25 additions & 25 deletions supriya/patterns/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class Pattern(metaclass=abc.ABCMeta):

### SPECIAL METHODS ###

def __abs__(self) -> UnaryOpPattern:
def __abs__(self) -> "UnaryOpPattern":
return UnaryOpPattern("abs", self)

def __add__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __add__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("+", self, expr)

def __eq__(self, expr) -> bool:
Expand All @@ -52,10 +52,10 @@ def __eq__(self, expr) -> bool:
expr_values = type(expr), expr
return self_values == expr_values

def __floordiv__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __floordiv__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("//", self, expr)

def __invert__(self) -> UnaryOpPattern:
def __invert__(self) -> "UnaryOpPattern":
return UnaryOpPattern("~", self)

def __iter__(self) -> Generator[Event, bool, None]:
Expand All @@ -82,46 +82,46 @@ def __iter__(self) -> Generator[Event, bool, None]:
if stop_event:
yield stop_event

def __mod__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __mod__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("%", self, expr)

def __mul__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __mul__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("*", self, expr)

def __neg__(self) -> UnaryOpPattern:
def __neg__(self) -> "UnaryOpPattern":
return UnaryOpPattern("-", self)

def __pos__(self) -> UnaryOpPattern:
def __pos__(self) -> "UnaryOpPattern":
return UnaryOpPattern("+", self)

def __pow__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __pow__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("**", self, expr)

def __radd__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __radd__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("+", expr, self)

def __rmod__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __rmod__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("%", expr, self)

def __rmul__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __rmul__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("*", expr, self)

def __rpow__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __rpow__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("**", expr, self)

def __rsub__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __rsub__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("-", expr, self)

def __rtruediv__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __rtruediv__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("/", expr, self)

def __rfloordiv__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __rfloordiv__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("//", expr, self)

def __sub__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __sub__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("-", self, expr)

def __truediv__(self, expr: Union[Pattern, float]) -> BinaryOpPattern:
def __truediv__(self, expr: Union["Pattern", float]) -> "BinaryOpPattern":
return BinaryOpPattern("/", self, expr)

### PRIVATE METHODS ###
Expand Down Expand Up @@ -224,7 +224,7 @@ def play(
tempo: Optional[float] = None,
until: Optional[float] = None,
uuid: Optional[UUID] = None,
) -> PatternPlayer:
) -> "PatternPlayer":
from .players import PatternPlayer # Avoid circular import

if isinstance(context, Score):
Expand Down Expand Up @@ -256,8 +256,8 @@ class BinaryOpPattern(Pattern):
def __init__(
self,
operator: str,
expr_one: Union[Pattern, float],
expr_two: Union[Pattern, float],
expr_one: Union["Pattern", float],
expr_two: Union["Pattern", float],
) -> None:
self._operator = operator
self._expr_one = self._freeze_recursive(expr_one)
Expand Down Expand Up @@ -293,11 +293,11 @@ def _string_to_operator(self):
### PUBLIC PROPERTIES ###

@property
def expr_one(self) -> Union[Pattern, float]:
def expr_one(self) -> Union["Pattern", float]:
return self._expr_one

@property
def expr_two(self) -> Union[Pattern, float]:
def expr_two(self) -> Union["Pattern", float]:
return self._expr_two

@property
Expand All @@ -318,7 +318,7 @@ def operator(self) -> str:
class UnaryOpPattern(Pattern):
### INITIALIZER ###

def __init__(self, operator: str, expr: Union[Pattern, float]) -> None:
def __init__(self, operator: str, expr: Union["Pattern", float]) -> None:
self._operator = operator
self._expr = expr

Expand All @@ -345,7 +345,7 @@ def _string_to_operator(self):
### PUBLIC PROPERTIES ###

@property
def expr(self) -> Union[Pattern, float]:
def expr(self) -> Union["Pattern", float]:
return self._expr

@property
Expand Down
1 change: 0 additions & 1 deletion supriya/patterns/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from supriya.assets import synthdefs
from supriya.enums import CalculationRate

from ..contexts import Bus, Node
from .events import (
BusAllocateEvent,
BusFreeEvent,
Expand Down

0 comments on commit eab193a

Please sign in to comment.