From aa86fb19acd22e78e178f94b60df9b88e566d976 Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Wed, 12 Sep 2018 16:44:20 +0200 Subject: [PATCH] xmr: py3 only inheritance --- src/apps/monero/__init__.py | 2 +- src/apps/monero/controller/iface.py | 2 +- src/apps/monero/controller/misc.py | 2 +- src/apps/monero/protocol/key_image_sync.py | 2 +- src/apps/monero/protocol/tsx_sign_builder.py | 4 ++-- src/apps/monero/protocol/tsx_sign_state.py | 2 +- src/apps/monero/protocol/tsx_sign_state_holder.py | 2 +- src/apps/monero/protocol_lite/lite.py | 2 +- src/apps/monero/xmr/bulletproof.py | 6 +++--- src/apps/monero/xmr/serialize/xmrserialize.py | 2 +- src/apps/monero/xmr/serialize_messages/tx_rsig.py | 2 +- src/apps/monero/xmr/sub/creds.py | 2 +- src/apps/monero/xmr/sub/keccak_hasher.py | 4 ++-- src/apps/monero/xmr/sub/mlsag_hasher.py | 2 +- src/apps/monero/xmr/sub/xmr_net.py | 8 ++++---- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/apps/monero/__init__.py b/src/apps/monero/__init__.py index 41489f00b..1e6c85c78 100644 --- a/src/apps/monero/__init__.py +++ b/src/apps/monero/__init__.py @@ -3,7 +3,7 @@ # persistent state objects -class Holder(object): +class Holder: def __init__(self): self.ctx_sign = None self.ctx_ki = None diff --git a/src/apps/monero/controller/iface.py b/src/apps/monero/controller/iface.py index 222c60d3b..10fb39c48 100644 --- a/src/apps/monero/controller/iface.py +++ b/src/apps/monero/controller/iface.py @@ -1,4 +1,4 @@ -class TrezorInterface(object): +class TrezorInterface: def __init__(self, ctx=None): self.ctx = ctx diff --git a/src/apps/monero/controller/misc.py b/src/apps/monero/controller/misc.py index 4b96ac43c..830384655 100644 --- a/src/apps/monero/controller/misc.py +++ b/src/apps/monero/controller/misc.py @@ -17,7 +17,7 @@ class TrezorChangeAddressError(TrezorError): pass -class StdObj(object): +class StdObj: def __init__(self, **kwargs): for kw in kwargs: setattr(self, kw, kwargs[kw]) diff --git a/src/apps/monero/protocol/key_image_sync.py b/src/apps/monero/protocol/key_image_sync.py index 37504449a..1ce8e82cc 100644 --- a/src/apps/monero/protocol/key_image_sync.py +++ b/src/apps/monero/protocol/key_image_sync.py @@ -3,7 +3,7 @@ from apps.monero.controller import wrapper as twrap -class KeyImageSync(object): +class KeyImageSync: def __init__(self, ctx=None, iface=None, creds=None): from apps.monero.xmr import crypto from apps.monero.xmr.sub.keccak_hasher import HashWrapper diff --git a/src/apps/monero/protocol/tsx_sign_builder.py b/src/apps/monero/protocol/tsx_sign_builder.py index d34c22f57..063e29b0c 100644 --- a/src/apps/monero/protocol/tsx_sign_builder.py +++ b/src/apps/monero/protocol/tsx_sign_builder.py @@ -7,7 +7,7 @@ from apps.monero.xmr import common, crypto, monero -class TprefixStub(object): +class TprefixStub: __slots__ = ("version", "unlock_time", "vin", "vout", "extra") def __init__(self, **kwargs): @@ -15,7 +15,7 @@ def __init__(self, **kwargs): setattr(self, kw, kwargs[kw]) -class TTransactionBuilder(object): +class TTransactionBuilder: """ Transaction builder """ diff --git a/src/apps/monero/protocol/tsx_sign_state.py b/src/apps/monero/protocol/tsx_sign_state.py index c2ea166f6..abcef2f9f 100644 --- a/src/apps/monero/protocol/tsx_sign_state.py +++ b/src/apps/monero/protocol/tsx_sign_state.py @@ -1,7 +1,7 @@ from micropython import const -class TState(object): +class TState: """ Transaction state """ diff --git a/src/apps/monero/protocol/tsx_sign_state_holder.py b/src/apps/monero/protocol/tsx_sign_state_holder.py index 31930d7cc..b17fda1eb 100644 --- a/src/apps/monero/protocol/tsx_sign_state_holder.py +++ b/src/apps/monero/protocol/tsx_sign_state_holder.py @@ -1,4 +1,4 @@ -class TsxSignStateHolder(object): +class TsxSignStateHolder: """ Simple transaction signer state holder. Externalized state uses smaller amount of memory compared to storing the builder instance in the state. diff --git a/src/apps/monero/protocol_lite/lite.py b/src/apps/monero/protocol_lite/lite.py index 9a264fbd8..1d2ee0792 100644 --- a/src/apps/monero/protocol_lite/lite.py +++ b/src/apps/monero/protocol_lite/lite.py @@ -20,7 +20,7 @@ def memcpy(dst, dst_off, src, src_off, ln): return dst -class LiteProtocol(object): +class LiteProtocol: """ Lite protocol """ diff --git a/src/apps/monero/xmr/bulletproof.py b/src/apps/monero/xmr/bulletproof.py index 22d61a25e..2fb50843b 100644 --- a/src/apps/monero/xmr/bulletproof.py +++ b/src/apps/monero/xmr/bulletproof.py @@ -256,7 +256,7 @@ def get_exponent(dst, base, idx): # -class KeyVBase(object): +class KeyVBase: """ Base KeyVector object """ @@ -786,7 +786,7 @@ def is_reduced(sc): return crypto.encodeint(crypto.decodeint(sc)) == sc -class MultiExpSequential(object): +class MultiExpSequential: """ MultiExp object similar to MultiExp array of [(scalar, point), ] MultiExp computes simply: res = \sum_i scalar_i * point_i @@ -840,7 +840,7 @@ def multiexp(dst=None, data=None, GiHi=False): return data.eval(dst, GiHi) -class BulletProofBuilder(object): +class BulletProofBuilder: def __init__(self): self.use_det_masks = True self.proof_sec = None diff --git a/src/apps/monero/xmr/serialize/xmrserialize.py b/src/apps/monero/xmr/serialize/xmrserialize.py index 590ba0922..57b368e43 100644 --- a/src/apps/monero/xmr/serialize/xmrserialize.py +++ b/src/apps/monero/xmr/serialize/xmrserialize.py @@ -63,7 +63,7 @@ def import_def(module, name): return r -class Archive(object): +class Archive: """ Archive object for object binary serialization / deserialization. Resembles Archive API from the Monero codebase or Boost serialization archive. diff --git a/src/apps/monero/xmr/serialize_messages/tx_rsig.py b/src/apps/monero/xmr/serialize_messages/tx_rsig.py index c1c8c0944..ca6eff911 100644 --- a/src/apps/monero/xmr/serialize_messages/tx_rsig.py +++ b/src/apps/monero/xmr/serialize_messages/tx_rsig.py @@ -1,4 +1,4 @@ -class RctType(object): +class RctType: Null = 0 Full = 1 Simple = 2 diff --git a/src/apps/monero/xmr/sub/creds.py b/src/apps/monero/xmr/sub/creds.py index 84336c602..77159d91f 100644 --- a/src/apps/monero/xmr/sub/creds.py +++ b/src/apps/monero/xmr/sub/creds.py @@ -3,7 +3,7 @@ from apps.monero.xmr.sub.xmr_net import NetworkTypes, net_version -class AccountCreds(object): +class AccountCreds: """ Stores account private keys """ diff --git a/src/apps/monero/xmr/sub/keccak_hasher.py b/src/apps/monero/xmr/sub/keccak_hasher.py index eb9165697..a0a2e90bf 100644 --- a/src/apps/monero/xmr/sub/keccak_hasher.py +++ b/src/apps/monero/xmr/sub/keccak_hasher.py @@ -1,7 +1,7 @@ from apps.monero.xmr import crypto -class KeccakXmrArchive(object): +class KeccakXmrArchive: def __init__(self, ctx=None): self.kwriter = get_keccak_writer(ctx=ctx) self.ar = None @@ -51,7 +51,7 @@ async def container_size( return await ar.container_size(container_len, container_type, params) -class HashWrapper(object): +class HashWrapper: def __init__(self, ctx): self.ctx = ctx diff --git a/src/apps/monero/xmr/sub/mlsag_hasher.py b/src/apps/monero/xmr/sub/mlsag_hasher.py index 99251f0c1..eeb8a8db7 100644 --- a/src/apps/monero/xmr/sub/mlsag_hasher.py +++ b/src/apps/monero/xmr/sub/mlsag_hasher.py @@ -1,7 +1,7 @@ from apps.monero.xmr import crypto -class PreMlsagHasher(object): +class PreMlsagHasher: """ Iterative construction of the pre_mlsag_hash """ diff --git a/src/apps/monero/xmr/sub/xmr_net.py b/src/apps/monero/xmr/sub/xmr_net.py index b3d572b81..e9f5faefa 100644 --- a/src/apps/monero/xmr/sub/xmr_net.py +++ b/src/apps/monero/xmr/sub/xmr_net.py @@ -1,23 +1,23 @@ -class NetworkTypes(object): +class NetworkTypes: MAINNET = 0 TESTNET = 1 STAGENET = 2 FAKECHAIN = 3 -class MainNet(object): +class MainNet: PUBLIC_ADDRESS_BASE58_PREFIX = 18 PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 19 PUBLIC_SUBADDRESS_BASE58_PREFIX = 42 -class TestNet(object): +class TestNet: PUBLIC_ADDRESS_BASE58_PREFIX = 53 PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 54 PUBLIC_SUBADDRESS_BASE58_PREFIX = 63 -class StageNet(object): +class StageNet: PUBLIC_ADDRESS_BASE58_PREFIX = 24 PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 25 PUBLIC_SUBADDRESS_BASE58_PREFIX = 36