Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify getsize to return total size, not just the top level #1815

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benjeffery
Copy link
Contributor

Fixes #253

TODO:

  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

for child in scandir(fs_path):
if child.is_file():
size += child.stat().st_size
for root, dirs, files in os.walk(fs_path):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also include the size of directories - these can be significant when there's a large number of files within a directory. The result here should be the same as du, which does take this into account.

@jeromekelleher
Copy link
Member

I guess it's worth asking what the fate of this will be for the v3 branch - if the code is just in as a short-lived bugfix that dies when we switch over the v3 then I'm not sure it's worth pushing through for our purposes @benjeffery

@benjeffery
Copy link
Contributor Author

benjeffery commented Apr 24, 2024

I guess it's worth asking what the fate of this will be for the v3 branch - if the code is just in as a short-lived bugfix that dies when we switch over the v3 then I'm not sure it's worth pushing through for our purposes @benjeffery

Yes, I'm not sure on the time scales here, so would be good to know. v3 behaviour is to report the total size as in this PR.

I'm missing some tests here that I didn't spot locally as they were skipped for optional deps, happy to patch those up if this looks like it's needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zarr DirectoryStore: getsize is wrong
2 participants