Skip to content

Commit 33a5e82

Browse files
committed
fix:revert code optimisation affecting hash generation
1 parent 624b563 commit 33a5e82

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/stubber/publish/stubpacker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def clean(self) -> None:
419419
f.unlink()
420420

421421
def create_hash(self, include_md:bool=True) -> str:
422+
# sourcery skip: reintroduce-else, swap-if-else-branches, use-named-expression
422423
"""
423424
Create a SHA1 hash of all files in the package, excluding the pyproject.toml file itself.
424425
the hash is based on the content of the .py/.pyi and .md files in the package.
@@ -442,11 +443,11 @@ def create_hash(self, include_md:bool=True) -> str:
442443
for file in sorted(files):
443444
with open(file, "rb") as f:
444445
while True:
445-
if data := f.read(BUF_SIZE):
446-
pkg_hash.update(data)
447-
448-
else:
446+
data = f.read(BUF_SIZE)
447+
if not data:
449448
break
449+
pkg_hash.update(data)
450+
450451
return pkg_hash.hexdigest()
451452

452453
def update_hashes(self) -> None:

0 commit comments

Comments
 (0)