Skip to content

Commit 4bd6880

Browse files
DimitriPapadopoulosd-v-bjhamman
committed
Single startswith() call instead of multiple ones (zarr-developers#1556)
It's faster and probably more readable. Co-authored-by: Davis Bennett <[email protected]> Co-authored-by: Joe Hamman <[email protected]>
1 parent b67adc9 commit 4bd6880

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

zarr/_storage/store.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,8 @@ def _validate_key(self, key: str):
221221
)
222222

223223
if (
224-
not key.startswith("data/")
225-
and (not key.startswith("meta/"))
226-
and (not key == "zarr.json")
224+
not key.startswith(("data/", "meta/"))
225+
and key != "zarr.json"
227226
# TODO: Possibly allow key == ".zmetadata" too if we write a
228227
# consolidated metadata spec corresponding to this?
229228
):

0 commit comments

Comments
 (0)