Skip to content

Commit

Permalink
Use ands instead of nested ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
josephine-wolf-oberholtzer committed Feb 16, 2025
1 parent b3c9bd3 commit 187cd9f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions supriya/ugens/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,17 +350,19 @@ def _new_single(
def _inputs_are_valid(source, multiplier, addend):
if CalculationRate.from_expr(source) == CalculationRate.AUDIO:
return True
if CalculationRate.from_expr(source) == CalculationRate.CONTROL:
if CalculationRate.from_expr(multiplier) in (
return (
CalculationRate.from_expr(source) == CalculationRate.CONTROL
and CalculationRate.from_expr(multiplier)
in (
CalculationRate.CONTROL,
CalculationRate.SCALAR,
):
if CalculationRate.from_expr(addend) in (
CalculationRate.CONTROL,
CalculationRate.SCALAR,
):
return True
return False
)
and CalculationRate.from_expr(addend)
in (
CalculationRate.CONTROL,
CalculationRate.SCALAR,
)
)

if multiplier == 0.0:
return addend
Expand Down

0 comments on commit 187cd9f

Please sign in to comment.