Skip to content

Commit

Permalink
Move signatures stuff to logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
palkeo committed May 2, 2020
1 parent 9a76ad7 commit 7cf4c72
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions utils/signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os.path
import sys
import logging

from pano.matcher import Any, match

Expand All @@ -22,6 +23,8 @@
)
from .supplement import fetch_sigs

logger = logging.getLogger(__name__)

_abi = None
_func = None

Expand Down Expand Up @@ -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 = (
Expand All @@ -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())

Expand Down Expand Up @@ -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

0 comments on commit 7cf4c72

Please sign in to comment.