mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 14:31:13 +02:00
refactor: ruff autofixes
This commit is contained in:
39 files changed
+76
-88
No files matched your search
@@ -125,7 +125,7 @@ async def wait_for_file_creation(path, timeout=60):
|
||||
return
|
||||
await asyncio.sleep(0.5)
|
||||
timeout -= 0.5
|
||||
raise asyncio.TimeoutError()
|
||||
raise TimeoutError()
|
||||
|
||||
|
||||
def locking(f):
|
||||
|
||||
@@ -66,7 +66,7 @@ async def _asyncio_open_serial_unix(path):
|
||||
try:
|
||||
# wait for VM to create the pipe file.
|
||||
await wait_for_file_creation(path)
|
||||
except asyncio.TimeoutError:
|
||||
except TimeoutError:
|
||||
raise NodeError(f'Pipe file "{path}" is missing')
|
||||
|
||||
output = SerialReaderWriterProtocol()
|
||||
|
||||
@@ -147,7 +147,7 @@ class AsyncioSSHServer:
|
||||
try:
|
||||
process.stdout.write(data)
|
||||
await asyncio.wait_for(process.stdout.drain(), timeout=BROADCAST_DRAIN_TIMEOUT)
|
||||
except (OSError, ConnectionError, asyncio.TimeoutError, asyncssh.Error):
|
||||
except (TimeoutError, OSError, ConnectionError, asyncssh.Error):
|
||||
await self._disconnect_client(process)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
|
||||
@@ -324,7 +324,7 @@ class AsyncioTelnetServer:
|
||||
try:
|
||||
connection.writer.write(data)
|
||||
await asyncio.wait_for(connection.writer.drain(), timeout=BROADCAST_DRAIN_TIMEOUT)
|
||||
except (OSError, ConnectionError, asyncio.TimeoutError) as e:
|
||||
except (TimeoutError, OSError, ConnectionError) as e:
|
||||
client_info = self._get_peername(network_writer)
|
||||
log.debug(
|
||||
"Error sending data to client %s: %s, closing and removing from connection table.",
|
||||
@@ -352,7 +352,7 @@ class AsyncioTelnetServer:
|
||||
log.debug("Sending keepalive to client %s", client_info)
|
||||
connection.writer.send_iac(IAC + NOP)
|
||||
await asyncio.wait_for(connection.writer.drain(), timeout=BROADCAST_DRAIN_TIMEOUT)
|
||||
except (OSError, ConnectionError, asyncio.TimeoutError) as e:
|
||||
except (TimeoutError, OSError, ConnectionError) as e:
|
||||
log.debug(
|
||||
"Keepalive failed for client %s: %s, closing connection.",
|
||||
client_info,
|
||||
|
||||
@@ -59,7 +59,7 @@ class NotificationQueue(asyncio.Queue):
|
||||
try:
|
||||
(action, msg, kwargs) = await asyncio.wait_for(super().get(), timeout - (now - self._last_ping))
|
||||
return (action, msg, kwargs)
|
||||
except asyncio.TimeoutError:
|
||||
except TimeoutError:
|
||||
continue # the ping deadline has been reached
|
||||
|
||||
def _ping(self):
|
||||
|
||||
Reference in new issue
Block a user