summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-12-23 20:56:16 +0300
committerMaxim Devaev <[email protected]>2021-12-23 20:56:16 +0300
commit1e98d9bd5d63270e17d2b8cddd5820114c355aed (patch)
treee2fec1979c4a22800a49deaad5188eb87b77f00f /kvmd/apps
parentaef7a5a094853972cbe1ce9127ad1a546ea7f2ab (diff)
python 3.10
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/info/extras.py2
-rw-r--r--kvmd/apps/vnc/render.py4
-rw-r--r--kvmd/apps/vnc/server.py6
3 files changed, 8 insertions, 4 deletions
diff --git a/kvmd/apps/kvmd/info/extras.py b/kvmd/apps/kvmd/info/extras.py
index 6f341ba1..1aa48c2d 100644
--- a/kvmd/apps/kvmd/info/extras.py
+++ b/kvmd/apps/kvmd/info/extras.py
@@ -75,6 +75,6 @@ class ExtrasInfoSubmanager(BaseInfoSubmanager):
extras["port"] = 0
config = self.__global_config
for item in filter(None, map(str.strip, port_path.split("/"))):
- config = getattr(config, item, None)
+ config = getattr(config, item, None) # type: ignore
if isinstance(config, int):
extras["port"] = config
diff --git a/kvmd/apps/vnc/render.py b/kvmd/apps/vnc/render.py
index 72b28e6e..fc07a2a9 100644
--- a/kvmd/apps/vnc/render.py
+++ b/kvmd/apps/vnc/render.py
@@ -49,5 +49,7 @@ def _inner_make_text_jpeg(width: int, height: int, quality: int, text: str) -> b
@functools.lru_cache()
def _get_font() -> ImageFont.FreeTypeFont:
- path = os.path.join(os.path.dirname(sys.modules[__name__].__file__), "fonts", "Azbuka04.ttf")
+ module_path = sys.modules[__name__].__file__
+ assert module_path is not None
+ path = os.path.join(os.path.dirname(module_path), "fonts", "Azbuka04.ttf")
return ImageFont.truetype(path, size=20)
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py
index bfceacf5..4c62f2a3 100644
--- a/kvmd/apps/vnc/server.py
+++ b/kvmd/apps/vnc/server.py
@@ -20,6 +20,7 @@
# ========================================================================== #
+import sys
import os
import asyncio
import socket
@@ -458,7 +459,7 @@ class VncServer: # pylint: disable=too-many-instance-attributes
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, keepalive_interval)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, keepalive_count)
timeout = (keepalive_idle + keepalive_interval * keepalive_count) * 1000 # Milliseconds
- sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, timeout)
+ sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, timeout) # type: ignore
try:
async with kvmd.make_session("", "") as kvmd_session:
@@ -507,11 +508,12 @@ class VncServer: # pylint: disable=too-many-instance-attributes
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(addr)
+ server_kwargs = ({"loop": loop} if sys.version_info < (3, 10) else {})
server = loop.run_until_complete(asyncio.start_server(
client_connected_cb=self.__handle_client,
sock=sock,
backlog=self.__max_clients,
- loop=loop,
+ **server_kwargs, # type: ignore
))
try: