From fcddd94d7df502d15113fcbd2eb13ae9e26bfac5 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 20 Apr 2022 09:19:46 -0400 Subject: [PATCH] common: add alternative way to initialize NamedInts and lower python dependency to 3.6 --- lib/logitech_receiver/common.py | 5 +- lib/logitech_receiver/special_keys.py | 1216 ++++++++++++------------- setup.py | 2 +- 3 files changed, 612 insertions(+), 611 deletions(-) diff --git a/lib/logitech_receiver/common.py b/lib/logitech_receiver/common.py index 4189fce3..d4b25e36 100644 --- a/lib/logitech_receiver/common.py +++ b/lib/logitech_receiver/common.py @@ -82,14 +82,15 @@ class NamedInts: """ __slots__ = ('__dict__', '_values', '_indexed', '_fallback', '_is_sorted') - def __init__(self, **kwargs): + def __init__(self, dict=None, **kwargs): def _readable_name(n): if not is_string(n): raise TypeError('expected string, got ' + str(type(n))) return n.replace('__', '/').replace('_', ' ') # print (repr(kwargs)) - values = {k: NamedInt(v, _readable_name(k)) for (k, v) in kwargs.items()} + elements = dict if dict else kwargs + values = {k: NamedInt(v, _readable_name(k)) for (k, v) in elements.items()} self.__dict__ = values self._is_sorted = False self._values = list(values.values()) diff --git a/lib/logitech_receiver/special_keys.py b/lib/logitech_receiver/special_keys.py index c503e417..c4cf99c8 100644 --- a/lib/logitech_receiver/special_keys.py +++ b/lib/logitech_receiver/special_keys.py @@ -23,286 +23,286 @@ from .common import NamedInts as _NamedInts from .common import UnsortedNamedInts as _UnsortedNamedInts # = 2.0)', 'gi.repository.Gtk (>= 3.0)'], - python_requires='>=3.7', + python_requires='>=3.6', install_requires=[ 'evdev (>= 1.1.2)', 'pyudev (>= 0.13)',