refactor(gns3server,tests): StrEnum, ASYNC109 and others

This commit is contained in:
Mark Paronyan committed 2026-10-17 12:02:53 +03:00
1 parent b7e6c02647
commit 4c311baabf
54 files changed
+195 -165

No files matched your search

+2 -2
View File
@@ -85,7 +85,7 @@ async def subprocess_check_output(*args, cwd=None, env=None, stderr=False):
return output.decode("utf-8", errors="ignore")
async def wait_for_process_termination(process, timeout=10):
async def wait_for_process_termination(process, timeout=10): # noqa: ASYNC109 - operation-specific timeout is intentional
"""
Wait for a process terminate, and raise asyncio.TimeoutError in case of
timeout.
@@ -118,7 +118,7 @@ def monitor_process(process, termination_callback):
asyncio.ensure_future(_check_process(process, termination_callback))
async def wait_for_file_creation(path, timeout=60):
async def wait_for_file_creation(path, timeout=60): # noqa: ASYNC109 - operation-specific timeout is intentional
while timeout > 0:
if os.path.exists(path):
+2 -2
View File
@@ -38,7 +38,7 @@ class NotificationQueue(asyncio.Queue):
self._first = True
self._last_ping = None
async def get(self, timeout):
async def get(self, timeout): # noqa: ASYNC109 - operation-specific timeout is intentional
"""
Return a notification, or a ping notification with server information
at least every `timeout` seconds. The ping used to be generated only
@@ -84,7 +84,7 @@ class NotificationQueue(asyncio.Queue):
log.warning(f"Could not get CPU and memory usage from psutil: {e}")
return msg
async def get_json(self, timeout):
async def get_json(self, timeout): # noqa: ASYNC109 - operation-specific timeout is intentional
"""
Get a message as a JSON
"""
+2 -2
View File
@@ -40,7 +40,7 @@ async def websocket_proxy(
target_url: str,
requested_protocols: Optional[list] = None,
buffer_size: int = 65536,
timeout: Optional[float] = None,
timeout: Optional[float] = None, # noqa: ASYNC109 - operation-specific timeout is intentional
) -> None:
"""
Proxy binary WebSocket data between client and target WebSocket server.
@@ -142,7 +142,7 @@ async def websocket_proxy_with_manual_accept(
target_url: str,
requested_protocols: Optional[list] = None,
buffer_size: int = 65536,
timeout: Optional[float] = None,
timeout: Optional[float] = None, # noqa: ASYNC109 - operation-specific timeout is intentional
) -> None:
"""
Proxy binary WebSocket data between client and target WebSocket server.