mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 06:21:15 +02:00
refactor(gns3server,tests): StrEnum, ASYNC109 and others
This commit is contained in:
54 files changed
+195
-165
No files matched your search
@@ -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):
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user