Skip to content

Commit 8891985

Browse files
Explicitly add single quotes instead of using "!r"
Successive `str` and `repr` conversions? If there is a need for quotes, explictly use quotes.
1 parent 00832c1 commit 8891985

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/zarr/storage/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __str__(self) -> str:
140140
return _dereference_path(str(self.store), self.path)
141141

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

145145
def __eq__(self, other: object) -> bool:
146146
"""

src/zarr/storage/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __str__(self) -> str:
135135
return f"file://{self.root.as_posix()}"
136136

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

140140
def __eq__(self, other: object) -> bool:
141141
return isinstance(other, type(self)) and self.root == other.root

src/zarr/storage/memory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __str__(self) -> str:
7171
return f"memory://{id(self._store_dict)}"
7272

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

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

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

215215
@classmethod
216216
def from_dict(cls, store_dict: MutableMapping[str, Buffer]) -> Self:

src/zarr/storage/zip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __str__(self) -> str:
134134
return f"zip://{self.path}"
135135

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

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

0 commit comments

Comments
 (0)