minor fixes and cleanups
This commit is contained in:
parent
8de9022c63
commit
4c2df87e54
3 changed files with 3 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue