Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
f82a4675
"vscode:/vscode.git/clone" did not exist on "f0c94cdcd848c62bd75e9fcb9492950fbe5689f8"
Unverified
Commit
f82a4675
authored
Aug 25, 2022
by
vfdev
Committed by
GitHub
Aug 25, 2022
Browse files
Try to fix mypy issue with calculate_md5 (#6493)
parent
0eb8aabd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
torchvision/datasets/utils.py
torchvision/datasets/utils.py
+4
-1
No files found.
torchvision/datasets/utils.py
View file @
f82a4675
...
...
@@ -65,7 +65,10 @@ def calculate_md5(fpath: str, chunk_size: int = 1024 * 1024) -> str:
# Setting the `usedforsecurity` flag does not change anything about the functionality, but indicates that we are
# not using the MD5 checksum for cryptography. This enables its usage in restricted environments like FIPS. Without
# it torchvision.datasets is unusable in these environments since we perform a MD5 check everywhere.
md5
=
hashlib
.
md5
(
**
dict
(
usedforsecurity
=
False
)
if
sys
.
version_info
>=
(
3
,
9
)
else
dict
())
if
sys
.
version_info
>=
(
3
,
9
):
md5
=
hashlib
.
md5
(
usedforsecurity
=
False
)
else
:
md5
=
hashlib
.
md5
()
with
open
(
fpath
,
"rb"
)
as
f
:
for
chunk
in
iter
(
lambda
:
f
.
read
(
chunk_size
),
b
""
):
md5
.
update
(
chunk
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment