Skip to content

Commit

Permalink
Merge branch 'refactor/store-mode' of github.com:jhamman/zarr-python …
Browse files Browse the repository at this point in the history
…into refactor/store-mode
  • Loading branch information
jhamman committed Nov 12, 2024
2 parents a0c86c5 + af30833 commit ebe8b67
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
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 @@ -206,7 +206,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 @@ -116,7 +116,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 @@ -62,7 +62,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 @@ -203,7 +203,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 @@ -129,7 +129,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
2 changes: 1 addition & 1 deletion src/zarr/testing/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def arrays(
expected_attrs = {} if attributes is None else attributes

array_path = path + ("/" if not path.endswith("/") else "") + name
root = zarr.open_group(store, mode="w")
root = zarr.open_group(store, mode="w", zarr_format=zarr_format)

a = root.create_array(
array_path,
Expand Down

0 comments on commit ebe8b67

Please sign in to comment.