Skip to content

Enable ruff/flake8-implicit-str-concat rules (ISC) and fix issues #1837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Docs
Maintenance
~~~~~~~~~~~

* Enable ruff/flake8-implicit-str-concat rules (ISC) and fix issues.
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1837`.

Deprecations
~~~~~~~~~~~~

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ exclude = [

[tool.ruff.lint]
extend-select = [
"B"
"B",
"ISC"
]

[tool.black]
Expand Down
8 changes: 4 additions & 4 deletions zarr/_storage/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ def set_partial_values(self, key_start_values):
if start > len(values[key]): # pragma: no cover
raise ValueError(
f"Cannot set value at start {start}, "
+ f"since it is beyond the data at key {key}, "
+ f"having length {len(values[key])}."
f"since it is beyond the data at key {key}, "
f"having length {len(values[key])}."
)
if start < 0:
values[key][start:] = value
Expand Down Expand Up @@ -434,7 +434,7 @@ def __init__(self, _type) -> None:
if _type not in self.valid_types: # pragma: no cover
raise ValueError(
f"Storage transformer cannot be initialized with type {_type}, "
+ f"must be one of {list(self.valid_types)}."
f"must be one of {list(self.valid_types)}."
)
self.type = _type
self._inner_store = None
Expand Down Expand Up @@ -581,7 +581,7 @@ def _path_to_prefix(path: Optional[str]) -> str:
def _get_hierarchy_metadata(store: StoreV3) -> Mapping[str, Any]:
version = getattr(store, "_store_version", 2)
if version < 3:
raise ValueError("zarr.json hierarchy metadata not stored for " f"zarr v{version} stores")
raise ValueError(f"zarr.json hierarchy metadata not stored for zarr v{version} stores")
if "zarr.json" not in store:
raise ValueError("zarr.json metadata not found in store")
return store._metadata_class.decode_hierarchy_metadata(store["zarr.json"])
Expand Down
10 changes: 3 additions & 7 deletions zarr/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,7 @@ class BoolArrayDimIndexer:
def __init__(self, dim_sel, dim_len, dim_chunk_len):
# check number of dimensions
if not is_bool_array(dim_sel, 1):
raise IndexError(
"Boolean arrays in an orthogonal selection must " "be 1-dimensional only"
)
raise IndexError("Boolean arrays in an orthogonal selection must be 1-dimensional only")

# check shape
if dim_sel.shape[0] != dim_len:
Expand Down Expand Up @@ -463,9 +461,7 @@ def __init__(
# ensure 1d array
dim_sel = np.asanyarray(dim_sel)
if not is_integer_array(dim_sel, 1):
raise IndexError(
"integer arrays in an orthogonal selection must be " "1-dimensional only"
)
raise IndexError("integer arrays in an orthogonal selection must be 1-dimensional only")

# handle wraparound
if wraparound:
Expand Down Expand Up @@ -919,7 +915,7 @@ def check_fields(fields, dtype):
# check type
if not isinstance(fields, (str, list, tuple)):
raise IndexError(
f"'fields' argument must be a string or list of strings; found " f"{type(fields)!r}"
f"'fields' argument must be a string or list of strings; found {type(fields)!r}"
)
if fields:
if dtype.names is None:
Expand Down