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

Commit 6258aa9

Browse files
committed
cleanup imports
1 parent 868c99a commit 6258aa9

25 files changed

+138
-532
lines changed

ethereum/__init__.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
'''from pyethereum import utils
2-
from pyethereum import trie
3-
from pyethereum import securetrie
4-
from pyethereum import blocks
5-
from pyethereum import transactions
6-
from pyethereum import processblock
7-
from pyethereum import chainmanager
8-
from pyethereum import tester
9-
from pyethereum import abi
10-
from pyethereum import ethash'''
11-
12-
from pyethereum._version import get_versions
13-
__version__ = get_versions()['version']
14-
del get_versions
1+
'''from ethereum import utils
2+
from ethereum import trie
3+
from ethereum import securetrie
4+
from ethereum import blocks
5+
from ethereum import transactions
6+
from ethereum import processblock
7+
from ethereum import chainmanager
8+
from ethereum import tester
9+
from ethereum import abi
10+
from ethereum import ethash'''

ethereum/abi.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import sys, re, json
2-
from pyethereum import utils
1+
import sys
2+
import re
3+
import json
4+
from ethereum import utils
35
from rlp.utils import decode_hex, encode_hex
4-
from pyethereum.utils import encode_int, zpad, big_endian_to_int, is_numeric, is_string
6+
from ethereum.utils import encode_int, zpad, big_endian_to_int, is_numeric, is_string
57

68
if sys.version_info.major == 2:
79
def json_decode(x):
@@ -73,7 +75,7 @@ def encode(self, name, args):
7375
def decode(self, name, data):
7476
fdata = self.function_data[name]
7577
if fdata['is_unknown_type']:
76-
o = [utils.to_signed(utils.big_endian_to_int(data[i:i+32]))
78+
o = [utils.to_signed(utils.big_endian_to_int(data[i:i + 32]))
7779
for i in range(0, len(data), 32)]
7880
return [0 if not o else o[0] if len(o) == 1 else o]
7981
return decode_abi(fdata['decode_types'], data)
@@ -106,6 +108,8 @@ def listen(self, log):
106108
return o
107109

108110
# Decode an integer
111+
112+
109113
def decint(n):
110114
if is_numeric(n) and n < 2**256 and n > -2**255:
111115
return n
@@ -138,7 +142,7 @@ def encode_single(arg, base, sub):
138142
elif base == 'int':
139143
sub = int(sub)
140144
i = decint(arg)
141-
assert -2**(sub-1) <= i < 2**sub, "Value out of bounds: %r" % arg
145+
assert -2**(sub - 1) <= i < 2**sub, "Value out of bounds: %r" % arg
142146
normal_args = zpad(encode_int(i % 2**sub), 32)
143147
# Unsigned reals: ureal<high>x<low>
144148
elif base == 'ureal':
@@ -148,7 +152,7 @@ def encode_single(arg, base, sub):
148152
# Signed reals: real<high>x<low>
149153
elif base == 'real':
150154
high, low = [int(x) for x in sub.split('x')]
151-
assert -2**(high-1) <= arg < 2**(high-1), \
155+
assert -2**(high - 1) <= arg < 2**(high - 1), \
152156
"Value out of bounds: %r" % arg
153157
normal_args = zpad(encode_int((arg % 2**high) * 2**low), 32)
154158
# Strings
@@ -304,7 +308,7 @@ def decode_single(data, base, sub):
304308
return big_endian_to_int(data)
305309
elif base == 'int':
306310
o = big_endian_to_int(data)
307-
return (o - 2**int(sub)) if o >= 2**(int(sub)-1) else o
311+
return (o - 2**int(sub)) if o >= 2**(int(sub) - 1) else o
308312
elif base == 'ureal':
309313
high, low = [int(x) for x in sub.split('x')]
310314
return big_endian_to_int(data) * 1.0 / 2**low
@@ -319,7 +323,7 @@ def decode_any(data, base, sub, arrlist):
319323
sz = getlen(base, sub, arrlist[:-1])
320324
o = []
321325
for i in range(0, len(data), sz):
322-
o.append(decode_any(data[i: i+sz], base, sub, arrlist[:-1]))
326+
o.append(decode_any(data[i: i + sz], base, sub, arrlist[:-1]))
323327
return o
324328

325329

0 commit comments

Comments
 (0)