File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,10 @@ def calculate_md5(fpath: str, chunk_size: int = 1024 * 1024) -> str:
65
65
# Setting the `usedforsecurity` flag does not change anything about the functionality, but indicates that we are
66
66
# not using the MD5 checksum for cryptography. This enables its usage in restricted environments like FIPS. Without
67
67
# it torchvision.datasets is unusable in these environments since we perform a MD5 check everywhere.
68
- md5 = hashlib .md5 (** dict (usedforsecurity = False ) if sys .version_info >= (3 , 9 ) else dict ())
68
+ if sys .version_info >= (3 , 9 ):
69
+ md5 = hashlib .md5 (usedforsecurity = False )
70
+ else :
71
+ md5 = hashlib .md5 ()
69
72
with open (fpath , "rb" ) as f :
70
73
for chunk in iter (lambda : f .read (chunk_size ), b"" ):
71
74
md5 .update (chunk )
You can’t perform that action at this time.
0 commit comments