Skip to content

Commit 64eca45

Browse files
committed
[tests] Fix pep8 style violations in address.py
1 parent b230f8b commit 64eca45

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/functional/test_framework/address.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def byte_to_base58(b, version):
3535
str = chr(version).encode('latin-1').hex() + str
3636
checksum = hash256(hex_str_to_bytes(str)).hex()
3737
str += checksum[:8]
38-
value = int('0x'+str,0)
38+
value = int('0x' + str, 0)
3939
while value > 0:
4040
result = chars[value % 58] + result
4141
value //= 58
@@ -75,60 +75,60 @@ def base58_to_byte(s):
7575
return res[1:-4], int(res[0])
7676

7777

78-
def keyhash_to_p2pkh(hash, main = False):
78+
def keyhash_to_p2pkh(hash, main=False):
7979
assert len(hash) == 20
8080
version = 0 if main else 111
8181
return byte_to_base58(hash, version)
8282

83-
def scripthash_to_p2sh(hash, main = False):
83+
def scripthash_to_p2sh(hash, main=False):
8484
assert len(hash) == 20
8585
version = 5 if main else 196
8686
return byte_to_base58(hash, version)
8787

88-
def key_to_p2pkh(key, main = False):
88+
def key_to_p2pkh(key, main=False):
8989
key = check_key(key)
9090
return keyhash_to_p2pkh(hash160(key), main)
9191

92-
def script_to_p2sh(script, main = False):
92+
def script_to_p2sh(script, main=False):
9393
script = check_script(script)
9494
return scripthash_to_p2sh(hash160(script), main)
9595

96-
def key_to_p2sh_p2wpkh(key, main = False):
96+
def key_to_p2sh_p2wpkh(key, main=False):
9797
key = check_key(key)
9898
p2shscript = CScript([OP_0, hash160(key)])
9999
return script_to_p2sh(p2shscript, main)
100100

101-
def program_to_witness(version, program, main = False):
101+
def program_to_witness(version, program, main=False):
102102
if (type(program) is str):
103103
program = hex_str_to_bytes(program)
104104
assert 0 <= version <= 16
105105
assert 2 <= len(program) <= 40
106106
assert version > 0 or len(program) in [20, 32]
107107
return encode_segwit_address("bc" if main else "bcrt", version, program)
108108

109-
def script_to_p2wsh(script, main = False):
109+
def script_to_p2wsh(script, main=False):
110110
script = check_script(script)
111111
return program_to_witness(0, sha256(script), main)
112112

113-
def key_to_p2wpkh(key, main = False):
113+
def key_to_p2wpkh(key, main=False):
114114
key = check_key(key)
115115
return program_to_witness(0, hash160(key), main)
116116

117-
def script_to_p2sh_p2wsh(script, main = False):
117+
def script_to_p2sh_p2wsh(script, main=False):
118118
script = check_script(script)
119119
p2shscript = CScript([OP_0, sha256(script)])
120120
return script_to_p2sh(p2shscript, main)
121121

122122
def check_key(key):
123123
if (type(key) is str):
124-
key = hex_str_to_bytes(key) # Assuming this is hex string
124+
key = hex_str_to_bytes(key) # Assuming this is hex string
125125
if (type(key) is bytes and (len(key) == 33 or len(key) == 65)):
126126
return key
127127
assert False
128128

129129
def check_script(script):
130130
if (type(script) is str):
131-
script = hex_str_to_bytes(script) # Assuming this is hex string
131+
script = hex_str_to_bytes(script) # Assuming this is hex string
132132
if (type(script) is bytes or type(script) is CScript):
133133
return script
134134
assert False

0 commit comments

Comments
 (0)