Skip to content

Commit 5d0073e

Browse files
Aplly ruff/flake8-implicit-str-concat rule ISC003
ISC003 Explicitly concatenated string should be implicitly concatenated
1 parent 517a943 commit 5d0073e

File tree

5 files changed

+13
-24
lines changed

5 files changed

+13
-24
lines changed

src/zarr/codecs/crc32c_.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ async def decode_single(
4242
stored_checksum = bytes(crc32_bytes)
4343
if computed_checksum != stored_checksum:
4444
raise ValueError(
45-
"Stored and computed checksum do not match. "
46-
+ f"Stored: {stored_checksum!r}. Computed: {computed_checksum!r}."
45+
f"Stored and computed checksum do not match. Stored: {stored_checksum!r}. Computed: {computed_checksum!r}."
4746
)
4847
return Buffer.from_array_like(inner_bytes)
4948

src/zarr/codecs/pipeline.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,31 +104,26 @@ def codecs_from_list(
104104
if prev_codec is not None:
105105
if isinstance(codec, ArrayBytesCodec) and isinstance(prev_codec, ArrayBytesCodec):
106106
raise ValueError(
107-
f"ArrayBytesCodec '{type(codec)}' cannot follow after "
108-
+ f"ArrayBytesCodec '{type(prev_codec)}' because exactly "
109-
+ "1 ArrayBytesCodec is allowed."
107+
f"ArrayBytesCodec '{type(codec)}' cannot follow after ArrayBytesCodec '{type(prev_codec)}' because exactly 1 ArrayBytesCodec is allowed."
110108
)
111109
if isinstance(codec, ArrayBytesCodec) and isinstance(prev_codec, BytesBytesCodec):
112110
raise ValueError(
113-
f"ArrayBytesCodec '{type(codec)}' cannot follow after "
114-
+ f"BytesBytesCodec '{type(prev_codec)}'."
111+
f"ArrayBytesCodec '{type(codec)}' cannot follow after BytesBytesCodec '{type(prev_codec)}'."
115112
)
116113
if isinstance(codec, ArrayArrayCodec) and isinstance(prev_codec, ArrayBytesCodec):
117114
raise ValueError(
118-
f"ArrayArrayCodec '{type(codec)}' cannot follow after "
119-
+ f"ArrayBytesCodec '{type(prev_codec)}'."
115+
f"ArrayArrayCodec '{type(codec)}' cannot follow after ArrayBytesCodec '{type(prev_codec)}'."
120116
)
121117
if isinstance(codec, ArrayArrayCodec) and isinstance(prev_codec, BytesBytesCodec):
122118
raise ValueError(
123-
f"ArrayArrayCodec '{type(codec)}' cannot follow after "
124-
+ f"BytesBytesCodec '{type(prev_codec)}'."
119+
f"ArrayArrayCodec '{type(codec)}' cannot follow after BytesBytesCodec '{type(prev_codec)}'."
125120
)
126121
prev_codec = codec
127122

128123
if any(isinstance(codec, ShardingCodec) for codec in codecs) and len(codecs) > 1:
129124
warn(
130125
"Combining a `sharding_indexed` codec disables partial reads and "
131-
+ "writes, which may lead to inefficient performance.",
126+
"writes, which may lead to inefficient performance.",
132127
stacklevel=3,
133128
)
134129

src/zarr/codecs/sharding.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ def evolve(self, array_spec: ArraySpec) -> Self:
360360
def validate(self, array_metadata: ArrayMetadata) -> None:
361361
if len(self.chunk_shape) != array_metadata.ndim:
362362
raise ValueError(
363-
"The shard's `chunk_shape` and array's `shape` need to have the "
364-
+ "same number of dimensions."
363+
"The shard's `chunk_shape` and array's `shape` need to have the same number of dimensions."
365364
)
366365
if not isinstance(array_metadata.chunk_grid, RegularChunkGrid):
367366
raise ValueError("Sharding is only compatible with regular chunk grids.")
@@ -374,8 +373,7 @@ def validate(self, array_metadata: ArrayMetadata) -> None:
374373
)
375374
):
376375
raise ValueError(
377-
"The array's `chunk_shape` needs to be divisible by the "
378-
+ "shard's inner `chunk_shape`."
376+
"The array's `chunk_shape` needs to be divisible by the shard's inner `chunk_shape`."
379377
)
380378

381379
async def decode_single(

src/zarr/codecs/transpose.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,15 @@ def to_dict(self) -> dict[str, JSON]:
4545
def evolve(self, array_spec: ArraySpec) -> Self:
4646
if len(self.order) != array_spec.ndim:
4747
raise ValueError(
48-
"The `order` tuple needs have as many entries as "
49-
+ f"there are dimensions in the array. Got {self.order}."
48+
f"The `order` tuple needs have as many entries as there are dimensions in the array. Got {self.order}."
5049
)
5150
if len(self.order) != len(set(self.order)):
5251
raise ValueError(
5352
f"There must not be duplicates in the `order` tuple. Got {self.order}."
5453
)
5554
if not all(0 <= x < array_spec.ndim for x in self.order):
5655
raise ValueError(
57-
"All entries in the `order` tuple must be between 0 and "
58-
+ f"the number of dimensions in the array. Got {self.order}."
56+
f"All entries in the `order` tuple must be between 0 and the number of dimensions in the array. Got {self.order}."
5957
)
6058
order = tuple(self.order)
6159

src/zarr/store/remote.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ def __init__(self, url: UPath | str, **storage_options: dict[str, Any]):
2525
if isinstance(url, str):
2626
self.root = UPath(url, **storage_options)
2727
else:
28-
assert len(storage_options) == 0, (
29-
"If constructed with a UPath object, no additional "
30-
+ "storage_options are allowed."
31-
)
28+
assert (
29+
len(storage_options) == 0
30+
), "If constructed with a UPath object, no additional storage_options are allowed."
3231
self.root = url.rstrip("/")
3332
# test instantiate file system
3433
fs, _ = fsspec.core.url_to_fs(str(self.root), asynchronous=True, **self.root._kwargs)

0 commit comments

Comments
 (0)