common: add alternative way to initialize NamedInts and lower python dependency to 3.6
This commit is contained in:
parent
041aed3b42
commit
fcddd94d7d
|
@ -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())
|
||||
|
|
File diff suppressed because it is too large
Load Diff
2
setup.py
2
setup.py
|
@ -59,7 +59,7 @@ For instructions on installing Solaar see https://pwr-solaar.github.io/Solaar/in
|
|||
# sudo apt install python-gi python3-gi \
|
||||
# gir1.2-gtk-3.0 gir1.2-notify-0.7 gir1.2-ayatanaappindicator3-0.1
|
||||
# os_requires=['gi.repository.GObject (>= 2.0)', 'gi.repository.Gtk (>= 3.0)'],
|
||||
python_requires='>=3.7',
|
||||
python_requires='>=3.6',
|
||||
install_requires=[
|
||||
'evdev (>= 1.1.2)',
|
||||
'pyudev (>= 0.13)',
|
||||
|
|
Loading…
Reference in New Issue