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

Commit 15e5345

Browse files
committed
Replace range with itertools & remove future dep
1 parent 46b7f9d commit 15e5345

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

ethereum/chain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
from builtins import range
2+
from itertools import count, islice
33
from ethereum import utils
44
from ethereum.utils import parse_as_bin, big_endian_to_int
55
from ethereum import parse_genesis_declaration
@@ -264,7 +264,7 @@ def add_block(self, block):
264264
break
265265
b = self.get_parent(b)
266266
replace_from = b.header.number
267-
for i in range(replace_from, 2**63 - 1):
267+
for i in islice(count(), replace_from, 2**63 - 1):
268268
log.info('Rewriting height %d' % i)
269269
key = 'block:' + str(i)
270270
orig_at_height = self.db.get(key) if key in self.db else None
@@ -325,7 +325,7 @@ def get_chain(self, frm=None, to=2**63 - 1):
325325
if frm is None:
326326
frm = int(self.db.get('GENESIS_NUMBER')) + 1
327327
chain = []
328-
for i in range(frm, to):
328+
for i in islice(count(), frm, to):
329329
h = self.get_blockhash_by_number(i)
330330
if not h:
331331
return chain

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ PyYAML
44
repoze.lru
55
pbkdf2
66
pycryptodome>=3.3.1
7-
future==0.16.0
87
scrypt
98
rlp>=0.4.7
109
https://github.com/ethereum/ethash/tarball/master

0 commit comments

Comments
 (0)