From 6c4e0333d4ac5fc87912e9b0a27aa82728e2a952 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 30 Oct 2021 19:39:36 +0200 Subject: [PATCH] Drop legacy Python 2 `super()` syntax This is a no-op on Python 3. --- lib/logitech_receiver/common.py | 4 ++-- lib/logitech_receiver/listener.py | 2 +- lib/logitech_receiver/settings_templates.py | 8 ++++---- lib/solaar/configuration.py | 4 ++-- lib/solaar/listener.py | 2 +- lib/solaar/tasks.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/logitech_receiver/common.py b/lib/logitech_receiver/common.py index 4c5b5996..b2e43c75 100644 --- a/lib/logitech_receiver/common.py +++ b/lib/logitech_receiver/common.py @@ -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] diff --git a/lib/logitech_receiver/listener.py b/lib/logitech_receiver/listener.py index b3775f9d..5443c6be 100644 --- a/lib/logitech_receiver/listener.py +++ b/lib/logitech_receiver/listener.py @@ -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 diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index 3b8bcb73..5e64c823 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -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' diff --git a/lib/solaar/configuration.py b/lib/solaar/configuration.py index d22f32bf..f1a6c0fc 100644 --- a/lib/solaar/configuration.py +++ b/lib/solaar/configuration.py @@ -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): diff --git a/lib/solaar/listener.py b/lib/solaar/listener.py index 28f86975..941ab3f8 100644 --- a/lib/solaar/listener.py +++ b/lib/solaar/listener.py @@ -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 diff --git a/lib/solaar/tasks.py b/lib/solaar/tasks.py index 2c91c265..f44ed70f 100644 --- a/lib/solaar/tasks.py +++ b/lib/solaar/tasks.py @@ -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