From 7cf4c72dad20f5dfe52b8ee784d5f685acc06a3f Mon Sep 17 00:00:00 2001 From: palkeo Date: Sat, 2 May 2020 18:12:41 +1200 Subject: [PATCH] Move signatures stuff to logging. --- utils/signatures.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/signatures.py b/utils/signatures.py index 5618d835..c18ba630 100644 --- a/utils/signatures.py +++ b/utils/signatures.py @@ -2,6 +2,7 @@ import json import os.path import sys +import logging from pano.matcher import Any, match @@ -22,6 +23,8 @@ ) from .supplement import fetch_sigs +logger = logging.getLogger(__name__) + _abi = None _func = None @@ -155,7 +158,7 @@ def match_score(func, hashes): def make_abi(hash_targets): global _abi - hash_name = str(list(hash_targets.keys())).encode("utf-8") + hash_name = str(sorted(list(hash_targets.keys()))).encode("utf-8") hash_name = hashlib.sha256(hash_name).hexdigest() dir_name = ( @@ -176,8 +179,7 @@ def make_abi(hash_targets): return _abi - if "--silent" not in sys.argv: - print("cache for PABI not found, generating...") + logger.info("Cache for PABI not found, generating...") hashes = list(hash_targets.keys()) @@ -220,4 +222,6 @@ def make_abi(hash_targets): with open(cache_fname, "w+") as f: f.write(json.dumps(result, indent=2)) + logger.info("Cache for PABI generated.") + return result