From 8d52c334b8b99eb96094edb1b513b26f864eeabd Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Mon, 16 Jan 2023 19:40:31 -0500 Subject: No more (object)ions --- paramiko/_winapi.py | 2 +- paramiko/agent.py | 6 +++--- paramiko/auth_handler.py | 4 ++-- paramiko/ber.py | 2 +- paramiko/buffered_pipe.py | 2 +- paramiko/client.py | 2 +- paramiko/compress.py | 4 ++-- paramiko/config.py | 4 ++-- paramiko/ecdsakey.py | 4 ++-- paramiko/kex_curve25519.py | 2 +- paramiko/kex_gex.py | 2 +- paramiko/kex_group1.py | 2 +- paramiko/kex_gss.py | 6 +++--- paramiko/message.py | 2 +- paramiko/packet.py | 2 +- paramiko/pipe.py | 6 +++--- paramiko/pkey.py | 4 ++-- paramiko/primes.py | 2 +- paramiko/server.py | 4 ++-- paramiko/sftp.py | 2 +- paramiko/sftp_attr.py | 2 +- paramiko/sftp_si.py | 2 +- paramiko/ssh_gss.py | 2 +- paramiko/transport.py | 4 ++-- paramiko/util.py | 4 ++-- paramiko/win_pageant.py | 2 +- 26 files changed, 40 insertions(+), 40 deletions(-) (limited to 'paramiko') diff --git a/paramiko/_winapi.py b/paramiko/_winapi.py index 96284b69..37cbb9c9 100644 --- a/paramiko/_winapi.py +++ b/paramiko/_winapi.py @@ -130,7 +130,7 @@ ctypes.windll.kernel32.LocalFree.argtypes = (ctypes.wintypes.HLOCAL,) # jaraco.windows.mmap -class MemoryMap(object): +class MemoryMap: """ A memory map object which can have security attributes overridden. """ diff --git a/paramiko/agent.py b/paramiko/agent.py index 31a16e2e..f2d57ea5 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -54,7 +54,7 @@ ALGORITHM_FLAG_MAP = { } -class AgentSSH(object): +class AgentSSH: def __init__(self): self._conn = None self._keys = () @@ -232,7 +232,7 @@ def get_agent_connection(): return -class AgentClientProxy(object): +class AgentClientProxy: """ Class proxying request as a client: @@ -325,7 +325,7 @@ class AgentServerProxy(AgentSSH): return self._file -class AgentRequestHandler(object): +class AgentRequestHandler: """ Primary/default implementation of SSH agent forwarding functionality. diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py index 18c83293..02ab810c 100644 --- a/paramiko/auth_handler.py +++ b/paramiko/auth_handler.py @@ -73,7 +73,7 @@ from paramiko.server import InteractiveQuery from paramiko.ssh_gss import GSSAuth, GSS_EXCEPTIONS -class AuthHandler(object): +class AuthHandler: """ Internal class to handle the mechanics of authentication. """ @@ -839,7 +839,7 @@ Error Message: {} return self._client_handler_table -class GssapiWithMicAuthHandler(object): +class GssapiWithMicAuthHandler: """A specialized Auth handler for gssapi-with-mic During the GSSAPI token exchange we need a modified dispatch table, diff --git a/paramiko/ber.py b/paramiko/ber.py index ce6d7007..b8287f5d 100644 --- a/paramiko/ber.py +++ b/paramiko/ber.py @@ -26,7 +26,7 @@ class BERException(Exception): pass -class BER(object): +class BER: """ Robey's tiny little attempt at a BER decoder. """ diff --git a/paramiko/buffered_pipe.py b/paramiko/buffered_pipe.py index 79854ada..c19279c0 100644 --- a/paramiko/buffered_pipe.py +++ b/paramiko/buffered_pipe.py @@ -36,7 +36,7 @@ class PipeTimeout(IOError): pass -class BufferedPipe(object): +class BufferedPipe: """ A buffer that obeys normal read (with timeout) & close semantics for a file or socket, but is fed data from another thread. This is used by diff --git a/paramiko/client.py b/paramiko/client.py index 73909219..2dd25e91 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -784,7 +784,7 @@ class SSHClient(ClosingContextManager): self._transport._log(level, msg) -class MissingHostKeyPolicy(object): +class MissingHostKeyPolicy: """ Interface for defining the policy that `.SSHClient` should use when the SSH server's hostname is not in either the system host keys or the diff --git a/paramiko/compress.py b/paramiko/compress.py index 7fe26db1..18ff4843 100644 --- a/paramiko/compress.py +++ b/paramiko/compress.py @@ -23,7 +23,7 @@ Compression implementations for a Transport. import zlib -class ZlibCompressor(object): +class ZlibCompressor: def __init__(self): # Use the default level of zlib compression self.z = zlib.compressobj() @@ -32,7 +32,7 @@ class ZlibCompressor(object): return self.z.compress(data) + self.z.flush(zlib.Z_FULL_FLUSH) -class ZlibDecompressor(object): +class ZlibDecompressor: def __init__(self): self.z = zlib.decompressobj() diff --git a/paramiko/config.py b/paramiko/config.py index d523e9c2..09be9fcb 100644 --- a/paramiko/config.py +++ b/paramiko/config.py @@ -43,7 +43,7 @@ from .ssh_exception import CouldNotCanonicalize, ConfigParseError SSH_PORT = 22 -class SSHConfig(object): +class SSHConfig: """ Representation of config information as stored in the format used by OpenSSH. Queries can be made via `lookup`. The format is described in @@ -584,7 +584,7 @@ def _addressfamily_host_lookup(hostname, options): pass -class LazyFqdn(object): +class LazyFqdn: """ Returns the host's fqdn on request as string. """ diff --git a/paramiko/ecdsakey.py b/paramiko/ecdsakey.py index ad84fe31..e2279754 100644 --- a/paramiko/ecdsakey.py +++ b/paramiko/ecdsakey.py @@ -36,7 +36,7 @@ from paramiko.ssh_exception import SSHException from paramiko.util import deflate_long -class _ECDSACurve(object): +class _ECDSACurve: """ Represents a specific ECDSA Curve (nistp256, nistp384, etc). @@ -63,7 +63,7 @@ class _ECDSACurve(object): self.curve_class = curve_class -class _ECDSACurveSet(object): +class _ECDSACurveSet: """ A collection to hold the ECDSA curves. Allows querying by oid and by key format identifier. The two ways in which ECDSAKey needs to be able to look diff --git a/paramiko/kex_curve25519.py b/paramiko/kex_curve25519.py index bb1b5423..20c23e42 100644 --- a/paramiko/kex_curve25519.py +++ b/paramiko/kex_curve25519.py @@ -17,7 +17,7 @@ _MSG_KEXECDH_INIT, _MSG_KEXECDH_REPLY = range(30, 32) c_MSG_KEXECDH_INIT, c_MSG_KEXECDH_REPLY = [byte_chr(c) for c in range(30, 32)] -class KexCurve25519(object): +class KexCurve25519: hash_algo = hashlib.sha256 def __init__(self, transport): diff --git a/paramiko/kex_gex.py b/paramiko/kex_gex.py index aa68efa5..baa0803d 100644 --- a/paramiko/kex_gex.py +++ b/paramiko/kex_gex.py @@ -48,7 +48,7 @@ from paramiko.ssh_exception import SSHException ) = [byte_chr(c) for c in range(30, 35)] -class KexGex(object): +class KexGex: name = "diffie-hellman-group-exchange-sha1" min_bits = 1024 diff --git a/paramiko/kex_group1.py b/paramiko/kex_group1.py index f4ac4944..f0742566 100644 --- a/paramiko/kex_group1.py +++ b/paramiko/kex_group1.py @@ -37,7 +37,7 @@ b7fffffffffffffff = byte_chr(0x7F) + max_byte * 7 b0000000000000000 = zero_byte * 8 -class KexGroup1(object): +class KexGroup1: # draft-ietf-secsh-transport-09.txt, page 17 P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF # noqa diff --git a/paramiko/kex_gss.py b/paramiko/kex_gss.py index a826cc0a..e3fbb36e 100644 --- a/paramiko/kex_gss.py +++ b/paramiko/kex_gss.py @@ -73,7 +73,7 @@ from paramiko.ssh_exception import SSHException ] -class KexGSSGroup1(object): +class KexGSSGroup1: """ GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange as defined in `RFC 4462 Section 2 `_ @@ -333,7 +333,7 @@ class KexGSSGroup14(KexGSSGroup1): NAME = "gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==" -class KexGSSGex(object): +class KexGSSGex: """ GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange as defined in `RFC 4462 Section 2 `_ @@ -669,7 +669,7 @@ Error Message: {} ) -class NullHostKey(object): +class NullHostKey: """ This class represents the Null Host Key for GSS-API Key Exchange as defined in `RFC 4462 Section 5 diff --git a/paramiko/message.py b/paramiko/message.py index cdefe4f8..8c2b3bd0 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -28,7 +28,7 @@ from paramiko.common import zero_byte, max_byte, one_byte from paramiko.util import u -class Message(object): +class Message: """ An SSH2 message is a stream of bytes that encodes some combination of strings, integers, bools, and infinite-precision integers. This class diff --git a/paramiko/packet.py b/paramiko/packet.py index a8db2582..9125301e 100644 --- a/paramiko/packet.py +++ b/paramiko/packet.py @@ -62,7 +62,7 @@ def first_arg(e): return arg -class Packetizer(object): +class Packetizer: """ Implementation of the base SSH packet protocol. """ diff --git a/paramiko/pipe.py b/paramiko/pipe.py index 3905949d..65944fad 100644 --- a/paramiko/pipe.py +++ b/paramiko/pipe.py @@ -38,7 +38,7 @@ def make_pipe(): return p -class PosixPipe(object): +class PosixPipe: def __init__(self): self._rfd, self._wfd = os.pipe() self._set = False @@ -71,7 +71,7 @@ class PosixPipe(object): self.set() -class WindowsPipe(object): +class WindowsPipe: """ On Windows, only an OS-level "WinSock" may be used in select(), but reads and writes must be to the actual socket object. @@ -118,7 +118,7 @@ class WindowsPipe(object): self.set() -class OrPipe(object): +class OrPipe: def __init__(self, pipe): self._set = False self._partner = None diff --git a/paramiko/pkey.py b/paramiko/pkey.py index 2d189d9a..dd4b4315 100644 --- a/paramiko/pkey.py +++ b/paramiko/pkey.py @@ -59,7 +59,7 @@ def _unpad_openssh(data): return data[:-padding_length] -class PKey(object): +class PKey: """ Base class for public keys. """ @@ -655,7 +655,7 @@ class PKey(object): # Of little value in the case of standard public keys # {ssh-rsa, ssh-dss, ssh-ecdsa, ssh-ed25519}, but should # provide rudimentary support for {*-cert.v01} -class PublicBlob(object): +class PublicBlob: """ OpenSSH plain public key or OpenSSH signed public key (certificate). diff --git a/paramiko/primes.py b/paramiko/primes.py index 388029c9..663c58ed 100644 --- a/paramiko/primes.py +++ b/paramiko/primes.py @@ -49,7 +49,7 @@ def _roll_random(n): return num -class ModulusPack(object): +class ModulusPack: """ convenience object for holding the contents of the /etc/ssh/moduli file, on systems that have such a file. diff --git a/paramiko/server.py b/paramiko/server.py index 68f5ae92..b68607e1 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -31,7 +31,7 @@ from paramiko.common import ( ) -class ServerInterface(object): +class ServerInterface: """ This class defines an interface for controlling the behavior of Paramiko in server mode. @@ -593,7 +593,7 @@ class ServerInterface(object): return (None, None) -class InteractiveQuery(object): +class InteractiveQuery: """ A query (set of prompts) for a user during interactive authentication. """ diff --git a/paramiko/sftp.py b/paramiko/sftp.py index c557d282..2ce8c477 100644 --- a/paramiko/sftp.py +++ b/paramiko/sftp.py @@ -130,7 +130,7 @@ class SFTPError(Exception): pass -class BaseSFTP(object): +class BaseSFTP: def __init__(self): self.logger = util.get_logger("paramiko.sftp") self.sock = None diff --git a/paramiko/sftp_attr.py b/paramiko/sftp_attr.py index 51c26e88..a8d3ecf1 100644 --- a/paramiko/sftp_attr.py +++ b/paramiko/sftp_attr.py @@ -21,7 +21,7 @@ import time from paramiko.common import x80000000, o700, o70, xffffffff -class SFTPAttributes(object): +class SFTPAttributes: """ Representation of the attributes of a file (or proxied file) for SFTP in client or server mode. It attemps to mirror the object returned by diff --git a/paramiko/sftp_si.py b/paramiko/sftp_si.py index 3199310a..95d8113e 100644 --- a/paramiko/sftp_si.py +++ b/paramiko/sftp_si.py @@ -25,7 +25,7 @@ import sys from paramiko.sftp import SFTP_OP_UNSUPPORTED -class SFTPServerInterface(object): +class SFTPServerInterface: """ This class defines an interface for controlling the behavior of paramiko when using the `.SFTPServer` subsystem to provide an SFTP server. diff --git a/paramiko/ssh_gss.py b/paramiko/ssh_gss.py index 4f1581c3..ee49c34d 100644 --- a/paramiko/ssh_gss.py +++ b/paramiko/ssh_gss.py @@ -107,7 +107,7 @@ def GSSAuth(auth_method, gss_deleg_creds=True): raise ImportError("Unable to import a GSS-API / SSPI module!") -class _SSH_GSSAuth(object): +class _SSH_GSSAuth: """ Contains the shared variables and methods of `._SSH_GSSAPI_OLD`, `._SSH_GSSAPI_NEW` and `._SSH_SSPI`. diff --git a/paramiko/transport.py b/paramiko/transport.py index 6097fc29..247cc1a0 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -3007,7 +3007,7 @@ class Transport(threading.Thread, ClosingContextManager): # TODO 3.0: drop this, we barely use it ourselves, it badly replicates the # Transport-internal algorithm management, AND does so in a way which doesn't # honor newer things like disabled_algorithms! -class SecurityOptions(object): +class SecurityOptions: """ Simple object containing the security preferences of an ssh transport. These are tuples of acceptable ciphers, digests, key types, and key @@ -3088,7 +3088,7 @@ class SecurityOptions(object): self._set("_preferred_compression", "_compression_info", x) -class ChannelMap(object): +class ChannelMap: def __init__(self): # (id -> Channel) self._map = weakref.WeakValueDictionary() diff --git a/paramiko/util.py b/paramiko/util.py index 9d9b0064..f6125eb1 100644 --- a/paramiko/util.py +++ b/paramiko/util.py @@ -258,7 +258,7 @@ def log_to_file(filename, level=DEBUG): # make only one filter object, so it doesn't get applied more than once -class PFilter(object): +class PFilter: def filter(self, record): record._threadid = get_thread_id() return True @@ -293,7 +293,7 @@ def constant_time_bytes_eq(a, b): return res == 0 -class ClosingContextManager(object): +class ClosingContextManager: def __enter__(self): return self diff --git a/paramiko/win_pageant.py b/paramiko/win_pageant.py index 5a085939..c927de65 100644 --- a/paramiko/win_pageant.py +++ b/paramiko/win_pageant.py @@ -111,7 +111,7 @@ def _query_pageant(msg): return None -class PageantConnection(object): +class PageantConnection: """ Mock "connection" to an agent which roughly approximates the behavior of a unix local-domain socket (as used by Agent). Requests are sent to the -- cgit v1.2.1