minor fixes and cleanups

This commit is contained in:
The MMGen Project 2025-09-26 10:40:23 +00:00
commit 4c2df87e54
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 3 additions and 6 deletions

View file

@ -113,10 +113,7 @@ class GlobalConstants(Lockable):
# https://importlib-resources.readthedocs.io/en/latest/migration.html
# https://setuptools.readthedocs.io/en/latest/pkg_resources.html
try:
from importlib.resources import files # Python 3.9 and above
except ImportError:
from importlib_resources import files
from importlib.resources import files
return files(package).joinpath('data', filename).read_text()
@property

View file

@ -40,7 +40,7 @@ class Crypto:
mmenc_nonce_len = 32
# Scrypt params: 'id_num': [N, r, p] (N is an exponent of two)
# NB: hashlib.scrypt in Python (>=v3.6) supports max N value of 14. This means that
# NB: scrypt() in Python hashlib supports max N value of 14. This means that
# for hash presets > 3 the standalone scrypt library must be used!
_hp = namedtuple('scrypt_preset', ['N', 'r', 'p'])
hash_presets = {

View file

@ -21,7 +21,7 @@ def test_to_unit(data):
for proto, amt, unit, chk in data:
amt = protos[proto].coin_amt(amt)
res = amt.to_unit(unit)
vmsg(f' {proto.upper()} {amt.fmt(8)} => {res:<14} {unit}')
vmsg(f' {proto.upper()} {amt.fmt(4):<24} => {res:<21} {unit}')
if '.' in chk:
assert res == Decimal(chk), f'{res} != {Decimal(chk)}'
else: