-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Changes from 5 commits
c57e862
9f82cd6
ba72bdd
9e587ea
e2e6c83
ab3e111
3db2642
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix a bug that prevented the number of initialized chunks being counted properly. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,11 +74,60 @@ | |
| """ | ||
| Filter out instances of '' and join the remaining strings with '/'. | ||
|
|
||
| Because the root node of a zarr hierarchy is represented by an empty string, | ||
| Parameters | ||
| ---------- | ||
| paths : Iterable[str] | ||
|
|
||
| Returns | ||
| ------- | ||
| str | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> _join_paths(["", "a", "b"]) | ||
| 'a/b' | ||
| >>> _join_paths(["a", "b", "c"]) | ||
| 'a/b/c' | ||
| """ | ||
| 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 | ||
| returned as-is. Otherwise, the prefix is removed from the path as well as the separator | ||
| string "\". | ||
|
|
||
| If ``prefix`` is not the empty string and ``path`` does not start with ``prefix`` | ||
| followed by a "/" character, then an error is raised. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| path : str | ||
| The path to make relative to the prefix. | ||
| prefix : str | ||
| The prefix to make relative to. | ||
|
|
||
| Returns | ||
| ------- | ||
| str | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> _relativize_paths("", "a/b") | ||
| 'a/b' | ||
| >>> _relativize_paths("a/b", "a/b/c") | ||
| 'c' | ||
| """ | ||
| if prefix == "": | ||
| return path | ||
| else: | ||
| _prefix = prefix + "/" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What behavior do we want for IIUC, this will currently always raise a Maybe we should have There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| if not path.startswith(_prefix): | ||
| raise ValueError(f"The first component of {path} does not start with {prefix}.") | ||
| return path.removeprefix(f"{prefix}/") | ||
|
|
||
|
|
||
| def _normalize_paths(paths: Iterable[str]) -> tuple[str, ...]: | ||
| """ | ||
| Normalize the input paths according to the normalization scheme used for zarr node paths. | ||
|
|
||
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
"\"-delimitedright 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