Skip to content

Commit 280daac

Browse files
Upgrade ruff to 0.9.1 (#2703)
* Apply ruff rule RUF100 RUF100 Unused `noqa` directive (unused: `E402`) Otherwise, latest ruff 0.9.1 complains. * Enable ruff/flake8-implicit-str-concat rules ISC001 and ISC002 Starting with ruff 0.9.1, they are documented to be compatible with the ruff formatter, if they are both enabled. * Run `ruff format` * Upgrade ruff to 0.9.1
1 parent cef2b24 commit 280daac

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ci:
66
default_stages: [pre-commit, pre-push]
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.8.6
9+
rev: v0.9.1
1010
hooks:
1111
- id: ruff
1212
args: ["--fix", "--show-fixes"]

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,6 @@ ignore = [
326326
"Q003",
327327
"COM812",
328328
"COM819",
329-
"ISC001",
330-
"ISC002",
331329
]
332330

333331
[tool.ruff.lint.extend-per-file-ignores]

src/zarr/codecs/sharding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ async def get(
8686
self, prototype: BufferPrototype, byte_range: ByteRequest | None = None
8787
) -> Buffer | None:
8888
assert byte_range is None, "byte_range is not supported within shards"
89-
assert (
90-
prototype == default_buffer_prototype()
91-
), f"prototype is not supported within shards currently. diff: {prototype} != {default_buffer_prototype()}"
89+
assert prototype == default_buffer_prototype(), (
90+
f"prototype is not supported within shards currently. diff: {prototype} != {default_buffer_prototype()}"
91+
)
9292
return self.shard_dict.get(self.chunk_coords)
9393

9494

src/zarr/core/indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ def is_pure_orthogonal_indexing(selection: Selection, ndim: int) -> TypeGuard[Or
289289
def get_chunk_shape(chunk_grid: ChunkGrid) -> ChunkCoords:
290290
from zarr.core.chunk_grids import RegularChunkGrid
291291

292-
assert isinstance(
293-
chunk_grid, RegularChunkGrid
294-
), "Only regular chunk grid is supported, currently."
292+
assert isinstance(chunk_grid, RegularChunkGrid), (
293+
"Only regular chunk grid is supported, currently."
294+
)
295295
return chunk_grid.chunk_shape
296296

297297

src/zarr/core/metadata/v3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ def inner_codecs(self) -> tuple[Codec, ...]:
373373
def get_chunk_spec(
374374
self, _chunk_coords: ChunkCoords, array_config: ArrayConfig, prototype: BufferPrototype
375375
) -> ArraySpec:
376-
assert isinstance(
377-
self.chunk_grid, RegularChunkGrid
378-
), "Currently, only regular chunk grid is supported"
376+
assert isinstance(self.chunk_grid, RegularChunkGrid), (
377+
"Currently, only regular chunk grid is supported"
378+
)
379379
return ArraySpec(
380380
shape=self.chunk_grid.chunk_shape,
381381
dtype=self.dtype,

tests/test_properties.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
pytest.importorskip("hypothesis")
66

7-
import hypothesis.extra.numpy as npst # noqa: E402
8-
import hypothesis.strategies as st # noqa: E402
9-
from hypothesis import given # noqa: E402
7+
import hypothesis.extra.numpy as npst
8+
import hypothesis.strategies as st
9+
from hypothesis import given
1010

11-
from zarr.testing.strategies import arrays, basic_indices, numpy_arrays, zarr_formats # noqa: E402
11+
from zarr.testing.strategies import arrays, basic_indices, numpy_arrays, zarr_formats
1212

1313

1414
@given(data=st.data(), zarr_format=zarr_formats)

0 commit comments

Comments
 (0)