diff --git a/lib/logitech_receiver/common.py b/lib/logitech_receiver/common.py index 5e495909..8ef00271 100644 --- a/lib/logitech_receiver/common.py +++ b/lib/logitech_receiver/common.py @@ -86,7 +86,7 @@ class NamedInt(int): return 'NamedInt(%d, %r)' % (int(self), self.name) -class NamedInts(object): +class NamedInts: """An ordered set of NamedInt values. Indexing can be made by int or string, and will return the corresponding diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 80e7532e..bb7e4622 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -28,7 +28,7 @@ KIND_MAP = {kind: _hidpp10.DEVICE_KIND[str(kind)] for kind in _hidpp20.DEVICE_KI # -class Device(object): +class Device: read_register = _hidpp10.read_register write_register = _hidpp10.write_register diff --git a/lib/logitech_receiver/diversion.py b/lib/logitech_receiver/diversion.py index cb2018cc..87e9ae9f 100644 --- a/lib/logitech_receiver/diversion.py +++ b/lib/logitech_receiver/diversion.py @@ -176,7 +176,7 @@ if x11: displayt = Display() -class RuleComponent(object): +class RuleComponent: def compile(self, c): if isinstance(c, RuleComponent): return c diff --git a/lib/logitech_receiver/hidpp20.py b/lib/logitech_receiver/hidpp20.py index 682c72b8..5ede93dd 100644 --- a/lib/logitech_receiver/hidpp20.py +++ b/lib/logitech_receiver/hidpp20.py @@ -226,7 +226,7 @@ class FeatureCallError(_KwException): # -class FeaturesArray(object): +class FeaturesArray: """A sequence of features supported by a HID++ 2.0 device.""" __slots__ = ('supported', 'device', 'features', 'non_features') assert FEATURE.ROOT == 0x0000 @@ -367,7 +367,7 @@ class FeaturesArray(object): # -class ReprogrammableKey(object): +class ReprogrammableKey: """Information about a control present on a device with the `REPROG_CONTROLS` feature. Ref: https://drive.google.com/file/d/0BxbRzx7vEV7eU3VfMnRuRXktZ3M/view Read-only properties: @@ -578,7 +578,7 @@ class ReprogrammableKeyV4(ReprogrammableKey): self._getCidReporting() -class KeysArray(object): +class KeysArray: """A sequence of key mappings supported by a HID++ 2.0 device.""" __slots__ = ('device', 'keys', 'keyversion', 'cid_to_tid', 'group_cids') @@ -813,7 +813,7 @@ ACTION_ID = _NamedInts( ACTION_ID._fallback = lambda x: 'unknown:%04X' % x -class Gesture(object): +class Gesture: gesture_index = {} @@ -869,7 +869,7 @@ class Gesture(object): write = set -class Param(object): +class Param: param_index = {} def __init__(self, device, low, high): @@ -947,7 +947,7 @@ class Spec: return f'[{self.spec}={self.value}]' -class Gestures(object): +class Gestures: """Information about the gestures that a device supports. Right now only some information fields are supported. WARNING: Assumes that parameters are always global, which is not the case. diff --git a/lib/logitech_receiver/listener.py b/lib/logitech_receiver/listener.py index 41db1a1d..b3775f9d 100644 --- a/lib/logitech_receiver/listener.py +++ b/lib/logitech_receiver/listener.py @@ -40,7 +40,7 @@ del getLogger # -class _ThreadedHandle(object): +class _ThreadedHandle: """A thread-local wrapper with different open handles for each thread. Closing a ThreadedHandle will close all handles. diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py index 28dcabaf..2647a318 100644 --- a/lib/logitech_receiver/receiver.py +++ b/lib/logitech_receiver/receiver.py @@ -38,7 +38,7 @@ _IR = _hidpp10.INFO_SUBREGISTERS # -class Receiver(object): +class Receiver: """A Unifying Receiver instance. The paired devices are available through the sequence interface. diff --git a/lib/logitech_receiver/settings.py b/lib/logitech_receiver/settings.py index 2953d340..d1eb96fd 100644 --- a/lib/logitech_receiver/settings.py +++ b/lib/logitech_receiver/settings.py @@ -42,7 +42,7 @@ SENSITIVITY_IGNORE = 'ignore' KIND = _NamedInts(toggle=0x01, choice=0x02, range=0x04, map_choice=0x0A, multiple_toggle=0x10, multiple_range=0x40) -class Setting(object): +class Setting: """A setting descriptor. Needs to be instantiated for each specific device.""" __slots__ = ( @@ -514,7 +514,7 @@ class BitFieldWithOffsetAndMaskSetting(BitFieldSetting): # -class RegisterRW(object): +class RegisterRW: __slots__ = ('register', ) kind = _NamedInt(0x01, _('register')) @@ -530,7 +530,7 @@ class RegisterRW(object): return device.write_register(self.register, data_bytes) -class FeatureRW(object): +class FeatureRW: __slots__ = ('feature', 'read_fnid', 'write_fnid', 'prefix', 'no_reply') kind = _NamedInt(0x02, _('feature')) @@ -597,7 +597,7 @@ class FeatureRWMap(FeatureRW): # -class BooleanValidator(object): +class BooleanValidator: __slots__ = ('true_value', 'false_value', 'read_offset', 'mask', 'needs_current_value') kind = KIND.toggle @@ -710,7 +710,7 @@ class BooleanValidator(object): return to_write -class BitFieldValidator(object): +class BitFieldValidator: __slots__ = ('byte_count', 'options') kind = KIND.multiple_toggle @@ -745,7 +745,7 @@ class BitFieldValidator(object): return self.options -class BitFieldWithOffsetAndMaskValidator(object): +class BitFieldWithOffsetAndMaskValidator: __slots__ = ('byte_count', 'options', '_option_from_key', '_mask_from_offset', '_option_from_offset_mask') kind = KIND.multiple_toggle @@ -827,7 +827,7 @@ class BitFieldWithOffsetAndMaskValidator(object): return [int(opt) if isinstance(opt, int) else opt.as_int() for opt in self.options] -class ChoicesValidator(object): +class ChoicesValidator: kind = KIND.choice """Translates between NamedInts and a byte sequence. :param choices: a list of NamedInts @@ -939,7 +939,7 @@ class ChoicesMapValidator(ChoicesValidator): return self._write_prefix_bytes + new_value.to_bytes(self._byte_count, 'big') -class RangeValidator(object): +class RangeValidator: __slots__ = ('min_value', 'max_value', 'flag', '_byte_count', 'needs_current_value') kind = KIND.range @@ -1042,7 +1042,7 @@ class MultipleRangeValidator: return w + b'\xFF' -class ActionSettingRW(object): +class ActionSettingRW: """Special RW class for settings that turn on and off special processing when a key or button is depressed""" def __init__(self, name, divert_setting_name): self.name = name diff --git a/lib/logitech_receiver/settings_templates.py b/lib/logitech_receiver/settings_templates.py index c09ff55e..3b8bcb73 100644 --- a/lib/logitech_receiver/settings_templates.py +++ b/lib/logitech_receiver/settings_templates.py @@ -672,7 +672,7 @@ def _feature_reprogrammable_keys(): return _Settings(_REPROGRAMMABLE_KEYS, rw, callback=_feature_reprogrammable_keys_callback, device_kind=(_DK.keyboard, )) -class DivertKeysRW(object): +class DivertKeysRW: def __init__(self): self.kind = _FeatureRW.kind