Skip to content

Commit f092351

Browse files
Apply assorted ruff/Pylint rules (PLR) (#2371)
* Apply ruff/Pylint rule PLR1711 PLR1711 Useless `return` statement at end of function * Apply ruff/Pylint rule PLR2044 PLR2044 Line with empty comment * Apply ruff/Pylint rule PLR6104 PLR6104 Use `+=`, `*=`, `/=` to perform an augmented assignment directly --------- Co-authored-by: Joe Hamman <[email protected]>
1 parent 4a097e1 commit f092351

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

src/zarr/abc/store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ async def _set_many(self, values: Iterable[tuple[str, Buffer]]) -> None:
284284
Insert multiple (key, value) pairs into storage.
285285
"""
286286
await gather(*starmap(self.set, values))
287-
return
288287

289288
@property
290289
@abstractmethod

src/zarr/codecs/sharding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def create_empty(
252252
def __setitem__(self, chunk_coords: ChunkCoords, value: Buffer) -> None:
253253
chunk_start = len(self.buf)
254254
chunk_length = len(value)
255-
self.buf = self.buf + value
255+
self.buf += value
256256
self.index.set_chunk_slice(chunk_coords, slice(chunk_start, chunk_start + chunk_length))
257257

258258
def __delitem__(self, chunk_coords: ChunkCoords) -> None:

src/zarr/core/indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def check(a: npt.NDArray[Any]) -> Order:
675675
def wraparound_indices(x: npt.NDArray[Any], dim_len: int) -> None:
676676
loc_neg = x < 0
677677
if np.any(loc_neg):
678-
x[loc_neg] = x[loc_neg] + dim_len
678+
x[loc_neg] += dim_len
679679

680680

681681
def boundscheck_indices(x: npt.NDArray[Any], dim_len: int) -> None:
@@ -1000,8 +1000,8 @@ def __init__(
10001000
if stop < 0:
10011001
stop = dim_numchunks + stop
10021002

1003-
start = start * dim_chunk_size
1004-
stop = stop * dim_chunk_size
1003+
start *= dim_chunk_size
1004+
stop *= dim_chunk_size
10051005
slice_ = slice(start, stop)
10061006

10071007
else:

tests/test_codecs/test_sharding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test_sharding_partial_overwrite(
229229
read_data = a[0:10, 0:10, 0:10]
230230
assert np.array_equal(data, read_data)
231231

232-
data = data + 10
232+
data += 10
233233
a[:10, :10, :10] = data
234234
read_data = a[0:10, 0:10, 0:10]
235235
assert np.array_equal(data, read_data)

tests/test_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_open_positional_args_deprecate():
147147
zarr.open(store, "w", shape=(1,))
148148

149149

150-
@pytest.mark.parametrize("workers", [None, 1, 2]) #
150+
@pytest.mark.parametrize("workers", [None, 1, 2])
151151
def test_get_executor(clean_state, workers) -> None:
152152
with zarr.config.set({"threading.max_workers": workers}):
153153
e = _get_executor()

0 commit comments

Comments
 (0)