Skip to content

Commit dd2f5ce

Browse files
Apply ruff/flake8-simplify rule SIM103
SIM103 Return the condition directly
1 parent e968ac5 commit dd2f5ce

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/zarr/core/indexing.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ def is_scalar(value: Any, dtype: np.dtype[Any]) -> bool:
138138
return True
139139
if hasattr(value, "shape") and value.shape == ():
140140
return True
141-
if isinstance(value, tuple) and dtype.names and len(value) == len(dtype.names):
142-
return True
143-
return False
141+
return isinstance(value, tuple) and dtype.names is not None and len(value) == len(dtype.names)
144142

145143

146144
def is_pure_fancy_indexing(selection: Any, ndim: int) -> bool:

src/zarr/store/zip.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ async def clear(self) -> None:
110110

111111
async def empty(self) -> bool:
112112
with self._lock:
113-
if self._zf.namelist():
114-
return False
115-
else:
116-
return True
113+
return not self._zf.namelist()
117114

118115
def __str__(self) -> str:
119116
return f"zip://{self.path}"

0 commit comments

Comments
 (0)