From 5ea4884c65ef08b4d83392b8e80bbbed8a67f949 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 4 Jun 2025 14:15:43 +0300 Subject: [PATCH] minor whitespace, variable renames --- mmgen/amt.py | 8 +++++++- mmgen/proto/rune/params.py | 8 ++++---- mmgen/proto/rune/rpc/remote.py | 8 ++++---- mmgen/util.py | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/mmgen/amt.py b/mmgen/amt.py index b7cf5682..f888d6bf 100755 --- a/mmgen/amt.py +++ b/mmgen/amt.py @@ -163,7 +163,13 @@ class CoinAmt(Decimal, Hilite, InitErrors): # abstract class def is_coin_amt(proto, num, *, from_unit=None, from_decimal=False): assert proto.coin_amt, 'proto.coin_amt is None! Did you call init_proto() with ‘need_amt’?' - return get_obj(proto.coin_amt, num=num, from_unit=from_unit, from_decimal=from_decimal, silent=True, return_bool=True) + return get_obj( + proto.coin_amt, + num = num, + from_unit = from_unit, + from_decimal = from_decimal, + silent = True, + return_bool = True) class BTCAmt(CoinAmt): coin = 'BTC' diff --git a/mmgen/proto/rune/params.py b/mmgen/proto/rune/params.py index 795705c2..134734cd 100755 --- a/mmgen/proto/rune/params.py +++ b/mmgen/proto/rune/params.py @@ -43,7 +43,7 @@ class mainnet(CoinProtocol.Secp256k1): decode_wif = btc_mainnet.decode_wif rpc_remote_params = {'server_domain': Hostname('ninerealms.com')} - rpc_remote_http_params = {'host': Hostname('thornode.ninerealms.com')} + rpc_remote_rest_params = {'host': Hostname('thornode.ninerealms.com')} rpc_remote_rpc_params = {'host': Hostname('rpc.ninerealms.com')} def decode_addr(self, addr): @@ -63,15 +63,15 @@ class mainnet(CoinProtocol.Secp256k1): class testnet(mainnet): # testnet is stagenet bech32_hrp = 'sthor' - rpc_remote_http_params = {'host': Hostname('stagenet-thornode.ninerealms.com')} + rpc_remote_rest_params = {'host': Hostname('stagenet-thornode.ninerealms.com')} rpc_remote_rpc_params = {'host': Hostname('stagenet-rpc.ninerealms.com')} class regtest(testnet): # regtest is deprecated testnet bech32_hrp = 'tthor' rpc_remote_params = { 'server_domain': Hostname('localhost')} - rpc_remote_http_params = { + rpc_remote_rest_params = { 'proto': 'http', 'host': Hostname('localhost:18800'), 'verify': False} - rpc_remote_rpc_params = rpc_remote_http_params + rpc_remote_rpc_params = rpc_remote_rest_params diff --git a/mmgen/proto/rune/rpc/remote.py b/mmgen/proto/rune/rpc/remote.py index b2018f78..87563cdb 100755 --- a/mmgen/proto/rune/rpc/remote.py +++ b/mmgen/proto/rune/rpc/remote.py @@ -17,13 +17,13 @@ import json from ....http import HTTPClient from ....rpc.remote import RemoteRPCClient -class ThornodeRemoteHTTPClient(HTTPClient): +class ThornodeRemoteRESTClient(HTTPClient): http_hdrs = {'Content-Type': 'application/json'} timeout = 5 def __init__(self, cfg, *, proto=None, host=None): - for k, v in cfg._proto.rpc_remote_http_params.items(): + for k, v in cfg._proto.rpc_remote_rest_params.items(): setattr(self, k, v) super().__init__(cfg, proto=proto, host=host) @@ -35,11 +35,11 @@ class THORChainRemoteRPCClient(RemoteRPCClient): setattr(self, k, v) super().__init__(cfg, proto) self.caps = ('lbl_id',) - self.http = ThornodeRemoteHTTPClient(cfg) + self.rest_api = ThornodeRemoteRESTClient(cfg) # throws exception on error def get_balance(self, addr, *, block): - http_res = self.http.get(path=f'/bank/balances/{addr}') + http_res = self.rest_api.get(path=f'/bank/balances/{addr}') data = json.loads(http_res) if data['result'] is None: from ....util import die diff --git a/mmgen/util.py b/mmgen/util.py index 0097c45a..56793be7 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -175,7 +175,7 @@ def Die(ev=0, s=''): def pp_fmt(d): import pprint - return pprint.PrettyPrinter(indent=4, compact=False).pformat(d) + return pprint.PrettyPrinter().pformat(d) def pp_msg(d): msg(pp_fmt(d))