From e0c6a2c3cd84fd6b93fd4e28e3bc54dedb4b1dc3 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 16 Jan 2023 19:43:11 -0500 Subject: well that's just super()! --- paramiko/_winapi.py | 4 ++-- paramiko/channel.py | 2 +- paramiko/sftp_client.py | 2 +- paramiko/sftp_server.py | 6 +++--- paramiko/sftp_si.py | 2 +- paramiko/ssh_exception.py | 2 +- tests/test_client.py | 2 +- tests/test_gssapi.py | 2 +- tests/test_transport.py | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/paramiko/_winapi.py b/paramiko/_winapi.py index 37cbb9c9..42954574 100644 --- a/paramiko/_winapi.py +++ b/paramiko/_winapi.py @@ -61,7 +61,7 @@ class WindowsError(builtins.WindowsError): value = ctypes.windll.kernel32.GetLastError() strerror = format_system_message(value) args = 0, strerror, None, value - super(WindowsError, self).__init__(*args) + super().__init__(*args) @property def message(self): @@ -322,7 +322,7 @@ class SECURITY_ATTRIBUTES(ctypes.Structure): ] def __init__(self, *args, **kwargs): - super(SECURITY_ATTRIBUTES, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.nLength = ctypes.sizeof(SECURITY_ATTRIBUTES) @property diff --git a/paramiko/channel.py b/paramiko/channel.py index 5e0f6ab6..0e009eff 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -1386,5 +1386,5 @@ class ChannelStdinFile(ChannelFile): """ def close(self): - super(ChannelStdinFile, self).close() + super().close() self.channel.shutdown_write() diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index 2a615345..d91a3951 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -179,7 +179,7 @@ class SFTPClient(BaseSFTP, ClosingContextManager): # escape '%' in msg (they could come from file or directory names) # before logging msg = msg.replace("%", "%%") - super(SFTPClient, self)._log( + super()._log( level, "[chan %s] " + msg, *([self.sock.get_name()] + list(args)) diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py index da97b090..2d42b371 100644 --- a/paramiko/sftp_server.py +++ b/paramiko/sftp_server.py @@ -129,11 +129,11 @@ class SFTPServer(BaseSFTP, SubsystemHandler): def _log(self, level, msg): if issubclass(type(msg), list): for m in msg: - super(SFTPServer, self)._log( + super()._log( level, "[chan " + self.sock.get_name() + "] " + m ) else: - super(SFTPServer, self)._log( + super()._log( level, "[chan " + self.sock.get_name() + "] " + msg ) @@ -167,7 +167,7 @@ class SFTPServer(BaseSFTP, SubsystemHandler): def finish_subsystem(self): self.server.session_ended() - super(SFTPServer, self).finish_subsystem() + super().finish_subsystem() # close any file handles that were left open # (so we can return them to the OS quickly) for f in self.file_table.values(): diff --git a/paramiko/sftp_si.py b/paramiko/sftp_si.py index 95d8113e..26b0ac9b 100644 --- a/paramiko/sftp_si.py +++ b/paramiko/sftp_si.py @@ -48,7 +48,7 @@ class SFTPServerInterface: :param .ServerInterface server: the server object associated with this channel and SFTP subsystem """ - super(SFTPServerInterface, self).__init__(*largs, **kwargs) + super().__init__(*largs, **kwargs) def session_started(self): """ diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py index c7b0c249..3da49958 100644 --- a/paramiko/ssh_exception.py +++ b/paramiko/ssh_exception.py @@ -202,7 +202,7 @@ class NoValidConnectionsError(socket.error): msg = "Unable to connect to port {0} on {1} or {2}" else: msg = "Unable to connect to port {0} on {2}" - super(NoValidConnectionsError, self).__init__( + super().__init__( None, msg.format(addrs[0][1], body, tail) # stand-in for errno ) self.errors = errors diff --git a/tests/test_client.py b/tests/test_client.py index 3ff59b87..3dffa08e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -62,7 +62,7 @@ class NullServer(paramiko.ServerInterface): self.__allowed_keys = kwargs.pop("allowed_keys", []) # And allow them to set a (single...meh) expected public blob (cert) self.__expected_public_blob = kwargs.pop("public_blob", None) - super(NullServer, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def get_allowed_auths(self, username): if username == "slowdive": diff --git a/tests/test_gssapi.py b/tests/test_gssapi.py index 23c3ef42..671f1ba0 100644 --- a/tests/test_gssapi.py +++ b/tests/test_gssapi.py @@ -37,7 +37,7 @@ from .util import needs_gssapi, KerberosTestCase, update_env @needs_gssapi class GSSAPITest(KerberosTestCase): def setUp(self): - super(GSSAPITest, self).setUp() + super().setUp() # TODO: these vars should all come from os.environ or whatever the # approved pytest method is for runtime-configuring test data. self.krb5_mech = "1.2.840.113554.1.2.2" diff --git a/tests/test_transport.py b/tests/test_transport.py index 841c67f1..4d28199a 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -903,7 +903,7 @@ class TransportTest(unittest.TestCase): class SlowPacketizer(Packetizer): def read_message(self): time.sleep(1) - return super(SlowPacketizer, self).read_message() + return super().read_message() # NOTE: prettttty sure since the replaced .packetizer Packetizer is now # no longer doing anything with its copy of the socket...everything'll -- cgit v1.2.3