Skip to content

Commit 40a6e81

Browse files
DimitriPapadopoulosd-v-bjhamman
authored
Single startswith() call instead of multiple ones (#1556)
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>
1 parent 10dee6b commit 40a6e81

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)