From a50e6c75c87f237a50e990eee98a4d98b49a0c5a Mon Sep 17 00:00:00 2001 From: minhtrannhat Date: Thu, 30 Nov 2023 14:53:19 -0500 Subject: [PATCH] fix: ignore pyright LSP variable unbound warning --- src/myftp/client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/myftp/client.py b/src/myftp/client.py index 94b739f..1788186 100644 --- a/src/myftp/client.py +++ b/src/myftp/client.py @@ -30,12 +30,11 @@ class UDPClient: self.debug = debug def run(self): + # server cannot be reached, stop the client immediately if not self.pong_received: return - client_socket = None # shutup the variableNotBound warning - while True: try: client_socket = socket(AF_INET, SOCK_DGRAM) @@ -106,7 +105,7 @@ class UDPClient: f"myftp> - {self.mode} - ConnectionRefusedError happened. Please restart the client program, make sure the server is running and/or put a different server name and server port." ) finally: - client_socket.close() + client_socket.close() # type: ignore # ping pong UDP def check_udp_server(self):