chore: bump black to 22.3

changes:
* exponent operator ** now allows no spaces around itself: https://github.com/psf/black/issues/538
* optional unicode marker u"" is no longer allowed

[no changelog]
pull/2352/head
matejcik 2 years ago
parent 01257abacd
commit 8c3d3c6548

@ -39,7 +39,7 @@ def round_sats(sats, precision=1):
def compute_maxfee(maxcost, price, txsize):
coins_per_tx = maxcost / price
sats_per_tx = coins_per_tx * 10 ** 8
sats_per_tx = coins_per_tx * 10**8
tx_per_kb = 1024.0 / txsize
sats_per_kb = sats_per_tx * tx_per_kb
return int(sats_per_kb)

@ -50,13 +50,13 @@ _CBOR_RAW_TAG = const(0x18)
def _header(typ: int, l: int) -> bytes:
if l < 24:
return struct.pack(">B", typ + l)
elif l < 2 ** 8:
elif l < 2**8:
return struct.pack(">BB", typ + 24, l)
elif l < 2 ** 16:
elif l < 2**16:
return struct.pack(">BH", typ + 25, l)
elif l < 2 ** 32:
elif l < 2**32:
return struct.pack(">BI", typ + 26, l)
elif l < 2 ** 64:
elif l < 2**64:
return struct.pack(">BQ", typ + 27, l)
else:
raise NotImplementedError # Length not supported

@ -24,7 +24,7 @@ def _byte_size(x: int) -> int:
if x < 0:
raise ValueError # only unsigned ints are supported
for exp in range(64):
if x < 0x100 ** exp:
if x < 0x100**exp:
return exp
raise ValueError # int is too large

