fix: ignore pyright LSP variable unbound warning

This commit is contained in:
minhtrannhat 2023-11-30 14:53:19 -05:00
parent b8b6a1b2bf
commit a50e6c75c8
Signed by: minhtrannhat
GPG Key ID: E13CFA85C53F8062

View File

@ -30,12 +30,11 @@ class UDPClient:
self.debug = debug self.debug = debug
def run(self): def run(self):
# server cannot be reached, stop the client immediately # server cannot be reached, stop the client immediately
if not self.pong_received: if not self.pong_received:
return return
client_socket = None # shutup the variableNotBound warning
while True: while True:
try: try:
client_socket = socket(AF_INET, SOCK_DGRAM) 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." 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: finally:
client_socket.close() client_socket.close() # type: ignore
# ping pong UDP # ping pong UDP
def check_udp_server(self): def check_udp_server(self):