From 637fe9fb88dd0b3e9d783da05fd1969238bbe9c7 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Fri, 29 Apr 2022 03:24:32 +0100 Subject: [PATCH] fix bug where getter may return None --- vbancmd/bus.py | 6 +++--- vbancmd/strip.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vbancmd/bus.py b/vbancmd/bus.py index 9ec69ee..3bfec33 100644 --- a/vbancmd/bus.py +++ b/vbancmd/bus.py @@ -47,10 +47,10 @@ class OutputBus(Channel): else: return ((1 << 16) - 1) - val - val = round(self.getter("gain"), 1) + val = self.getter("gain") if val is None: - val = round((fget() * 0.01), 1) - return val + val = fget() * 0.01 + return round(val, 1) @gain.setter def gain(self, val: float): diff --git a/vbancmd/strip.py b/vbancmd/strip.py index ce78fc0..b5667f8 100644 --- a/vbancmd/strip.py +++ b/vbancmd/strip.py @@ -45,10 +45,10 @@ class InputStrip(Channel): @property def gain(self) -> float: - val = round(self.getter("gain"), 1) + val = self.getter("gain") if val is None: val = self.gainlayer[0].gain - return val + return round(val, 1) @gain.setter def gain(self, val: float): @@ -139,10 +139,10 @@ class GainLayer(InputStrip): else: return ((1 << 16) - 1) - val - val = round(self.getter(f"GainLayer[{self._i}]"), 1) + val = self.getter(f"GainLayer[{self._i}]") if val is None: - val = round((fget() * 0.01), 1) - return val + val = fget() * 0.01 + return round(val, 1) @gain.setter def gain(self, val: float):