@ -79,8 +79,8 @@ def int_to_bignum(number, limbs_number=limbs_number):
bn = (limbs_number * limb_type)()
for i in range(limbs_number):
bn[i] = number % 2 ** bits_per_limb
number //= 2 ** bits_per_limb
bn[i] = number % 2**bits_per_limb
number //= 2**bits_per_limb
return bn
@ -89,7 +89,7 @@ def bignum_to_int(bignum, limbs_number=limbs_number):
number = 0
for i in reversed(range(limbs_number)):
number *= 2 ** bits_per_limb
number *= 2**bits_per_limb
number += bignum[i]
return number
@ -109,7 +109,7 @@ def integer_to_raw_number(number, endianess):
def bignum_is_normalised(bignum):
for limb in bignum:
if limb > 2 ** bits_per_limb:
if limb > 2**bits_per_limb:
return False
return True
@ -127,20 +127,20 @@ class Random(random.Random):
return self.randrange(0, 2 ** (limbs_number * bits_per_limb))
def rand_int_256(self):
return self.randrange(0, 2 ** 256)
return self.randrange(0, 2**256)
def rand_int_reduced(self, p):
return self.randrange(0, 2 * p)
def rand_int_bitsize(self, bitsize):
return self.randrange(0, 2 ** bitsize)
return self.randrange(0, 2**bitsize)
def rand_bit_index(self):
return self.randrange(0, limbs_number * bits_per_limb)
def rand_bignum(self, limbs_number=limbs_number):
return (limb_type * limbs_number)(
*[self.randrange(0, 256 ** 4) for _ in range(limbs_number)]
*[self.randrange(0, 256**4) for _ in range(limbs_number)]
)
@ -446,13 +446,13 @@ def assert_bn_sqrt(x_old, prime):
assert bignum_is_normalised(bn_x)
assert number_is_fully_reduced(x_new, prime)
assert x_new ** 2 % prime == x_old % prime
assert x_new**2 % prime == x_old % prime
def assert_inverse_mod_power_two(x, m):
return_value = lib.inverse_mod_power_two(c_uint32(x), c_uint32(m))
assert return_value * x % 2 ** m == 1
assert return_value * x % 2**m == 1
def assert_bn_divide_base(x_old, prime):
@ -467,7 +467,7 @@ def assert_bn_divide_base(x_old, prime):
assert implication(
number_is_partly_reduced(x_old, prime), number_is_partly_reduced(x_new, prime)
)
assert x_new * 2 ** bits_per_limb % prime == x_old % prime
assert x_new * 2**bits_per_limb % prime == x_old % prime
def assert_bn_inverse(x_old, prime):
@ -610,7 +610,7 @@ def assert_bn_divmod10(x_old):
def assert_bn_format(x, prefix, suffix, decimals, exponent, trailing):
def format(amount, prefix, suffix, decimals, exponent, trailing):
if exponent >= 0:
amount *= 10 ** exponent
amount *= 10**exponent
else:
amount //= 10 ** (-exponent)
@ -684,8 +684,8 @@ def test_bn_bitcount_1(r):
def test_bn_bitcount_2(bignum_bit_index):
assert_bn_bitcount(2 ** bignum_bit_index - 1)
assert_bn_bitcount(2 ** bignum_bit_index)
assert_bn_bitcount(2**bignum_bit_index - 1)
assert_bn_bitcount(2**bignum_bit_index)
def test_bn_digitcount_1(r):
@ -693,8 +693,8 @@ def test_bn_digitcount_1(r):
def test_bn_digitcount_2(bignum_decimal_digit_index):
assert_bn_digitcount(10 ** bignum_decimal_digit_index - 1)
assert_bn_digitcount(10 ** bignum_decimal_digit_index)
assert_bn_digitcount(10**bignum_decimal_digit_index - 1)
assert_bn_digitcount(10**bignum_decimal_digit_index)
def test_bn_zero():
@ -711,7 +711,7 @@ def test_bn_is_zero_1():
def test_bn_is_zero_2(bignum_bit_index):
assert_bn_is_zero(2 ** bignum_bit_index)
assert_bn_is_zero(2**bignum_bit_index)
def test_bn_is_one_1():
@ -720,7 +720,7 @@ def test_bn_is_one_1():
def test_bn_is_one_2(bignum_bit_index):
assert_bn_is_one(2 ** bignum_bit_index)
assert_bn_is_one(2**bignum_bit_index)
def test_bn_is_less_1(r):
@ -734,7 +734,7 @@ def test_bn_is_less_1(r):
def test_bn_is_less_2(r):
a = r.rand_int_normalized()
i = r.rand_bit_index()
b = a ^ 2 ** i
b = a ^ 2**i
assert_bn_is_less(a, b)
@ -829,8 +829,8 @@ def test_bn_mod_2(r, prime):
def test_bn_multiply_long(r, prime):
x = r.randrange(floor(sqrt(2 ** 519)))
k = r.randrange(floor(sqrt(2 ** 519)))
x = r.randrange(floor(sqrt(2**519)))
k = r.randrange(floor(sqrt(2**519)))
assert_bn_multiply_long(k, x)
@ -841,8 +841,8 @@ def test_bn_multiply_reduce_step(r, prime):
def test_bn_multiply(r, prime):
x = r.randrange(floor(sqrt(2 ** 519)))
k = r.randrange(floor(sqrt(2 ** 519)))
x = r.randrange(floor(sqrt(2**519)))
k = r.randrange(floor(sqrt(2**519)))
assert_bn_multiply(k, x, prime)
@ -880,7 +880,7 @@ def test_bn_sqrt_2(r, prime):
def test_inverse_mod_power_two(r):
m = r.randrange(1, 33)
i = r.randrange(1, 2 ** 29, 2)
i = r.randrange(1, 2**29, 2)
assert_inverse_mod_power_two(i, m)
@ -934,14 +934,14 @@ def test_bn_addmod(r, prime):
def test_bn_addi_1(r):
while True:
a = r.rand_int_normalized()
b = r.randrange(2 ** 32 - 2 ** bits_per_limb + 1)
b = r.randrange(2**32 - 2**bits_per_limb + 1)
if a + b < 2 ** (limbs_number * bits_per_limb):
break
assert_bn_addi(a, b)
def test_bn_addi_2():
b = 2 ** 32 - 2 ** bits_per_limb
b = 2**32 - 2**bits_per_limb
a = 2 ** (limbs_number * bits_per_limb) - 1 - b
assert_bn_addi(a, b)
@ -949,14 +949,14 @@ def test_bn_addi_2():
def test_bn_subi_1(r, prime):
while True:
a = r.rand_int_normalized()
b = r.randrange(prime % 2 ** bits_per_limb)
b = r.randrange(prime % 2**bits_per_limb)
if a + prime - b < 2 ** (limbs_number * bits_per_limb):
break
assert_bn_subi(a, b, prime)
def test_bn_subi_2(prime):
b = (prime % 2 ** bits_per_limb) - 1
b = (prime % 2**bits_per_limb) - 1
a = 2 ** (limbs_number * bits_per_limb) - 1 - prime + b
assert_bn_subi(a, b, prime)

