-
Notifications
You must be signed in to change notification settings - Fork 2
remove extra forward slashes #11
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
base: devel
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -121,8 +121,6 @@ normarg_zarr_group <- function(name, what1="'name'", | |
| stop(wmsg(what1, " cannot be the empty string")) | ||
| if (startsWith(name, "/")) { | ||
| name <- sub("^/*", "/", name) # only keep first leading slash | ||
| } else { | ||
| name <- paste0("/", name) | ||
|
Collaborator
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. The purpose of Personally I have a small preference for having the leading slash in the normalized group. This is consistent with what we do with the new BTW, I'm about to add a |
||
| } | ||
| name | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ test_that("ZarrRealizationSink()", { | |
| sink <- ZarrRealizationSink(c(85, 20, 300), zarr_version=zarr_version) | ||
| expect_true(is(sink, "ZarrRealizationSink")) | ||
| expect_true(is(sink, "RealizationSink")) | ||
| format <- ZarrArray:::get_zarr_format(paste0(sink@zarr_path, "/")) | ||
| format <- ZarrArray:::get_zarr_format(sink@zarr_path) | ||
|
Collaborator
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.
|
||
| expect_identical(format, zarr_version) | ||
| seed <- as(sink, "ZarrArraySeed") | ||
| expect_true(is(seed, "ZarrArraySeed")) | ||
|
|
||
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.
This is a good example of why normalization is important. If we know that
groupis guaranteed to always start with a single/, then the current code does the right thing. If we know thatgroupis guaranteed to never start with a/, then the current code no longer does the right thing but is easy to fix.But if
groupsometimes has the leading slash and sometimes not, then both, the current code and the proposed change are wrong.Additionally, the proposed change is wrong for another reason: this code tries to recognize datasets that belong to the
/layersgroup (in which case the dataset names are going to be of the form/layers/<dataset_name>e.g./layers/counts), but the proposed change will recognize datasets that belong to groups that start withlayers(e.g.layersalt), which is not what we want.