summaryrefslogtreecommitdiff
path: root/kvmd/keyboard
diff options
context:
space:
mode:
authorOleg Girko <[email protected]>2020-08-18 03:44:06 +0300
committerOleg Girko <[email protected]>2020-09-01 19:24:13 +0300
commit2dbf11428f01b748619ac5b25215c7d7a0b07dbc (patch)
treeabdc93c161c4c0678106dc66ffde3f66b98ef0c4 /kvmd/keyboard
parent5307765399c1a3280eeb33380047195a118eb935 (diff)
Remove all uses of assignment expressions.
This is needed to port to Python 3.7 because Raspbian 10 doesn't have Python 3.8. Signed-off-by: Oleg Girko <[email protected]>
Diffstat (limited to 'kvmd/keyboard')
-rw-r--r--kvmd/keyboard/keysym.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/kvmd/keyboard/keysym.py b/kvmd/keyboard/keysym.py
index aa4a8676..2f2bc7a2 100644
--- a/kvmd/keyboard/keysym.py
+++ b/kvmd/keyboard/keysym.py
@@ -54,7 +54,8 @@ def build_symmap(path: str) -> Dict[int, SymmapWebKey]:
(path, list(_read_keyboard_layout(path).items())),
]:
for (code, key) in items:
- if (web_name := AT1_TO_WEB.get(key.code)) is not None:
+ web_name = AT1_TO_WEB.get(key.code)
+ if web_name is not None:
if (
(web_name in ["ShiftLeft", "ShiftRight"] and key.shift) # pylint: disable=too-many-boolean-expressions
or (web_name in ["AltLeft", "AltRight"] and key.altgr)
@@ -113,7 +114,8 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
parts = line.split()
if len(parts) >= 2:
- if (x11_code := _resolve_keysym(parts[0])) != 0:
+ x11_code = _resolve_keysym(parts[0])
+ if x11_code != 0:
try:
at1_code = int(parts[1], 16)
except ValueError as err:
@@ -128,7 +130,8 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
ctrl=("ctrl" in rest),
)
- if "addupper" in rest and (x11_code := _resolve_keysym(parts[0].upper())) != 0:
+ x11_code = _resolve_keysym(parts[0].upper())
+ if "addupper" in rest and x11_code != 0:
layout[x11_code] = At1Key(
code=at1_code,
shift=True,