diff options
author | Maxim Devaev <[email protected]> | 2022-09-04 18:08:40 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-09-04 18:08:40 +0300 |
commit | ee3e224e396494cd0d69bb6167087a071a20349c (patch) | |
tree | 5becd28570e58a03c6e1e231d0db24c264a73f88 /kvmd/apps/janus/runner.py | |
parent | 4b75221e9470b4a009955d7677f16adf8e23e302 (diff) |
new typing style
Diffstat (limited to 'kvmd/apps/janus/runner.py')
-rw-r--r-- | kvmd/apps/janus/runner.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/kvmd/apps/janus/runner.py b/kvmd/apps/janus/runner.py index 799fd94c..c2d01dad 100644 --- a/kvmd/apps/janus/runner.py +++ b/kvmd/apps/janus/runner.py @@ -3,10 +3,6 @@ import asyncio.subprocess import socket import dataclasses -from typing import Tuple -from typing import List -from typing import Optional - import netifaces from ... import tools @@ -42,9 +38,9 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes check_retries: int, check_retries_delay: float, - cmd: List[str], - cmd_remove: List[str], - cmd_append: List[str], + cmd: list[str], + cmd_remove: list[str], + cmd_append: list[str], ) -> None: self.__stun = Stun(stun_host, stun_port, stun_timeout, stun_retries, stun_retries_delay) @@ -55,8 +51,8 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes self.__cmd = tools.build_cmd(cmd, cmd_remove, cmd_append) - self.__janus_task: Optional[asyncio.Task] = None - self.__janus_proc: Optional[asyncio.subprocess.Process] = None # pylint: disable=no-member + self.__janus_task: (asyncio.Task | None) = None + self.__janus_proc: (asyncio.subprocess.Process | None) = None # pylint: disable=no-member def run(self) -> None: logger = get_logger(0) @@ -68,7 +64,7 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes async def __run(self) -> None: logger = get_logger(0) - prev_netcfg: Optional[_Netcfg] = None + prev_netcfg: (_Netcfg | None) = None while True: retry = 0 netcfg = _Netcfg() @@ -117,7 +113,7 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes get_logger().error("Can't get default IP: %s", tools.efmt(err)) return "" - async def __get_stun_info(self, src_ip: str) -> Tuple[Stun, Tuple[str, str]]: + async def __get_stun_info(self, src_ip: str) -> tuple[Stun, tuple[str, str]]: try: return (self.__stun, (await self.__stun.get_info(src_ip, 0))) except Exception as err: |