diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-21 12:57:55 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-21 12:57:55 +0800 |
commit | dc06505e902d3a2b8fdcc276b61db0636308d1e6 (patch) | |
tree | 22dce2824b7f50d099c9668666d58fb06f479de1 | |
parent | b23df04a1afdeab26b62ce1ac0ce85ef8547de28 (diff) | |
download | fg21sim-dc06505e902d3a2b8fdcc276b61db0636308d1e6.tar.bz2 |
products.py: Use "utils.hashutil.md5()"
-rw-r--r-- | fg21sim/products.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fg21sim/products.py b/fg21sim/products.py index c0d23ac..5df7d7a 100644 --- a/fg21sim/products.py +++ b/fg21sim/products.py @@ -7,7 +7,6 @@ Manage and manipulate the simulation products. import os import shutil -import hashlib import json import logging from collections import OrderedDict @@ -15,6 +14,7 @@ from collections import OrderedDict import numpy as np from .errors import ManifestError +from .utils.hashutil import md5 logger = logging.getLogger(__name__) @@ -157,7 +157,7 @@ class Products: "path": os.path.relpath(filepath, curdir), # File size in bytes "size": os.path.getsize(filepath), - "md5": hashlib.md5(filepath).hexdigest(), + "md5": md5(filepath), } } logger.info("Added one product to the manifest: {0}".format(filepath)) @@ -219,7 +219,7 @@ class Products: metadata = self.manifest[comp_id][freq_id] filepath = os.path.join(curdir, metadata["healpix"]["path"]) hash_true = metadata["healpix"]["md5"] - hash_ondisk = hashlib.md5(filepath).hexdigest() + hash_ondisk = md5(filepath) if hash_ondisk == hash_true: match = True else: |