From 4751a187002e1548f05cd02e383eb4b04e0fc84e Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Mon, 4 Jul 2022 16:06:04 +0100 Subject: [PATCH] remove type checks, prefer duck typing. --- vban_cmd/meta.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/vban_cmd/meta.py b/vban_cmd/meta.py index cf500e6..44f6fdb 100644 --- a/vban_cmd/meta.py +++ b/vban_cmd/meta.py @@ -22,8 +22,6 @@ def channel_bool_prop(param): ) def fset(self, val): - if not isinstance(val, bool) and val not in (0, 1): - raise VMCMDErrors(f"{param} is a boolean parameter") self.setter(param, 1 if val else 0) return property(fget, fset) @@ -40,9 +38,7 @@ def channel_label_prop(): )[self.index] def fset(self, val: str): - if not isinstance(val, str): - raise VMCMDErrors("label is a string parameter") - self.setter("label", val) + self.setter("label", str(val)) return property(fget, fset) @@ -59,8 +55,6 @@ def strip_output_prop(param): ) def fset(self, val): - if not isinstance(val, bool) and val not in (0, 1): - raise VMCMDErrors(f"{param} is a boolean parameter") self.setter(param, 1 if val else 0) return property(fget, fset) @@ -93,8 +87,6 @@ def bus_mode_prop(param): return tuple(round(val / 16) for val in vals) == modelist[param] def fset(self, val): - if not isinstance(val, bool) and val not in (0, 1): - raise VMCMDErrors(f"{param} is a boolean parameter") self.setter(param, 1 if val else 0) return property(fget, fset)