Skip to content

Commit 70db5ba

Browse files
Aplly ruff/flake8-implicit-str-concat rule ISC003
ISC003 Explicitly concatenated string should be implicitly concatenated
1 parent e831839 commit 70db5ba

File tree

6 files changed

+14
-26
lines changed

6 files changed

+14
-26
lines changed

src/zarr/array.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ async def _write_chunk_to_store(
350350
async def resize(self, new_shape: ChunkCoords) -> AsyncArray:
351351
if len(new_shape) != len(self.metadata.shape):
352352
raise ValueError(
353-
"The new shape must have the same number of dimensions "
354-
+ f"(={len(self.metadata.shape)})."
353+
f"The new shape must have the same number of dimensions (={len(self.metadata.shape)})."
355354
)
356355

357356
new_metadata = replace(self.metadata, shape=new_shape)

src/zarr/codecs/crc32c_.py

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

src/zarr/codecs/pipeline.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,26 @@ def from_list(cls, codecs: List[Codec]) -> CodecPipeline:
6262
if prev_codec is not None:
6363
if isinstance(codec, ArrayBytesCodec) and isinstance(prev_codec, ArrayBytesCodec):
6464
raise ValueError(
65-
f"ArrayBytesCodec '{type(codec)}' cannot follow after "
66-
+ f"ArrayBytesCodec '{type(prev_codec)}' because exactly "
67-
+ "1 ArrayBytesCodec is allowed."
65+
f"ArrayBytesCodec '{type(codec)}' cannot follow after ArrayBytesCodec '{type(prev_codec)}' because exactly 1 ArrayBytesCodec is allowed."
6866
)
6967
if isinstance(codec, ArrayBytesCodec) and isinstance(prev_codec, BytesBytesCodec):
7068
raise ValueError(
71-
f"ArrayBytesCodec '{type(codec)}' cannot follow after "
72-
+ f"BytesBytesCodec '{type(prev_codec)}'."
69+
f"ArrayBytesCodec '{type(codec)}' cannot follow after BytesBytesCodec '{type(prev_codec)}'."
7370
)
7471
if isinstance(codec, ArrayArrayCodec) and isinstance(prev_codec, ArrayBytesCodec):
7572
raise ValueError(
76-
f"ArrayArrayCodec '{type(codec)}' cannot follow after "
77-
+ f"ArrayBytesCodec '{type(prev_codec)}'."
73+
f"ArrayArrayCodec '{type(codec)}' cannot follow after ArrayBytesCodec '{type(prev_codec)}'."
7874
)
7975
if isinstance(codec, ArrayArrayCodec) and isinstance(prev_codec, BytesBytesCodec):
8076
raise ValueError(
81-
f"ArrayArrayCodec '{type(codec)}' cannot follow after "
82-
+ f"BytesBytesCodec '{type(prev_codec)}'."
77+
f"ArrayArrayCodec '{type(codec)}' cannot follow after BytesBytesCodec '{type(prev_codec)}'."
8378
)
8479
prev_codec = codec
8580

8681
if any(isinstance(codec, ShardingCodec) for codec in codecs) and len(codecs) > 1:
8782
warn(
8883
"Combining a `sharding_indexed` codec disables partial reads and "
89-
+ "writes, which may lead to inefficient performance."
84+
"writes, which may lead to inefficient performance."
9085
)
9186

9287
return CodecPipeline(

src/zarr/codecs/sharding.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ def evolve(self, array_spec: ArraySpec) -> Self:
280280
def validate(self, array_metadata: ArrayMetadata) -> None:
281281
if len(self.chunk_shape) != array_metadata.ndim:
282282
raise ValueError(
283-
"The shard's `chunk_shape` and array's `shape` need to have the "
284-
+ "same number of dimensions."
283+
"The shard's `chunk_shape` and array's `shape` need to have the same number of dimensions."
285284
)
286285
if not isinstance(array_metadata.chunk_grid, RegularChunkGrid):
287286
raise ValueError("Sharding is only compatible with regular chunk grids.")
@@ -293,8 +292,7 @@ def validate(self, array_metadata: ArrayMetadata) -> None:
293292
)
294293
):
295294
raise ValueError(
296-
"The array's `chunk_shape` needs to be divisible by the "
297-
+ "shard's inner `chunk_shape`."
295+
"The array's `chunk_shape` needs to be divisible by the shard's inner `chunk_shape`."
298296
)
299297

300298
async def decode(

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
@@ -26,10 +26,9 @@ def __init__(self, url: Union[UPath, str], **storage_options: Dict[str, Any]):
2626
if isinstance(url, str):
2727
self.root = UPath(url, **storage_options)
2828
else:
29-
assert len(storage_options) == 0, (
30-
"If constructed with a UPath object, no additional "
31-
+ "storage_options are allowed."
32-
)
29+
assert (
30+
len(storage_options) == 0
31+
), "If constructed with a UPath object, no additional storage_options are allowed."
3332
self.root = url.rstrip("/")
3433
# test instantiate file system
3534
fs, _ = fsspec.core.url_to_fs(str(self.root), asynchronous=True, **self.root._kwargs)

0 commit comments

Comments
 (0)