diff --git a/gunicorn/ctl/cli.py b/gunicorn/ctl/cli.py index 6bd4f2e4..6e8f0783 100644 --- a/gunicorn/ctl/cli.py +++ b/gunicorn/ctl/cli.py @@ -230,7 +230,7 @@ def format_all(data: dict) -> str: return "\n".join(lines) -def format_response(command: str, data: dict) -> str: +def format_response(command: str, data: dict) -> str: # pylint: disable=too-many-return-statements """ Format response data based on command. diff --git a/gunicorn/ctl/client.py b/gunicorn/ctl/client.py index e75ec713..cc9d39fa 100644 --- a/gunicorn/ctl/client.py +++ b/gunicorn/ctl/client.py @@ -19,7 +19,6 @@ from gunicorn.ctl.protocol import ( class ControlClientError(Exception): """Control client error.""" - pass class ControlClient: diff --git a/gunicorn/ctl/handlers.py b/gunicorn/ctl/handlers.py index ffde7393..827f62ee 100644 --- a/gunicorn/ctl/handlers.py +++ b/gunicorn/ctl/handlers.py @@ -210,7 +210,6 @@ class CommandHandlers: # Try to get socket family try: - import socket sock = lnr.sock if sock.family == socket.AF_UNIX: listener_info["type"] = "unix" @@ -523,8 +522,6 @@ class CommandHandlers: Returns: List of dirty worker info dicts, or empty list on error """ - import socket - # Get socket path from arbiter object or environment dirty_socket_path = None if hasattr(self.arbiter, 'dirty_arbiter') and self.arbiter.dirty_arbiter: diff --git a/gunicorn/ctl/protocol.py b/gunicorn/ctl/protocol.py index b00e4910..36d2fe78 100644 --- a/gunicorn/ctl/protocol.py +++ b/gunicorn/ctl/protocol.py @@ -26,7 +26,6 @@ import struct class ProtocolError(Exception): """Protocol-level error.""" - pass class ControlProtocol: diff --git a/gunicorn/ctl/server.py b/gunicorn/ctl/server.py index 59259f69..b585b438 100644 --- a/gunicorn/ctl/server.py +++ b/gunicorn/ctl/server.py @@ -204,7 +204,7 @@ class ControlSocketServer: self.arbiter.log.exception("Command error") return make_error_response(request_id, f"Command failed: {e}") - def _execute_command(self, parts: list) -> dict: + def _execute_command(self, parts: list) -> dict: # pylint: disable=too-many-return-statements """ Execute a parsed command. diff --git a/gunicorn/dirty/protocol.py b/gunicorn/dirty/protocol.py index 3d216c54..5f3f9d04 100644 --- a/gunicorn/dirty/protocol.py +++ b/gunicorn/dirty/protocol.py @@ -573,7 +573,7 @@ class BinaryProtocol: sock.sendall(data) @staticmethod - def _encode_from_dict(message: dict) -> bytes: + def _encode_from_dict(message: dict) -> bytes: # pylint: disable=too-many-return-statements """ Encode a message dict to binary format.