-
-
Notifications
You must be signed in to change notification settings - Fork 331
fix/unbreak chunks initialized #2862
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
fix/unbreak chunks initialized #2862
Conversation
c7eaeb0
to
c57e862
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for handling this. A couple small questions, but I think this looks good.
src/zarr/storage/_utils.py
Outdated
""" | ||
return "/".join(filter(lambda v: v != "", paths)) | ||
|
||
|
||
def _relativize_path(path: str, prefix: str) -> str: | ||
""" | ||
Make a "\"-delimited path relative to some prefix. If the prefix is '', then the path is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "\"-delimited
right here, or should this be "/"-delimited
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, ""-delimited is not correct, and it should be the other one
if prefix == "": | ||
return path | ||
else: | ||
_prefix = prefix + "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What behavior do we want for prefix="<some-prefix>/"
, i.e. a prefix ending with a /
?
IIUC, this will currently always raise a ValueError
, unless path
for some reason starts with <some-prefix>//
Maybe we should have _prefix = prefix.rstrip("/") + "/"
? Or if you're confident the callers are careful about not providing a prefix with a trailing slash this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was assuming here that paths have already been normalized by normalize_path
, in which case prefixes cannot end with "/"
. I should make this explicit in the docstring for the function here.
Co-authored-by: Tom Augspurger <[email protected]>
Sounds good, thanks. It looks like the codecov failure might be legitimate, so good to go once that's fixed. |
fixes #2861 by making extant prefixes relative before comparing them to the list of chunk names.
some odd noise in the commit log here, but these are all commits that landed in main so I don't think it's a problem.