Skip to content

Commit

Permalink
Single startswith() call instead of multiple ones (zarr-developers#1556)
Browse files Browse the repository at this point in the history
It's faster and probably more readable.

Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
Co-authored-by: Joe Hamman <joe@earthmover.io>
  • Loading branch information
3 people committed Jan 24, 2024
1 parent b67adc9 commit 4bd6880
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions zarr/_storage/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ def _validate_key(self, key: str):
)

if (
not key.startswith("data/")
and (not key.startswith("meta/"))
and (not key == "zarr.json")
not key.startswith(("data/", "meta/"))
and key != "zarr.json"
# TODO: Possibly allow key == ".zmetadata" too if we write a
# consolidated metadata spec corresponding to this?
):
Expand Down

0 comments on commit 4bd6880

Please sign in to comment.