lint fixes

This commit is contained in:
Devaev Maxim 2020-05-22 14:36:01 +03:00
parent 08950a5fbd
commit 0fa0680bd7
6 changed files with 7 additions and 9 deletions

View File

@ -204,5 +204,5 @@ async def run_region_task(
if entered.done():
return
if (exc := task.exception()) is not None: # noqa: E203,E231
if (exc := task.exception()) is not None:
raise exc

View File

@ -69,7 +69,7 @@ def get_exposed_http(obj: object) -> List[HttpExposed]:
handler=handler,
)
for name in dir(obj)
if inspect.ismethod(handler := getattr(obj, name)) and getattr(handler, _HTTP_EXPOSED, False) # noqa: E203
if inspect.ismethod(handler := getattr(obj, name)) and getattr(handler, _HTTP_EXPOSED, False)
]
@ -99,7 +99,7 @@ def get_exposed_ws(obj: object) -> List[WsExposed]:
handler=handler,
)
for name in dir(obj)
if inspect.ismethod(handler := getattr(obj, name)) and getattr(handler, _WS_EXPOSED, False) # noqa: E203
if inspect.ismethod(handler := getattr(obj, name)) and getattr(handler, _WS_EXPOSED, False)
]

View File

@ -41,7 +41,7 @@ def build_symmap(path: str) -> Dict[int, str]:
symmap[x11_code] = keymap.AT1_TO_WEB[at1_code]
for (x11_code, at1_code) in _read_keyboard_layout(path).items():
if (web_name := keymap.AT1_TO_WEB.get(at1_code)) is not None: # noqa: E203,E231
if (web_name := keymap.AT1_TO_WEB.get(at1_code)) is not None:
# mypy bug
symmap[x11_code] = web_name # type: ignore
return symmap
@ -89,7 +89,7 @@ def _read_keyboard_layout(path: str) -> Dict[int, int]: # Keysym to evdev (at1)
parts = line.split()
if len(parts) >= 2:
if (code := _resolve_keysym(parts[0])) != 0: # noqa: E203,E231
if (code := _resolve_keysym(parts[0])) != 0:
try:
layout[code] = int(parts[1], 16)
except ValueError as err:

View File

@ -365,7 +365,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
}
while True:
msg_type = await self._read_number("B")
if (handler := handlers.get(msg_type)) is not None: # noqa: E203,E231
if (handler := handlers.get(msg_type)) is not None:
await handler() # type: ignore # mypy bug
else:
raise RfbError(f"Unknown message type: {msg_type}")

View File

@ -249,7 +249,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
# =====
async def _on_key_event(self, code: int, state: bool) -> None:
if (web_name := self.__symmap.get(code)) is not None: # noqa: E203,E231
if (web_name := self.__symmap.get(code)) is not None:
await self.__ws_writer_queue.put({
"event_type": "key",
"event": {"key": web_name, "state": state},

View File

@ -10,9 +10,7 @@ changedir = /src
[testenv:flake8]
whitelist_externals = bash
commands = bash -c 'flake8 --config=testenv/linters/flake8.ini kvmd testenv/tests *.py'
# FIXME: pyflakes from master to support walrus
deps =
git+https://github.com/PyCQA/pyflakes@1911c20#egg=pyflakes
flake8
flake8-quotes
-rrequirements.txt