diff --git a/utils/similarity/encode.py b/utils/similarity/encode.py index 13438a137..6c9f4700a 100644 --- a/utils/similarity/encode.py +++ b/utils/similarity/encode.py @@ -22,6 +22,9 @@ slither_logger = logging.getLogger("Slither") slither_logger.setLevel(logging.CRITICAL) def parse_target(target): + if target is None: + return None, None + parts = target.split('.') if len(parts) == 1: return None, parts[0] diff --git a/utils/similarity/info.py b/utils/similarity/info.py index 7cfa0fb67..431852571 100644 --- a/utils/similarity/info.py +++ b/utils/similarity/info.py @@ -40,11 +40,11 @@ def info(args): x = (filename,contract,fname) y = " ".join(irs[x]) - print("Function {} in contract {} is encoded as:".format(fname, contract)) - print(y) + logger.info("Function {} in contract {} is encoded as:".format(fname, contract)) + logger.info(y) if model is not None: fvector = model.get_sentence_vector(y) - print(fvector) + logger.info(fvector) except Exception: logger.error('Error in %s' % args.filename) diff --git a/utils/similarity/plot.py b/utils/similarity/plot.py index 69d359f35..1b4d07e02 100644 --- a/utils/similarity/plot.py +++ b/utils/similarity/plot.py @@ -61,7 +61,7 @@ def plot(args): tdata = pca.fit_transform(data) logger.info('Plotting data..') - plt.figure() + plt.figure(figsize=(20,10)) assert(len(tdata) == len(fs)) for ([x,y],l) in zip(tdata, fs): x = random.gauss(0, 0.01) + x