refactor: E275 missing whitespace after keyword

This commit is contained in:
tecnovert
2022-07-31 20:01:49 +02:00
parent 1601a57aed
commit 1c4f208d27
29 changed files with 295 additions and 295 deletions

View File

@@ -56,7 +56,7 @@ def SerialiseNum(n):
rv = bytearray()
neg = n < 0
absvalue = -n if neg else n
while(absvalue):
while (absvalue):
rv.append(absvalue & 0xff)
absvalue >>= 8
if rv[-1] & 0x80:

View File

@@ -114,7 +114,7 @@ def decodeAddress(address_str):
if b58_addr is not None:
address = b58_addr[:-4]
checksum = b58_addr[-4:]
assert(hashlib.sha256(hashlib.sha256(address).digest()).digest()[:4] == checksum), 'Checksum mismatch'
assert (hashlib.sha256(hashlib.sha256(address).digest()).digest()[:4] == checksum), 'Checksum mismatch'
return b58_addr[:-4]
return None

View File

@@ -171,18 +171,18 @@ def testEccUtils():
print('testEccUtils()')
G_enc = ToDER(G)
assert(G_enc.hex() == '0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8')
assert (G_enc.hex() == '0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8')
G_enc = pointToCPK(G)
assert(G_enc.hex() == '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
assert (G_enc.hex() == '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
G_dec = CPKToPoint(G_enc)
assert(G_dec == G)
assert (G_dec == G)
G_enc = pointToCPK2(G)
assert(G_enc.hex() == '0879be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
assert (G_enc.hex() == '0879be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798')
H = hashToCurve(ToDER(G))
assert(pointToCPK(H).hex() == '0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0')
assert (pointToCPK(H).hex() == '0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0')
print('Passed.')

View File

@@ -14,7 +14,7 @@ def rfc2440_hash_password(password, salt=None):
if salt is None:
salt = secrets.token_bytes(8)
assert(len(salt) == 8)
assert len(salt) == 8
hashbytes = salt + password.encode('utf-8')
len_hashbytes = len(hashbytes)

View File

@@ -13,7 +13,7 @@ def decodeScriptNum(script_bytes, o):
v = 0
num_len = script_bytes[o]
if num_len >= OpCodes.OP_1 and num_len <= OpCodes.OP_16:
return((num_len - OpCodes.OP_1) + 1, 1)
return ((num_len - OpCodes.OP_1) + 1, 1)
if num_len > 4:
raise ValueError('Bad scriptnum length') # Max 4 bytes
@@ -29,7 +29,7 @@ def decodeScriptNum(script_bytes, o):
v *= -1
else:
v += int(b) << 8 * i
return(v, 1 + num_len)
return (v, 1 + num_len)
def getP2SHScriptForHash(p2sh):