Skip to content

Commit 18af72c

Browse files
kuishou68lsteinPfannkuchensack
authored
fix: remove directory entry sizes from directory_size() to report accurate file totals (#9040)
* fix: remove dir entry sizes from directory_size() (Closes #9039) * fix: replace unused 'dirs' variable with '_' to resolve ruff F841 linting error --------- Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Alexander Eichhorn <alex@eichhorn.dev>
1 parent e521817 commit 18af72c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

invokeai/backend/util/util.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ def directory_size(directory: Path) -> int:
4040
Return the aggregate size of all files in a directory (bytes).
4141
"""
4242
sum = 0
43-
for root, dirs, files in os.walk(directory):
43+
for root, _, files in os.walk(directory):
4444
for f in files:
4545
sum += Path(root, f).stat().st_size
46-
for d in dirs:
47-
sum += Path(root, d).stat().st_size
4846
return sum
4947

5048

0 commit comments

Comments
 (0)