Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some python interface fixes #57

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Notebooks/blocksci/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ def filter_txes(self, filterFunc, start = None, end = None, cpu_count=psutil.cpu
"""Return all transactions in range which match the given criteria
"""
def mapFunc(blocks):
return [tx.index for block in blocks for tx in block if filterFunc(tx)]
return [tx for block in blocks for tx in block if filterFunc(tx)]
def reduceFunc(cur, el):
return cur + [el]
init = list()
tx_ids = mapreduce_block_ranges(self, mapFunc, reduceFunc, init, start, end, cpu_count)
return [Tx(x) for x in tx_ids]
return mapreduce_block_ranges(self, mapFunc, reduceFunc, init, start, end, cpu_count)

Blockchain.map_blocks = map_blocks
Blockchain.filter_blocks = filter_blocks
Expand Down Expand Up @@ -242,4 +241,4 @@ def build_function(self, full_code, makefile, module_name):
out, err = process.communicate()
print(err.decode('utf8'))
mod = importlib.import_module(module_name)
return getattr(mod, "func")
return getattr(mod, "func")
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Note that BlockSci only actively supports python 3.
sudo make install

sudo -H pip3 install --upgrade pip
sudo -H pip3 install --upgrade multiprocess psutil jupyter pycrypto matplotlib pandas dateparser
sudo -H pip3 install --upgrade multiprocess psutil jupyter pycrypto matplotlib pandas dateparser requests

Team & contact info
===================
Expand Down