mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Fix for older python versions
The "walrus" operator is only available in python 3.8 and later. Fall back to more traditional notation.
This commit is contained in:
parent
7b764f183e
commit
545a5a75fb
@ -138,8 +138,13 @@ class File:
|
|||||||
try:
|
try:
|
||||||
with self.path.open("rb") as fp:
|
with self.path.open("rb") as fp:
|
||||||
md5 = hashlib.md5()
|
md5 = hashlib.md5()
|
||||||
while filedata := fp.read(CHUNK_SIZE):
|
filedata = fp.read(CHUNK_SIZE)
|
||||||
|
while filedata:
|
||||||
md5.update(filedata)
|
md5.update(filedata)
|
||||||
|
filedata = fp.read(CHUNK_SIZE)
|
||||||
|
# FIXME For python 3.8 and later
|
||||||
|
# while filedata := fp.read(CHUNK_SIZE):
|
||||||
|
# md5.update(filedata)
|
||||||
self.md5 = md5.digest()
|
self.md5 = md5.digest()
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user