Skip to content

Commit

Permalink
Merge pull request #312 from DimitriPapadopoulos/isinstance_startswith
Browse files Browse the repository at this point in the history
Simpler startswith() and isinstance() calls
  • Loading branch information
will-moore authored Sep 29, 2023
2 parents d8e86f1 + 395a340 commit 652cd8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ome_zarr/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def init_store(self, path: str, mode: str = "r") -> FSStore:
}

mkdir = True
if "r" in mode or path.startswith("http") or path.startswith("s3"):
if "r" in mode or path.startswith(("http", "s3")):
# Could be simplified on the fsspec side
mkdir = False
if mkdir:
Expand Down
4 changes: 2 additions & 2 deletions ome_zarr/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
self.zarr = zarr
self.root = root
self.seen: List[ZarrLocation] = []
if isinstance(root, Node) or isinstance(root, Reader):
if isinstance(root, (Node, Reader)):
self.seen = root.seen
else:
self.seen = cast(List[ZarrLocation], root)
Expand Down Expand Up @@ -235,7 +235,7 @@ def __init__(self, node: Node) -> None:
if rgba:
rgba = [x / 255 for x in rgba]

if isinstance(label_value, bool) or isinstance(label_value, int):
if isinstance(label_value, (bool, int)):
colors[label_value] = rgba
else:
raise Exception("not bool or int")
Expand Down

0 comments on commit 652cd8b

Please sign in to comment.