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):
|
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)
|
self.setter(param, 1 if val else 0)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
@ -40,9 +38,7 @@ def channel_label_prop():
|
|||||||
)[self.index]
|
)[self.index]
|
||||||
|
|
||||||
def fset(self, val: str):
|
def fset(self, val: str):
|
||||||
if not isinstance(val, str):
|
self.setter("label", str(val))
|
||||||
raise VMCMDErrors("label is a string parameter")
|
|
||||||
self.setter("label", val)
|
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
|
||||||
@ -59,8 +55,6 @@ def strip_output_prop(param):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def fset(self, val):
|
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)
|
self.setter(param, 1 if val else 0)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
@ -93,8 +87,6 @@ def bus_mode_prop(param):
|
|||||||
return tuple(round(val / 16) for val in vals) == modelist[param]
|
return tuple(round(val / 16) for val in vals) == modelist[param]
|
||||||
|
|
||||||
def fset(self, val):
|
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)
|
self.setter(param, 1 if val else 0)
|
||||||
|
|
||||||
return property(fget, fset)
|
return property(fget, fset)
|
||||||
|
Loading…
Reference in New Issue
Block a user