From eed168341c71a8f4790b47f7bfc146c173826a8f Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 25 Jul 2018 13:44:55 +0300 Subject: [PATCH] Don't inheric from 'object' (after deprecating Python 2.x support) --- libagent/device/interface.py | 4 ++-- libagent/device/ui.py | 2 +- libagent/gpg/agent.py | 2 +- libagent/gpg/client.py | 2 +- libagent/gpg/protocol.py | 2 +- libagent/gpg/tests/test_keyring.py | 2 +- libagent/server.py | 2 +- libagent/ssh/__init__.py | 2 +- libagent/ssh/client.py | 2 +- libagent/ssh/protocol.py | 2 +- libagent/tests/test_server.py | 4 ++-- libagent/tests/test_util.py | 2 +- libagent/util.py | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libagent/device/interface.py b/libagent/device/interface.py index 9782aa4..ede9e3d 100644 --- a/libagent/device/interface.py +++ b/libagent/device/interface.py @@ -59,7 +59,7 @@ class DeviceError(Error): """Error during device operation.""" -class Identity(object): +class Identity: """Represent SLIP-0013 identity, together with a elliptic curve choice.""" def __init__(self, identity_str, curve_name): @@ -102,7 +102,7 @@ class Identity(object): return self.curve_name -class Device(object): +class Device: """Abstract cryptographic hardware device interface.""" def __init__(self): diff --git a/libagent/device/ui.py b/libagent/device/ui.py index 1b9b985..b99d03b 100644 --- a/libagent/device/ui.py +++ b/libagent/device/ui.py @@ -9,7 +9,7 @@ from .. import util log = logging.getLogger(__name__) -class UI(object): +class UI: """UI for PIN/passphrase entry (for TREZOR devices).""" def __init__(self, device_type, config=None): diff --git a/libagent/gpg/agent.py b/libagent/gpg/agent.py index 1898a77..9ca2484 100644 --- a/libagent/gpg/agent.py +++ b/libagent/gpg/agent.py @@ -70,7 +70,7 @@ class AgentStop(Exception): # pylint: disable=too-many-instance-attributes -class Handler(object): +class Handler: """GPG agent requests' handler.""" def _get_options(self): diff --git a/libagent/gpg/client.py b/libagent/gpg/client.py index 01ef46a..8c61c79 100644 --- a/libagent/gpg/client.py +++ b/libagent/gpg/client.py @@ -15,7 +15,7 @@ def create_identity(user_id, curve_name): return result -class Client(object): +class Client: """Sign messages and get public keys from a hardware device.""" def __init__(self, device): diff --git a/libagent/gpg/protocol.py b/libagent/gpg/protocol.py index 68bb7f8..ad62f7f 100644 --- a/libagent/gpg/protocol.py +++ b/libagent/gpg/protocol.py @@ -185,7 +185,7 @@ def get_curve_name_by_oid(oid): raise KeyError('Unknown OID: {!r}'.format(oid)) -class PublicKey(object): +class PublicKey: """GPG representation for public key packets.""" def __init__(self, curve_name, created, verifying_key, ecdh=False): diff --git a/libagent/gpg/tests/test_keyring.py b/libagent/gpg/tests/test_keyring.py index edf1aa8..e83616e 100644 --- a/libagent/gpg/tests/test_keyring.py +++ b/libagent/gpg/tests/test_keyring.py @@ -41,7 +41,7 @@ def test_parse_rsa(): assert keyring.parse_sig(sig) == (0x1020304,) -class FakeSocket(object): +class FakeSocket: def __init__(self): self.rx = io.BytesIO() self.tx = io.BytesIO() diff --git a/libagent/server.py b/libagent/server.py index dc264f7..7d517fc 100644 --- a/libagent/server.py +++ b/libagent/server.py @@ -39,7 +39,7 @@ def unix_domain_socket_server(sock_path): remove_file(sock_path) -class FDServer(object): +class FDServer: """File-descriptor based server (for NeoPG).""" def __init__(self, fd): diff --git a/libagent/ssh/__init__.py b/libagent/ssh/__init__.py index dc756da..ce60a65 100644 --- a/libagent/ssh/__init__.py +++ b/libagent/ssh/__init__.py @@ -193,7 +193,7 @@ def import_public_keys(contents): yield line -class JustInTimeConnection(object): +class JustInTimeConnection: """Connect to the device just before the needed operation.""" def __init__(self, conn_factory, identities, public_keys=None): diff --git a/libagent/ssh/client.py b/libagent/ssh/client.py index 49e8185..2b47846 100644 --- a/libagent/ssh/client.py +++ b/libagent/ssh/client.py @@ -11,7 +11,7 @@ from . import formats, util log = logging.getLogger(__name__) -class Client(object): +class Client: """Client wrapper for SSH authentication device.""" def __init__(self, device): diff --git a/libagent/ssh/protocol.py b/libagent/ssh/protocol.py index f013ece..d9c4a2d 100644 --- a/libagent/ssh/protocol.py +++ b/libagent/ssh/protocol.py @@ -70,7 +70,7 @@ def _legacy_pubs(buf): return util.frame(code, num) -class Handler(object): +class Handler: """ssh-agent protocol handler.""" def __init__(self, conn, debug=False): diff --git a/libagent/tests/test_server.py b/libagent/tests/test_server.py index 33981fe..7eb5922 100644 --- a/libagent/tests/test_server.py +++ b/libagent/tests/test_server.py @@ -18,7 +18,7 @@ def test_socket(): assert not os.path.isfile(path) -class FakeSocket(object): +class FakeSocket: def __init__(self, data=b''): self.rx = io.BytesIO(data) @@ -77,7 +77,7 @@ def test_server_thread(): connections = [sock] quit_event = threading.Event() - class FakeServer(object): + class FakeServer: def accept(self): # pylint: disable=no-self-use if not connections: raise socket.timeout() diff --git a/libagent/tests/test_util.py b/libagent/tests/test_util.py index e85bc2f..e3135e8 100644 --- a/libagent/tests/test_util.py +++ b/libagent/tests/test_util.py @@ -25,7 +25,7 @@ def test_frames(): assert util.read_frame(io.BytesIO(f)) == b''.join(msgs) -class FakeSocket(object): +class FakeSocket: def __init__(self): self.buf = io.BytesIO() diff --git a/libagent/util.py b/libagent/util.py index 7df843b..0300903 100644 --- a/libagent/util.py +++ b/libagent/util.py @@ -146,7 +146,7 @@ def hexlify(blob): return binascii.hexlify(blob).decode('ascii').upper() -class Reader(object): +class Reader: """Read basic type objects out of given stream.""" def __init__(self, stream): @@ -258,7 +258,7 @@ def assuan_serialize(data): return data -class ExpiringCache(object): +class ExpiringCache: """Simple cache with a deadline.""" def __init__(self, seconds, timer=time.time):