You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/08/03 20:10:52 UTC
[GitHub] szha commented on a change in pull request #7322: add verification to gluon dataset
szha commented on a change in pull request #7322: add verification to gluon dataset
URL: https://github.com/apache/incubator-mxnet/pull/7322#discussion_r131247167
##########
File path: python/mxnet/gluon/utils.py
##########
@@ -119,7 +120,33 @@ def _indent(s_, numSpaces):
return s
-def download(url, path=None, overwrite=False):
+def verified_sha1(file_path, sha1hex):
+ """Check whether the sha1 hash of the file content matches the expected hash.
+
+ Parameters
+ ----------
+ file_path : str
+ Path to the file.
+ sha1hex : str
+ Expected sha1 hash in hexadecimal digits.
+
+ Returns
+ -------
+ bool
+ Whether the file content matches the expected hash.
+ """
+ sha1 = hashlib.sha1()
+ with open(file_path, 'rb') as f:
+ while True:
+ data = f.read(1048576)
Review comment:
This is 1mb.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services