mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-04 12:00:16 +00:00
linting
This commit is contained in:
parent
dc0b5db22e
commit
d93cce86fa
@ -33,7 +33,7 @@ def get_data_path(filename=''):
|
|||||||
|
|
||||||
# depending on where this file is installed to, make sure to use the proper
|
# depending on where this file is installed to, make sure to use the proper
|
||||||
# prefix path for data
|
# prefix path for data
|
||||||
# https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa
|
# https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa pylint: disable=line-too-long
|
||||||
if source_path.startswith(site.USER_BASE):
|
if source_path.startswith(site.USER_BASE):
|
||||||
data_path = os.path.join(site.USER_BASE, 'share/key-mapper')
|
data_path = os.path.join(site.USER_BASE, 'share/key-mapper')
|
||||||
elif source_path.startswith('/usr/local/'):
|
elif source_path.startswith('/usr/local/'):
|
||||||
|
@ -274,8 +274,8 @@ class KeycodeInjector:
|
|||||||
handler=lambda keycode, value: (
|
handler=lambda keycode, value: (
|
||||||
self._write(
|
self._write(
|
||||||
keymapper_device,
|
keymapper_device,
|
||||||
target_keycode,
|
keycode,
|
||||||
event.value
|
value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).run()
|
).run()
|
||||||
|
@ -101,12 +101,12 @@ class _Macro:
|
|||||||
self.tasks.append(lambda: self.handler(character, 0))
|
self.tasks.append(lambda: self.handler(character, 0))
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def wait(self, min, max=None):
|
def wait(self, min_time, max_time=None):
|
||||||
"""Wait a random time in milliseconds"""
|
"""Wait a random time in milliseconds"""
|
||||||
if max is None:
|
if max_time is None:
|
||||||
sleeptime = min
|
sleeptime = min_time
|
||||||
else:
|
else:
|
||||||
sleeptime = random.random() * (max - min) + min
|
sleeptime = random.random() * (max_time - min_time) + min_time
|
||||||
|
|
||||||
self.tasks.append(lambda: time.sleep(sleeptime / 1000))
|
self.tasks.append(lambda: time.sleep(sleeptime / 1000))
|
||||||
return self
|
return self
|
||||||
@ -188,7 +188,7 @@ def _parse_recurse(macro, handler, macro_instance=None, depth=0):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if functions.get(call) is None:
|
if functions.get(call) is None:
|
||||||
logger.error(f'Unknown function %s', call)
|
logger.error('Unknown function %s', call)
|
||||||
|
|
||||||
# get all the stuff inbetween
|
# get all the stuff inbetween
|
||||||
brackets = 0
|
brackets = 0
|
||||||
@ -203,14 +203,14 @@ def _parse_recurse(macro, handler, macro_instance=None, depth=0):
|
|||||||
if char == ')':
|
if char == ')':
|
||||||
brackets -= 1
|
brackets -= 1
|
||||||
if brackets < 0:
|
if brackets < 0:
|
||||||
logger.error(f'There is one ")" too much at %s', position)
|
logger.error('There is one ")" too much at %s', position)
|
||||||
return
|
return
|
||||||
if brackets == 0:
|
if brackets == 0:
|
||||||
# the closing bracket of the call
|
# the closing bracket of the call
|
||||||
break
|
break
|
||||||
|
|
||||||
if brackets != 0:
|
if brackets != 0:
|
||||||
logger.error(f'There are %s closing brackets missing', brackets)
|
logger.error('There are %s closing brackets missing', brackets)
|
||||||
|
|
||||||
inner = macro[2:position - 1]
|
inner = macro[2:position - 1]
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ def can_read_devices():
|
|||||||
def warn(group):
|
def warn(group):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'Some devices may not be visible without being in the '
|
'Some devices may not be visible without being in the '
|
||||||
f'"%s" user group. Try `sudo usermod -a -G %s $USER` '
|
'"%s" user group. Try `sudo usermod -a -G %s $USER` '
|
||||||
'and log out and back in.',
|
'and log out and back in.',
|
||||||
group,
|
group,
|
||||||
group
|
group
|
||||||
|
@ -225,7 +225,7 @@ class Window:
|
|||||||
self.dbus.stop_injecting(self.selected_device)
|
self.dbus.stop_injecting(self.selected_device)
|
||||||
self.get('status_bar').push(
|
self.get('status_bar').push(
|
||||||
CTX_APPLY,
|
CTX_APPLY,
|
||||||
f'Applied the system default'
|
'Applied the system default'
|
||||||
)
|
)
|
||||||
# restart reading because after injecting the device landscape
|
# restart reading because after injecting the device landscape
|
||||||
# changes a bit
|
# changes a bit
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="73" height="20">
|
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="20">
|
||||||
<linearGradient id="b" x2="0" y2="100%">
|
<linearGradient id="b" x2="0" y2="100%">
|
||||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||||
<stop offset="1" stop-opacity=".1"/>
|
<stop offset="1" stop-opacity=".1"/>
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
<mask id="anybadge_1">
|
<mask id="anybadge_1">
|
||||||
<rect width="73" height="20" rx="3" fill="#fff"/>
|
<rect width="80" height="20" rx="3" fill="#fff"/>
|
||||||
</mask>
|
</mask>
|
||||||
<g mask="url(#anybadge_1)">
|
<g mask="url(#anybadge_1)">
|
||||||
<path fill="#555" d="M0 0h44v20H0z"/>
|
<path fill="#555" d="M0 0h44v20H0z"/>
|
||||||
<path fill="#4c1" d="M44 0h29v20H44z"/>
|
<path fill="#4c1" d="M44 0h36v20H44z"/>
|
||||||
<path fill="url(#b)" d="M0 0h73v20H0z"/>
|
<path fill="url(#b)" d="M0 0h80v20H0z"/>
|
||||||
</g>
|
</g>
|
||||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||||
<text x="23.0" y="15" fill="#010101" fill-opacity=".3">pylint</text>
|
<text x="23.0" y="15" fill="#010101" fill-opacity=".3">pylint</text>
|
||||||
<text x="22.0" y="14">pylint</text>
|
<text x="22.0" y="14">pylint</text>
|
||||||
</g>
|
</g>
|
||||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||||
<text x="59.5" y="15" fill="#010101" fill-opacity=".3">9.6</text>
|
<text x="63.0" y="15" fill="#010101" fill-opacity=".3">9.77</text>
|
||||||
<text x="58.5" y="14">9.6</text>
|
<text x="62.0" y="14">9.77</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -37,9 +37,9 @@ class TestMacros(unittest.TestCase):
|
|||||||
self.assertListEqual(self.result, [(1, 1), (1, 0)])
|
self.assertListEqual(self.result, [(1, 1), (1, 0)])
|
||||||
|
|
||||||
def test_1(self):
|
def test_1(self):
|
||||||
parse('k(1).k(a).k(3)', self.handler).run()
|
parse('k(1 2).k(a).k(3)', self.handler).run()
|
||||||
self.assertListEqual(self.result, [
|
self.assertListEqual(self.result, [
|
||||||
(1, 1), (1, 0),
|
('1 2', 1), ('1 2', 0),
|
||||||
('a', 1), ('a', 0),
|
('a', 1), ('a', 0),
|
||||||
(3, 1), (3, 0),
|
(3, 1), (3, 0),
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user