Skip to content

Assorted small fixes for f-strings #2477

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

Merged
merged 2 commits into from
Nov 11, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/zarr/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class VindexInvalidSelectionError(IndexError):
_msg = (
"unsupported selection type for vectorized indexing; only "
"coordinate selection (tuple of integer arrays) and mask selection "
"(single Boolean array) are supported; got {0!r}"
"(single Boolean array) are supported; got {!r}"
)


Expand Down
6 changes: 3 additions & 3 deletions src/zarr/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ def __init__(self, *args: Any) -> None:


class ContainsGroupError(_BaseZarrError):
_msg = "A group exists in store {0!r} at path {1!r}."
_msg = "A group exists in store {!r} at path {!r}."


class ContainsArrayError(_BaseZarrError):
_msg = "An array exists in store {0!r} at path {1!r}."
_msg = "An array exists in store {!r} at path {!r}."


class ContainsArrayAndGroupError(_BaseZarrError):
_msg = (
"Array and group metadata documents (.zarray and .zgroup) were both found in store "
"{0!r} at path {1!r}."
"{!r} at path {!r}. "
"Only one of these files may be present in a given directory / prefix. "
"Remove the .zarray file, or the .zgroup file, or both."
)
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/storage/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __str__(self) -> str:
return _dereference_path(str(self.store), self.path)

def __repr__(self) -> str:
return f"StorePath({self.store.__class__.__name__}, {str(self)!r})"
return f"StorePath({self.store.__class__.__name__}, '{self}')"

def __eq__(self, other: object) -> bool:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/storage/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __str__(self) -> str:
return f"file://{self.root.as_posix()}"

def __repr__(self) -> str:
return f"LocalStore({str(self)!r})"
return f"LocalStore('{self}')"

def __eq__(self, other: object) -> bool:
return isinstance(other, type(self)) and self.root == other.root
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/storage/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __str__(self) -> str:
return f"memory://{id(self._store_dict)}"

def __repr__(self) -> str:
return f"MemoryStore({str(self)!r})"
return f"MemoryStore('{self}')"

def __eq__(self, other: object) -> bool:
return (
Expand Down Expand Up @@ -210,7 +210,7 @@ def __str__(self) -> str:
return f"gpumemory://{id(self._store_dict)}"

def __repr__(self) -> str:
return f"GpuMemoryStore({str(self)!r})"
return f"GpuMemoryStore('{self}')"

@classmethod
def from_dict(cls, store_dict: MutableMapping[str, Buffer]) -> Self:
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/storage/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __str__(self) -> str:
return f"zip://{self.path}"

def __repr__(self) -> str:
return f"ZipStore({str(self)!r})"
return f"ZipStore('{self}')"

def __eq__(self, other: object) -> bool:
return isinstance(other, type(self)) and self.path == other.path
Expand Down