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 <[email protected]>
Co-authored-by: Joe Hamman <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent 10dee6b commit 40a6e81
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 40a6e81

Please sign in to comment.