mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2024-11-15 17:10:46 +00:00
remove type checks, prefer duck typing.
This commit is contained in:
parent
36b1ac1952
commit
4751a18700
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user