From 634290fc754d87184adde2e7fdde13c2779e064c Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Sun, 25 Jan 2026 10:29:52 +0100 Subject: [PATCH] fix(dirty): resolve pylint warnings in dirty module --- gunicorn/dirty/app.py | 2 -- gunicorn/dirty/arbiter.py | 2 +- gunicorn/dirty/client.py | 26 ++++++++++++-------------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gunicorn/dirty/app.py b/gunicorn/dirty/app.py index e9198349..17489d02 100644 --- a/gunicorn/dirty/app.py +++ b/gunicorn/dirty/app.py @@ -89,7 +89,6 @@ class DirtyApp: This method is called in the child process after fork, so it's safe to initialize non-fork-safe resources here. """ - pass def __call__(self, action, *args, **kwargs): """ @@ -119,7 +118,6 @@ class DirtyApp: Called when the dirty worker is shutting down. Use this to release resources like database connections, unload models, etc. """ - pass def load_dirty_app(import_path): diff --git a/gunicorn/dirty/arbiter.py b/gunicorn/dirty/arbiter.py index 88846869..3f2350e4 100644 --- a/gunicorn/dirty/arbiter.py +++ b/gunicorn/dirty/arbiter.py @@ -412,7 +412,7 @@ class DirtyArbiter: def _close_worker_connection(self, worker_pid): """Close connection to a worker.""" if worker_pid in self.worker_connections: - reader, writer = self.worker_connections.pop(worker_pid) + _reader, writer = self.worker_connections.pop(worker_pid) writer.close() async def manage_workers(self): diff --git a/gunicorn/dirty/client.py b/gunicorn/dirty/client.py index f487a29a..d635d382 100644 --- a/gunicorn/dirty/client.py +++ b/gunicorn/dirty/client.py @@ -447,13 +447,12 @@ class DirtyStreamIterator: "Stream exceeded total timeout", timeout=self.client.timeout ) - else: - idle_duration = now - self._last_chunk_time - self._exhausted = True - raise DirtyTimeoutError( - f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)", - timeout=self._idle_timeout - ) + idle_duration = now - self._last_chunk_time + self._exhausted = True + raise DirtyTimeoutError( + f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)", + timeout=self._idle_timeout + ) except Exception as e: self._exhausted = True self.client._close_socket() @@ -599,12 +598,11 @@ class DirtyAsyncStreamIterator: "Stream exceeded total timeout", timeout=self.client.timeout ) - else: - idle_duration = now - self._last_chunk_time - raise DirtyTimeoutError( - f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)", - timeout=self._idle_timeout - ) + idle_duration = now - self._last_chunk_time + raise DirtyTimeoutError( + f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)", + timeout=self._idle_timeout + ) except Exception as e: self._exhausted = True await self.client._close_async() @@ -658,7 +656,7 @@ _dirty_socket_path = None def set_dirty_socket_path(path): """Set the global dirty socket path (called during initialization).""" - global _dirty_socket_path + global _dirty_socket_path # pylint: disable=global-statement _dirty_socket_path = path