Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 94da783

Browse files
committed
PEP8
1 parent 84af5ba commit 94da783

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ethereum/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ def bytearray_to_bytestr(value):
6868
def mk_contract_address(sender, nonce):
6969
return sha3(rlp.encode([normalize_address(sender), nonce]))[12:]
7070

71+
7172
def mk_metropolis_contract_address(sender, initcode):
7273
return sha3(normalize_address(sender) + initcode)[12:]
7374

75+
7476
def safe_ord(value):
7577
if isinstance(value, int):
7678
return value
@@ -115,6 +117,7 @@ def int_to_32bytearray(i):
115117

116118
sha3_count = [0]
117119

120+
118121
def sha3(seed):
119122
sha3_count[0] += 1
120123
return sha3_256(to_string(seed))
@@ -136,6 +139,7 @@ def add_checksum(x):
136139
return x
137140
return x + sha3(x)[:4]
138141

142+
139143
def add_cool_checksum(addr):
140144
addr = normalize_address(addr)
141145
addr_hex = encode_hex(addr)
@@ -152,14 +156,16 @@ def add_cool_checksum(addr):
152156
o += c
153157
else:
154158
o += c.lower() if h[i] in '01234567' else c.upper()
155-
return '0x'+o
159+
return '0x' + o
160+
156161

157162
def check_and_strip_checksum(x):
158163
if len(x) in (40, 48):
159164
x = decode_hex(x)
160165
assert len(x) == 24 and sha3(x[:20])[:4] == x[-4:]
161166
return x[:20]
162167

168+
163169
def check_and_strip_cool_checksum(addr):
164170
assert add_cool_checksum(addr.lower()) == addr
165171
return normalize_address(addr)

0 commit comments

Comments
 (0)