diff options
34 files changed, 61 insertions, 61 deletions
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 <https://tools.ietf.org/html/rfc4462.html#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 <https://tools.ietf.org/html/rfc4462.html#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 diff --git a/tests/loop.py b/tests/loop.py index 51dc6308..a3740013 100644 --- a/tests/loop.py +++ b/tests/loop.py @@ -22,7 +22,7 @@ import threading from paramiko.util import asbytes -class LoopSocket(object): +class LoopSocket: """ A LoopSocket looks like a normal socket, but all data written to it is delivered on the read-end of another LoopSocket, and vice versa. It's diff --git a/tests/test_channelfile.py b/tests/test_channelfile.py index 65929416..e2b6306c 100644 --- a/tests/test_channelfile.py +++ b/tests/test_channelfile.py @@ -3,7 +3,7 @@ from unittest.mock import patch, MagicMock from paramiko import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile -class ChannelFileBase(object): +class ChannelFileBase: @patch("paramiko.channel.ChannelFile._set_mode") def test_defaults_to_unbuffered_reading(self, setmode): self.klass(Channel(None)) @@ -31,7 +31,7 @@ class TestChannelFile(ChannelFileBase): klass = ChannelFile -class TestChannelStderrFile(object): +class TestChannelStderrFile: def test_read_calls_channel_recv_stderr(self): chan = MagicMock() cf = ChannelStderrFile(chan) diff --git a/tests/test_config.py b/tests/test_config.py index 67a03e63..2fd875e8 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -52,7 +52,7 @@ def load_config(name): return SSHConfig.from_path(_config(name)) -class TestSSHConfig(object): +class TestSSHConfig: def setup(self): self.config = load_config("robey") @@ -511,7 +511,7 @@ Host * assert result["hostname"] == "prefix.whatever" -class TestSSHConfigDict(object): +class TestSSHConfigDict: def test_SSHConfigDict_construct_empty(self): assert not SSHConfigDict() @@ -570,7 +570,7 @@ Host * assert config.lookup("anything-else").as_int("port") == 3333 -class TestHostnameCanonicalization(object): +class TestHostnameCanonicalization: # NOTE: this class uses on-disk configs, and ones with real (at time of # writing) DNS names, so that one can easily test OpenSSH's behavior using # "ssh -F path/to/file.config -G <target>". @@ -669,7 +669,7 @@ class TestHostnameCanonicalization(object): @mark.skip -class TestCanonicalizationOfCNAMEs(object): +class TestCanonicalizationOfCNAMEs: def test_permitted_cnames_may_be_one_to_one_mapping(self): # CanonicalizePermittedCNAMEs *.foo.com:*.bar.com pass @@ -695,7 +695,7 @@ class TestCanonicalizationOfCNAMEs(object): pass -class TestMatchAll(object): +class TestMatchAll: def test_always_matches(self): result = load_config("match-all").lookup("general") assert result["user"] == "awesome" @@ -745,7 +745,7 @@ def _expect(success_on): @mark.skipif(Result is None, reason="requires invoke package") -class TestMatchExec(object): +class TestMatchExec: @patch("paramiko.config.invoke", new=None) @patch("paramiko.config.invoke_import_error", new=ImportError("meh")) def test_raises_invoke_ImportErrors_at_runtime(self): @@ -825,7 +825,7 @@ class TestMatchExec(object): assert result["hostname"] == "pingable.target" -class TestMatchHost(object): +class TestMatchHost: def test_matches_target_name_when_no_hostname(self): result = load_config("match-host").lookup("target") assert result["user"] == "rand" @@ -875,7 +875,7 @@ class TestMatchHost(object): load_config("match-host-no-arg") -class TestMatchOriginalHost(object): +class TestMatchOriginalHost: def test_matches_target_host_not_hostname(self): result = load_config("match-orighost").lookup("target") assert result["hostname"] == "bogus" @@ -908,7 +908,7 @@ class TestMatchOriginalHost(object): load_config("match-orighost-no-arg") -class TestMatchUser(object): +class TestMatchUser: def test_matches_configured_username(self): result = load_config("match-user-explicit").lookup("anything") assert result["hostname"] == "dumb" @@ -955,7 +955,7 @@ class TestMatchUser(object): # NOTE: highly derivative of previous suite due to the former's use of # localuser fallback. Doesn't seem worth conflating/refactoring right now. -class TestMatchLocalUser(object): +class TestMatchLocalUser: @patch("paramiko.config.getpass.getuser") def test_matches_local_username(self, getuser): getuser.return_value = "gandalf" @@ -996,7 +996,7 @@ class TestMatchLocalUser(object): load_config("match-localuser-no-arg") -class TestComplexMatching(object): +class TestComplexMatching: # NOTE: this is still a cherry-pick of a few levels of complexity, there's # no point testing literally all possible combinations. diff --git a/tests/test_kex.py b/tests/test_kex.py index 45a691f2..c3bf2b0f 100644 --- a/tests/test_kex.py +++ b/tests/test_kex.py @@ -69,7 +69,7 @@ def dummy_generate_key_pair(obj): ) -class FakeKey(object): +class FakeKey: def __str__(self): return "fake-key" @@ -80,7 +80,7 @@ class FakeKey(object): return b"fake-sig" -class FakeModulusPack(object): +class FakeModulusPack: P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF # noqa G = 2 @@ -88,7 +88,7 @@ class FakeModulusPack(object): return self.G, self.P -class FakeTransport(object): +class FakeTransport: local_version = "SSH-2.0-paramiko_1.0" remote_version = "SSH-2.0-lame" local_kex_init = "local-kex-init" diff --git a/tests/test_proxy.py b/tests/test_proxy.py index d50cc562..83bdc040 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -7,7 +7,7 @@ from pytest import raises from paramiko import ProxyCommand, ProxyCommandFailure -class TestProxyCommand(object): +class TestProxyCommand: @patch("paramiko.proxy.subprocess") def test_init_takes_command_string(self, subprocess): ProxyCommand(command_line="do a thing") diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 5767c00b..2cd68d94 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -93,7 +93,7 @@ utf8_folder = b"/\xc3\xbcnic\xc3\xb8\x64\x65" @slow -class TestSFTP(object): +class TestSFTP: def test_file(self, sftp): """ verify that we can create a file. diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py index d2d30f24..5f55a6fc 100644 --- a/tests/test_sftp_big.py +++ b/tests/test_sftp_big.py @@ -34,7 +34,7 @@ from .util import slow @slow -class TestBigSFTP(object): +class TestBigSFTP: def test_lots_of_files(self, sftp): """ create a bunch of files over the same session. diff --git a/tests/util.py b/tests/util.py index 79ce2c61..0639f8ae 100644 --- a/tests/util.py +++ b/tests/util.py @@ -61,7 +61,7 @@ if ( ): # add other vars as needed # The environment provides the required information - class DummyK5Realm(object): + class DummyK5Realm: def __init__(self): for k in os.environ: if not k.startswith("K5TEST_"): |