Skip to content

Commit fc8f9f1

Browse files
Apply ruff/flake8-return rule RET504
RET504 Unnecessary assignment before `return` statement
1 parent 5f0f62a commit fc8f9f1

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

src/zarr/core/buffer/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,9 @@ def all_equal(self, other: Any, equal_nan: bool = True) -> bool:
469469
return False
470470
# use array_equal to obtain equal_nan=True functionality
471471
data, other = np.broadcast_arrays(self._data, other)
472-
result = np.array_equal(
472+
return np.array_equal(
473473
self._data, other, equal_nan=equal_nan if self._data.dtype.kind not in "US" else False
474474
)
475-
return result
476475

477476
def fill(self, value: Any) -> None:
478477
self._data.fill(value)

tests/v3/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def path_type(request: pytest.FixtureRequest) -> Any:
4646
@pytest.fixture
4747
async def store_path(tmpdir: LEGACY_PATH) -> StorePath:
4848
store = await LocalStore.open(str(tmpdir), mode="w")
49-
p = StorePath(store)
50-
return p
49+
return StorePath(store)
5150

5251

5352
@pytest.fixture(scope="function")
@@ -88,13 +87,12 @@ async def async_group(request: pytest.FixtureRequest, tmpdir: LEGACY_PATH) -> As
8887
param: AsyncGroupRequest = request.param
8988

9089
store = await parse_store(param.store, str(tmpdir))
91-
agroup = await AsyncGroup.from_store(
90+
return await AsyncGroup.from_store(
9291
store,
9392
attributes=param.attributes,
9493
zarr_format=param.zarr_format,
9594
exists_ok=False,
9695
)
97-
return agroup
9896

9997

10098
@pytest.fixture(params=["numpy", "cupy"])

tests/v3/test_store/test_stateful_store.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,12 @@ def list(self) -> list:
4040
return self._sync_iter(self.store.list())
4141

4242
def get(self, key: str, prototype: BufferPrototype) -> zarr.core.buffer.Buffer:
43-
obs = self._sync(self.store.get(key, prototype=prototype))
44-
return obs
43+
return self._sync(self.store.get(key, prototype=prototype))
4544

4645
def get_partial_values(
4746
self, key_ranges: list, prototype: BufferPrototype
4847
) -> zarr.core.buffer.Buffer:
49-
obs_partial = self._sync(
50-
self.store.get_partial_values(prototype=prototype, key_ranges=key_ranges)
51-
)
52-
return obs_partial
48+
return self._sync(self.store.get_partial_values(prototype=prototype, key_ranges=key_ranges))
5349

5450
def delete(self, path: str) -> None:
5551
return self._sync(self.store.delete(path))

0 commit comments

Comments
 (0)