Drop legacy Python 2 `super()` syntax
This is a no-op on Python 3.
This commit is contained in:
parent
cf28308a9f
commit
6c4e0333d4
|
@ -255,11 +255,11 @@ class KwException(Exception):
|
||||||
They can be later accessed by simple member access.
|
They can be later accessed by simple member access.
|
||||||
"""
|
"""
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(KwException, self).__init__(kwargs)
|
super().__init__(kwargs)
|
||||||
|
|
||||||
def __getattr__(self, k):
|
def __getattr__(self, k):
|
||||||
try:
|
try:
|
||||||
return super(KwException, self).__getattr__(k)
|
return super().__getattr__(k)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return self.args[0][k]
|
return self.args[0][k]
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ class EventsListener(_threading.Thread):
|
||||||
Incoming packets will be passed to the callback function in sequence.
|
Incoming packets will be passed to the callback function in sequence.
|
||||||
"""
|
"""
|
||||||
def __init__(self, receiver, notifications_callback):
|
def __init__(self, receiver, notifications_callback):
|
||||||
super(EventsListener, self).__init__(name=self.__class__.__name__ + ':' + receiver.path.split('/')[2])
|
super().__init__(name=self.__class__.__name__ + ':' + receiver.path.split('/')[2])
|
||||||
|
|
||||||
self.daemon = True
|
self.daemon = True
|
||||||
self._active = False
|
self._active = False
|
||||||
|
|
|
@ -327,10 +327,10 @@ class _SmartShiftRW(_FeatureRW):
|
||||||
MAX_VALUE = 50
|
MAX_VALUE = 50
|
||||||
|
|
||||||
def __init__(self, feature, read_fnid, write_fnid):
|
def __init__(self, feature, read_fnid, write_fnid):
|
||||||
super(_SmartShiftRW, self).__init__(feature, read_fnid, write_fnid)
|
super().__init__(feature, read_fnid, write_fnid)
|
||||||
|
|
||||||
def read(self, device):
|
def read(self, device):
|
||||||
value = super(_SmartShiftRW, self).read(device)
|
value = super().read(device)
|
||||||
if _bytes2int(value[0:1]) == 1:
|
if _bytes2int(value[0:1]) == 1:
|
||||||
# Mode = Freespin, map to minimum
|
# Mode = Freespin, map to minimum
|
||||||
return _int2bytes(_SmartShiftRW.MIN_VALUE, count=1)
|
return _int2bytes(_SmartShiftRW.MIN_VALUE, count=1)
|
||||||
|
@ -347,7 +347,7 @@ class _SmartShiftRW(_FeatureRW):
|
||||||
if threshold == _SmartShiftRW.MAX_VALUE:
|
if threshold == _SmartShiftRW.MAX_VALUE:
|
||||||
threshold = 255
|
threshold = 255
|
||||||
data = _int2bytes(mode, count=1) + _int2bytes(threshold, count=1)
|
data = _int2bytes(mode, count=1) + _int2bytes(threshold, count=1)
|
||||||
return super(_SmartShiftRW, self).write(device, data)
|
return super().write(device, data)
|
||||||
|
|
||||||
|
|
||||||
def _feature_smart_shift():
|
def _feature_smart_shift():
|
||||||
|
@ -845,7 +845,7 @@ def _feature_divert_crown():
|
||||||
def _feature_divert_gkeys():
|
def _feature_divert_gkeys():
|
||||||
class _DivertGkeysRW(_FeatureRW):
|
class _DivertGkeysRW(_FeatureRW):
|
||||||
def __init__(self, feature):
|
def __init__(self, feature):
|
||||||
super(_DivertGkeysRW, self).__init__(feature, write_fnid=0x20)
|
super().__init__(feature, write_fnid=0x20)
|
||||||
|
|
||||||
def read(self, device): # no way to read, so just assume not diverted
|
def read(self, device): # no way to read, so just assume not diverted
|
||||||
return b'\x00'
|
return b'\x00'
|
||||||
|
|
|
@ -111,13 +111,13 @@ def _cleanup_load(d):
|
||||||
|
|
||||||
class _DeviceEntry(dict):
|
class _DeviceEntry(dict):
|
||||||
def __init__(self, device, **kwargs):
|
def __init__(self, device, **kwargs):
|
||||||
super(_DeviceEntry, self).__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
if self.get(_KEY_NAME) != device.name:
|
if self.get(_KEY_NAME) != device.name:
|
||||||
self[_KEY_NAME] = device.name
|
self[_KEY_NAME] = device.name
|
||||||
self.update(device)
|
self.update(device)
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
super(_DeviceEntry, self).__setitem__(key, value)
|
super().__setitem__(key, value)
|
||||||
save()
|
save()
|
||||||
|
|
||||||
def update(self, device):
|
def update(self, device):
|
||||||
|
|
|
@ -70,7 +70,7 @@ class ReceiverListener(_listener.EventsListener):
|
||||||
"""Keeps the status of a Receiver.
|
"""Keeps the status of a Receiver.
|
||||||
"""
|
"""
|
||||||
def __init__(self, receiver, status_changed_callback):
|
def __init__(self, receiver, status_changed_callback):
|
||||||
super(ReceiverListener, self).__init__(receiver, self._notifications_handler)
|
super().__init__(receiver, self._notifications_handler)
|
||||||
# no reason to enable polling yet
|
# no reason to enable polling yet
|
||||||
# self.tick_period = _POLL_TICK
|
# self.tick_period = _POLL_TICK
|
||||||
# self._last_tick = 0
|
# self._last_tick = 0
|
||||||
|
|
|
@ -37,7 +37,7 @@ except ImportError:
|
||||||
|
|
||||||
class TaskRunner(_Thread):
|
class TaskRunner(_Thread):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
super(TaskRunner, self).__init__(name=name)
|
super().__init__(name=name)
|
||||||
self.daemon = True
|
self.daemon = True
|
||||||
self.queue = _Queue(16)
|
self.queue = _Queue(16)
|
||||||
self.alive = False
|
self.alive = False
|
||||||
|
|
Loading…
Reference in New Issue