diff --git a/src/zarr/core/indexing.py b/src/zarr/core/indexing.py index 723dadfb48..3d47f5f183 100644 --- a/src/zarr/core/indexing.py +++ b/src/zarr/core/indexing.py @@ -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}" ) diff --git a/src/zarr/errors.py b/src/zarr/errors.py index e6d416bcc6..5eb696d935 100644 --- a/src/zarr/errors.py +++ b/src/zarr/errors.py @@ -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." ) diff --git a/src/zarr/storage/common.py b/src/zarr/storage/common.py index 337fbc59a4..1317ab7983 100644 --- a/src/zarr/storage/common.py +++ b/src/zarr/storage/common.py @@ -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: """ diff --git a/src/zarr/storage/local.py b/src/zarr/storage/local.py index f8ff40d52f..a5d0f6429c 100644 --- a/src/zarr/storage/local.py +++ b/src/zarr/storage/local.py @@ -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 diff --git a/src/zarr/storage/memory.py b/src/zarr/storage/memory.py index a62c30ea36..85abe1697f 100644 --- a/src/zarr/storage/memory.py +++ b/src/zarr/storage/memory.py @@ -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 ( @@ -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: diff --git a/src/zarr/storage/zip.py b/src/zarr/storage/zip.py index bdae1b597b..968f81cdec 100644 --- a/src/zarr/storage/zip.py +++ b/src/zarr/storage/zip.py @@ -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