Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
slither/utils/similarity/cache.py

23 lines
532 B

6 years ago
import sys
try:
import numpy as np
except ImportError:
print("ERROR: in order to use slither-simil, you need to install numpy")
print("$ pip3 install numpy --user\n")
sys.exit(-1)
6 years ago
def load_cache(infile, nsamples=None):
cache = dict()
6 years ago
with np.load(infile) as data:
array = data['arr_0'][0]
for i,(x,y) in enumerate(array):
cache[x] = y
if i == nsamples:
break
return cache
def save_cache(cache, outfile):
6 years ago
np.savez(outfile,[np.array(cache)])