Drop legacy Python 2 `super()` syntax

This is a no-op on Python 3.
This commit is contained in:
Hugo Osvaldo Barrera 2021-10-30 19:39:36 +02:00 committed by Peter F. Patel-Schneider
parent cf28308a9f
commit 6c4e0333d4
6 changed files with 11 additions and 11 deletions

View File

@ -255,11 +255,11 @@ class KwException(Exception):
They can be later accessed by simple member access.
"""
def __init__(self, **kwargs):
super(KwException, self).__init__(kwargs)
super().__init__(kwargs)
def __getattr__(self, k):
try:
return super(KwException, self).__getattr__(k)
return super().__getattr__(k)
except AttributeError:
return self.args[0][k]

View File

@ -139,7 +139,7 @@ class EventsListener(_threading.Thread):
Incoming packets will be passed to the callback function in sequence.
"""
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._active = False

View File

@ -327,10 +327,10 @@ class _SmartShiftRW(_FeatureRW):
MAX_VALUE = 50
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):
value = super(_SmartShiftRW, self).read(device)
value = super().read(device)
if _bytes2int(value[0:1]) == 1:
# Mode = Freespin, map to minimum
return _int2bytes(_SmartShiftRW.MIN_VALUE, count=1)
@ -347,7 +347,7 @@ class _SmartShiftRW(_FeatureRW):
if threshold == _SmartShiftRW.MAX_VALUE:
threshold = 255
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():
@ -845,7 +845,7 @@ def _feature_divert_crown():
def _feature_divert_gkeys():
class _DivertGkeysRW(_FeatureRW):
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
return b'\x00'

View File

@ -111,13 +111,13 @@ def _cleanup_load(d):
class _DeviceEntry(dict):
def __init__(self, device, **kwargs):
super(_DeviceEntry, self).__init__(**kwargs)
super().__init__(**kwargs)
if self.get(_KEY_NAME) != device.name:
self[_KEY_NAME] = device.name
self.update(device)
def __setitem__(self, key, value):
super(_DeviceEntry, self).__setitem__(key, value)
super().__setitem__(key, value)
save()
def update(self, device):

View File

@ -70,7 +70,7 @@ class ReceiverListener(_listener.EventsListener):
"""Keeps the status of a Receiver.
"""
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
# self.tick_period = _POLL_TICK
# self._last_tick = 0

View File

@ -37,7 +37,7 @@ except ImportError:
class TaskRunner(_Thread):
def __init__(self, name):
super(TaskRunner, self).__init__(name=name)
super().__init__(name=name)
self.daemon = True
self.queue = _Queue(16)
self.alive = False