@ -202,7 +202,7 @@ def test_curve_parameters(curve):
def test_point_multiply(curve, r):
p = r.randpoint(curve)
k = r.randrange(0, 2 ** 256)
k = r.randrange(0, 2**256)
kp = k * p
res = POINT(int2bn(0), int2bn(0))
lib.point_multiply(curve.ptr, int2bn(k), to_POINT(p), res)
@ -236,8 +236,8 @@ def test_point_to_jacobian(curve, r):
jp = JACOBIAN()
lib.curve_to_jacobian(to_POINT(p), jp, int2bn(curve.p))
jx, jy, jz = from_JACOBIAN(jp)
assert jx % curve.p == (p.x() * jz ** 2) % curve.p
assert jy % curve.p == (p.y() * jz ** 3) % curve.p
assert jx % curve.p == (p.x() * jz**2) % curve.p
assert jy % curve.p == (p.y() * jz**3) % curve.p
q = POINT()
lib.jacobian_to_curve(jp, q, int2bn(curve.p))

41
poetry.lock generated

@ -47,29 +47,25 @@ pyflakes = ">=1.1.0"
[[package]]
name = "black"
version = "21.12b0"
version = "22.3.0"
description = "The uncompromising code formatter."
category = "main"
optional = false
python-versions = ">=3.6.2"
[package.dependencies]
click = ">=7.1.2"
click = ">=8.0.0"
mypy-extensions = ">=0.4.3"
pathspec = ">=0.9.0,<1"
pathspec = ">=0.9.0"
platformdirs = ">=2"
tomli = ">=0.2.6,<2.0.0"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""}
typing-extensions = [
{version = ">=3.10.0.0", markers = "python_version < \"3.10\""},
{version = "!=3.10.0.1", markers = "python_version >= \"3.10\""},
]
typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}
[package.extras]
colorama = ["colorama (>=0.4.3)"]
d = ["aiohttp (>=3.7.4)"]
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
python2 = ["typed-ast (>=1.4.3)"]
uvloop = ["uvloop (>=0.15.2)"]
[[package]]
@ -1011,7 +1007,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata]
lock-version = "1.1"
python-versions = "^3.7"
content-hash = "65f34c04e59cf2afeb3bb80b63027b00a6c13e395f0e2a1d354c2668f8de53d8"
content-hash = "4ccf9c6db72fb71f6309c7fe7cf45911c86e44daba3c41b20d0366327f0b00af"
[metadata.files]
astroid = [
@ -1030,8 +1026,29 @@ autoflake = [
{file = "autoflake-1.4.tar.gz", hash = "sha256:61a353012cff6ab94ca062823d1fb2f692c4acda51c76ff83a8d77915fba51ea"},
]
black = [
{file = "black-21.12b0-py3-none-any.whl", hash = "sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f"},
{file = "black-21.12b0.tar.gz", hash = "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3"},
{file = "black-22.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2497f9c2386572e28921fa8bec7be3e51de6801f7459dffd6e62492531c47e09"},
{file = "black-22.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5795a0375eb87bfe902e80e0c8cfaedf8af4d49694d69161e5bd3206c18618bb"},
{file = "black-22.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e3556168e2e5c49629f7b0f377070240bd5511e45e25a4497bb0073d9dda776a"},
{file = "black-22.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67c8301ec94e3bcc8906740fe071391bce40a862b7be0b86fb5382beefecd968"},
{file = "black-22.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:fd57160949179ec517d32ac2ac898b5f20d68ed1a9c977346efbac9c2f1e779d"},
{file = "black-22.3.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:cc1e1de68c8e5444e8f94c3670bb48a2beef0e91dddfd4fcc29595ebd90bb9ce"},
{file = "black-22.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2fc92002d44746d3e7db7cf9313cf4452f43e9ea77a2c939defce3b10b5c82"},
{file = "black-22.3.0-cp36-cp36m-win_amd64.whl", hash = "sha256:a6342964b43a99dbc72f72812bf88cad8f0217ae9acb47c0d4f141a6416d2d7b"},
{file = "black-22.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:328efc0cc70ccb23429d6be184a15ce613f676bdfc85e5fe8ea2a9354b4e9015"},
{file = "black-22.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06f9d8846f2340dfac80ceb20200ea5d1b3f181dd0556b47af4e8e0b24fa0a6b"},
{file = "black-22.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:ad4efa5fad66b903b4a5f96d91461d90b9507a812b3c5de657d544215bb7877a"},
{file = "black-22.3.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8477ec6bbfe0312c128e74644ac8a02ca06bcdb8982d4ee06f209be28cdf163"},
{file = "black-22.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:637a4014c63fbf42a692d22b55d8ad6968a946b4a6ebc385c5505d9625b6a464"},
{file = "black-22.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:863714200ada56cbc366dc9ae5291ceb936573155f8bf8e9de92aef51f3ad0f0"},
{file = "black-22.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10dbe6e6d2988049b4655b2b739f98785a884d4d6b85bc35133a8fb9a2233176"},
{file = "black-22.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:cee3e11161dde1b2a33a904b850b0899e0424cc331b7295f2a9698e79f9a69a0"},
{file = "black-22.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5891ef8abc06576985de8fa88e95ab70641de6c1fca97e2a15820a9b69e51b20"},
{file = "black-22.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:30d78ba6bf080eeaf0b7b875d924b15cd46fec5fd044ddfbad38c8ea9171043a"},
{file = "black-22.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ee8f1f7228cce7dffc2b464f07ce769f478968bfb3dd1254a4c2eeed84928aad"},
{file = "black-22.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ee227b696ca60dd1c507be80a6bc849a5a6ab57ac7352aad1ffec9e8b805f21"},
{file = "black-22.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:9b542ced1ec0ceeff5b37d69838106a6348e60db7b8fdd245294dc1d26136265"},
{file = "black-22.3.0-py3-none-any.whl", hash = "sha256:bc58025940a896d7e5356952228b68f793cf5fcb342be703c3a2669a1488cb72"},
{file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"},
]
certifi = [
{file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"},

@ -38,7 +38,7 @@ typing-extensions = ">=3.7.4"
## style
isort = "<5" # 5 changes lots of stuff that need to be addressed first: https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/
flake8 = ">=3.7.0"
black = ">=20.8b0"
black = ">=22.3"
mako = "^1.0.7"
munch = "^2.3.2"
autoflake = "*"

@ -41,8 +41,8 @@ __version__ = "1.0.dev1"
b = 256
q: int = 2 ** 255 - 19
l: int = 2 ** 252 + 27742317777372353535851937790883648493
q: int = 2**255 - 19
l: int = 2**252 + 27742317777372353535851937790883648493
COORD_MASK = ~(1 + 2 + 4 + (1 << b - 1))
COORD_HIGH_BIT = 1 << b - 2

@ -93,7 +93,7 @@ def from_json(json_dict: "Transaction") -> messages.TransactionType:
def make_bin_output(vout: "Vout") -> messages.TxOutputBinType:
return messages.TxOutputBinType(
amount=int(Decimal(vout["value"]) * (10 ** 8)),
amount=int(Decimal(vout["value"]) * (10**8)),
script_pubkey=bytes.fromhex(vout["scriptPubKey"]["hex"]),
)

@ -168,13 +168,13 @@ class Field:
def value_fits(self, value: int) -> bool:
if self.type == "uint32":
return 0 <= value < 2 ** 32
return 0 <= value < 2**32
if self.type == "uint64":
return 0 <= value < 2 ** 64
return 0 <= value < 2**64
if self.type == "sint32":
return -(2 ** 31) <= value < 2 ** 31
return -(2**31) <= value < 2**31
if self.type == "sint64":
return -(2 ** 63) <= value < 2 ** 63
return -(2**63) <= value < 2**63
raise ValueError(f"Cannot check range bounds for {self.type}")

@ -142,7 +142,7 @@ def b58decode(v: AnyStr, length: Optional[int] = None) -> bytes:
long_value = 0
for (i, c) in enumerate(str_v[::-1]):
long_value += __b58chars.find(c) * (__b58base ** i)
long_value += __b58chars.find(c) * (__b58base**i)
result = b""
while long_value >= 256:

@ -32,8 +32,8 @@ def case(id, *args, altcoin=False):
return pytest.param(*args, id=id, marks=marks)
MESSAGE_NFKD = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
MESSAGE_NFC = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
MESSAGE_NFKD = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
MESSAGE_NFC = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
NFKD_NFC_SIGNATURE = "2046a0b46e81492f82e0412c73701b9740e6462c603575ee2d36c7d7b4c20f0f33763ca8cb3027ea8e1ce5e83fda8b6746fea8f5c82655d78fd419e7c766a5e17a"
VECTORS = ( # case name, coin_name, path, script_type, address, message, signature

@ -155,18 +155,18 @@ def test_testnet_segwit_big_amount(client: Client):
address_n,
script_type=messages.InputScriptType.SPENDP2SHWITNESS,
)
prev_hash, prev_tx = forge_prevtx([(address, 2 ** 32 + 1)], network="testnet")
prev_hash, prev_tx = forge_prevtx([(address, 2**32 + 1)], network="testnet")
inp1 = messages.TxInputType(
address_n=address_n,
amount=2 ** 32 + 1,
amount=2**32 + 1,
prev_hash=prev_hash,
prev_index=0,
script_type=messages.InputScriptType.SPENDP2SHWITNESS,
)
out1 = messages.TxOutputType(
address="2Mt7P2BAfE922zmfXrdcYTLyR7GUvbwSEns", # seed allallall, bip32: m/49h/1h/0h/0/1, script type:p2shsegwit
amount=2 ** 32 + 1,
amount=2**32 + 1,
script_type=messages.OutputScriptType.PAYTOADDRESS,
)
with client:

@ -193,15 +193,15 @@ def test_verify_bitcoind(client: Client):
bytes.fromhex(
"1cc694f0f23901dfe3603789142f36a3fc582d0d5c0ec7215cf2ccd641e4e37228504f3d4dc3eea28bbdbf5da27c49d4635c097004d9f228750ccd836a8e1460c0"
),
u"\u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy",
"\u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy",
)
assert res is True
def test_verify_utf(client: Client):
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfkd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
res_nfkd = btc.verify_message(
client,

@ -94,8 +94,8 @@ def test_message_verify(client: Client):
def test_verify_utf(client: Client):
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfkd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
res_nfkd = btc.verify_message(
client,

@ -94,8 +94,8 @@ def test_message_verify(client: Client):
def test_verify_utf(client: Client):
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfkd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
res_nfkd = btc.verify_message(
client,

@ -21,8 +21,8 @@ import pytest
from trezorlib import messages as m, misc
from trezorlib.debuglink import TrezorClientDebugLink as Client
ENTROPY_LENGTHS_POW2 = [2 ** l for l in range(10)]
ENTROPY_LENGTHS_POW2_1 = [2 ** l + 1 for l in range(10)]
ENTROPY_LENGTHS_POW2 = [2**l for l in range(10)]
ENTROPY_LENGTHS_POW2_1 = [2**l + 1 for l in range(10)]
ENTROPY_LENGTHS = ENTROPY_LENGTHS_POW2 + ENTROPY_LENGTHS_POW2_1

@ -94,7 +94,7 @@ def test_autolock_default_value(client: Client):
@pytest.mark.parametrize(
"seconds",
[0, 1, 9, 536871, 2 ** 22],
[0, 1, 9, 536871, 2**22],
)
def test_apply_auto_lock_delay_out_of_range(client: Client, seconds):
with client:

@ -93,18 +93,18 @@ def test_load_device_slip39_advanced(client: Client):
def test_load_device_utf(client: Client):
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfkc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfkd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
words_nfc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfkc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
words_nfd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
passphrase_nfkd = (
u"Neuve\u030cr\u030citelne\u030c bezpec\u030cne\u0301 hesli\u0301c\u030cko"
"Neuve\u030cr\u030citelne\u030c bezpec\u030cne\u0301 hesli\u0301c\u030cko"
)
passphrase_nfc = u"Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
passphrase_nfkc = u"Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
passphrase_nfc = "Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
passphrase_nfkc = "Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
passphrase_nfd = (
u"Neuve\u030cr\u030citelne\u030c bezpec\u030cne\u0301 hesli\u0301c\u030cko"
"Neuve\u030cr\u030citelne\u030c bezpec\u030cne\u0301 hesli\u0301c\u030cko"
)
debuglink.load_device(

@ -80,7 +80,7 @@ def test_incorrect_pin_t2(client: Client):
def _check_backoff_time(attempts: int, start: float) -> None:
"""Helper to assert the exponentially growing delay after incorrect PIN attempts"""
expected = (2 ** attempts) - 1
expected = (2**attempts) - 1
got = round(time.time() - start, 2)
assert got >= expected

Loading…
Cancel
Save