From aad61b320d65953fddec10b019a186fc67f57a5d Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 10 Feb 2024 12:20:29 +0100 Subject: [PATCH] src/model/transport.py: Port to paramiko 3.x --- src/model/transport.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/model/transport.py b/src/model/transport.py index 0c2ee16..5a2bd22 100644 --- a/src/model/transport.py +++ b/src/model/transport.py @@ -117,7 +117,6 @@ from paramiko.kex_gss import KexGSSGex, KexGSSGroup1, KexGSSGroup14 from paramiko.message import Message from paramiko.packet import Packetizer, NeedRekeyException from paramiko.primes import ModulusPack -from paramiko.py3compat import string_types, long, byte_ord, b, input, PY2 from paramiko.rsakey import RSAKey from paramiko.ecdsakey import ECDSAKey from paramiko.server import ServerInterface @@ -128,7 +127,7 @@ from paramiko.ssh_exception import ( ChannelException, ProxyCommandFailure, ) -from paramiko.util import retry_on_signal, ClosingContextManager, clamp_value +from paramiko.util import ClosingContextManager, clamp_value # for thread cleanup @@ -396,7 +395,7 @@ class Transport(threading.Thread, ClosingContextManager): self.active = False self.hostname = None - if isinstance(sock, string_types): + if isinstance(sock, str): # convert "host:port" into (host, port) hl = sock.split(":", 1) self.hostname = hl[0] @@ -419,7 +418,7 @@ class Transport(threading.Thread, ClosingContextManager): sock = socket.socket(af, socket.SOCK_STREAM) sock.settimeout(1) try: - retry_on_signal(lambda: sock.connect((hostname, port))) + sock.connect((hostname, port)) except socket.error as e: reason = str(e) else: @@ -542,7 +541,7 @@ class Transport(threading.Thread, ClosingContextManager): """ Returns a string representation of this object, for debugging. """ - id_ = hex(long(id(self)) & xffffffff) + id_ = hex(int(id(self)) & xffffffff) out = "