diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-26 16:45:40 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-26 16:45:40 +0800 |
commit | b57474b17e507328c2be458ac13a16ed4ea0e6ac (patch) | |
tree | 05603a1634d37fa73c975aa12d940659464f436a | |
parent | 463f932f93fad83431c6e6d849fc31863ca93647 (diff) | |
download | fg21sim-b57474b17e507328c2be458ac13a16ed4ea0e6ac.tar.bz2 |
utils: Rename function "md5()" to "calc_md5()"
-rw-r--r-- | fg21sim/products.py | 12 | ||||
-rw-r--r-- | fg21sim/utils/hashutil.py | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/fg21sim/products.py b/fg21sim/products.py index 992b2af..e355054 100644 --- a/fg21sim/products.py +++ b/fg21sim/products.py @@ -14,7 +14,7 @@ from collections import OrderedDict import numpy as np from .errors import ManifestError -from .utils.hashutil import md5 +from .utils.hashutil import calc_md5 logger = logging.getLogger(__name__) @@ -174,7 +174,7 @@ class Products: "path": os.path.relpath(filepath, root_dir), # File size in bytes "size": os.path.getsize(filepath), - "md5": md5(filepath), + "md5": calc_md5(filepath), } } logger.info("Added one product to the manifest: {0}".format(filepath)) @@ -236,7 +236,7 @@ class Products: metadata = self.get_product(comp_id, freq_id) filepath = os.path.join(root_dir, metadata["healpix"]["path"]) hash_true = metadata["healpix"]["md5"] - hash_ondisk = md5(filepath) + hash_ondisk = calc_md5(filepath) if hash_ondisk == hash_true: match = True else: @@ -332,13 +332,13 @@ class Products: logger.info("Converted HEALPix map to HPX image: %s" % outfile) # size = os.path.getsize(outfile) - md5sum = md5(outfile) + md5 = calc_md5(outfile) metadata["hpx"] = { "path": os.path.relpath(outfile, root_dir), "size": size, - "md5": md5sum, + "md5": md5, } - return (outfile, size, md5sum) + return (outfile, size, md5) def reset(self): self.manifest = OrderedDict() diff --git a/fg21sim/utils/hashutil.py b/fg21sim/utils/hashutil.py index 394ef04..adad25b 100644 --- a/fg21sim/utils/hashutil.py +++ b/fg21sim/utils/hashutil.py @@ -11,7 +11,7 @@ md5 : import hashlib -def md5(filepath, blocksize=65536): +def calc_md5(filepath, blocksize=65536): """ Calculate the MD5 checksum/digest of the file data. |