refactor: ruff autofixes

This commit is contained in:
Mark Paronyan committed 2026-10-17 11:43:36 +03:00
1 parent 54139dced2
commit b7e6c02647
39 files changed
+76 -88

No files matched your search

+3 -3
View File
@@ -323,7 +323,7 @@ class Docker(BaseManager):
)
except aiohttp.ClientError as e:
raise DockerError(f"Docker has returned an error: {e}")
except asyncio.TimeoutError:
except TimeoutError:
raise DockerError("Docker timeout " + method + " " + path)
if response.status >= 300:
body = await response.read()
@@ -391,7 +391,7 @@ class Docker(BaseManager):
raise DockerError(
f"Disconnected while pulling Docker image '{image}' from Docker repository"
) from e
except asyncio.TimeoutError as e:
except TimeoutError as e:
raise DockerError(f"Timeout while pulling Docker image '{image}' from Docker repository") from e
if not chunk:
break
@@ -448,7 +448,7 @@ class Docker(BaseManager):
chunk = await response.content.read(CHUNK_SIZE)
except aiohttp.ServerDisconnectedError as e:
raise DockerError("Disconnected while loading Docker image") from e
except asyncio.TimeoutError as e:
except TimeoutError as e:
raise DockerError("Timeout while loading Docker image") from e
if not chunk:
break
+4 -12
View File
@@ -948,7 +948,7 @@ class DockerVM(DockerKernelDatapathMixin, BaseNode):
await self._start_vnc_process(restart=True)
try:
await wait_for_file_creation(x11_socket)
except asyncio.TimeoutError:
except TimeoutError:
raise DockerError(f'x11 socket file "{x11_socket}" does not exist')
monitor_process(self._vnc_process, self._vnc_callback)
@@ -1190,7 +1190,7 @@ class DockerVM(DockerKernelDatapathMixin, BaseNode):
return False
try:
_, stderr = await asyncio.wait_for(process.communicate(), timeout=60)
except asyncio.TimeoutError:
except TimeoutError:
process.kill()
await process.communicate()
log.warning(f"Docker container '{self._name}': reclaiming '{directory}' timed out")
@@ -1254,7 +1254,7 @@ class DockerVM(DockerKernelDatapathMixin, BaseNode):
x11_socket = os.path.join("/tmp/.X11-unix/", f"X{self._display}")
try:
await wait_for_file_creation(x11_socket)
except asyncio.TimeoutError:
except TimeoutError:
raise DockerError(f'x11 socket file "{x11_socket}" does not exist')
if not hasattr(sys, "_called_from_test") or not sys._called_from_test:
@@ -1711,15 +1711,7 @@ class DockerVM(DockerKernelDatapathMixin, BaseNode):
status_line = headers.split(b"\r\n", 1)[0]
if b" 101 " not in status_line and b" 200 " not in status_line:
raise DockerError(f"Docker interface monitor was rejected: {status_line.decode(errors='ignore')}")
except (
DockerError,
OSError,
KeyError,
TypeError,
RuntimeError,
asyncio.IncompleteReadError,
asyncio.TimeoutError,
) as e:
except (TimeoutError, DockerError, OSError, KeyError, TypeError, RuntimeError, asyncio.IncompleteReadError) as e:
if "writer" in locals():
await self._close_interface_monitor_writer(writer)
log.warning("Could not monitor interfaces for Docker container '%s': %s", self.name, e)
@@ -459,7 +459,7 @@ class VendorDockerVM(DockerVM):
# setup; wait instead of silently blackholing the adapter.
try:
await wait_for_file_creation(remote_sock, timeout=30)
except asyncio.TimeoutError:
except TimeoutError:
raise DockerError(
f"Socket '{remote_sock}' for adapter {adapter_number} of container "
f"'{self._name}' did not appear within 30 seconds. Check that the "
@@ -806,7 +806,7 @@ class _LazyExecTelnetServer(AsyncioTelnetServer):
await writer.drain()
try:
headers = await asyncio.wait_for(reader.readuntil(b"\r\n\r\n"), timeout=5)
except (asyncio.IncompleteReadError, asyncio.TimeoutError) as e:
except (TimeoutError, asyncio.IncompleteReadError) as e:
writer.close()
raise DockerError(f"Docker exec start failed: {e}")
status_line = headers.split(b"\r\n", 1)[0]