From e4ba201cd2c9d3b9e7f4c8054204bb541c4ced84 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Wed, 1 Apr 2026 18:34:12 -0700 Subject: [PATCH] refactor: use module-level socket import in _ttyd_is_listening --- muxplex/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/muxplex/main.py b/muxplex/main.py index 0817579..1b6a45f 100644 --- a/muxplex/main.py +++ b/muxplex/main.py @@ -574,10 +574,8 @@ def _ttyd_is_listening() -> bool: ConnectionRefusedError when it's not. OSError/TimeoutError are also caught so the caller always gets a bool. """ - import socket as _sock - try: - with _sock.create_connection(("127.0.0.1", TTYD_PORT), timeout=0.5): + with socket.create_connection(("127.0.0.1", TTYD_PORT), timeout=0.5): return True except (ConnectionRefusedError, OSError, TimeoutError): return False