Skip to content

Commit 254b32c

Browse files
Remove .keys() when not necessary
1 parent d93d954 commit 254b32c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/zarr/core/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def parse_zarr_format(data: Any) -> ZarrFormat:
5151
def parse_attributes(data: Any) -> dict[str, Any]:
5252
if data is None:
5353
return {}
54-
elif isinstance(data, dict) and all(isinstance(v, str) for v in data.keys()):
54+
elif isinstance(data, dict) and all(isinstance(k, str) for k in data):
5555
return data
5656
msg = f"Expected dict with string keys. Got {type(data)} instead."
5757
raise TypeError(msg)

src/zarr/registry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def fully_qualified_name(cls: type) -> str:
107107

108108

109109
def register_codec(key: str, codec_cls: type[Codec]) -> None:
110-
if key not in __codec_registries.keys():
110+
if key not in __codec_registries:
111111
__codec_registries[key] = Registry()
112112
__codec_registries[key].register(codec_cls)
113113

@@ -158,7 +158,7 @@ def get_pipeline_class(reload_config: bool = False) -> type[CodecPipeline]:
158158
if pipeline_class:
159159
return pipeline_class
160160
raise BadConfigError(
161-
f"Pipeline class '{path}' not found in registered pipelines: {list(__pipeline_registry.keys())}."
161+
f"Pipeline class '{path}' not found in registered pipelines: {list(__pipeline_registry)}."
162162
)
163163

164164

@@ -172,7 +172,7 @@ def get_buffer_class(reload_config: bool = False) -> type[Buffer]:
172172
if buffer_class:
173173
return buffer_class
174174
raise BadConfigError(
175-
f"Buffer class '{path}' not found in registered buffers: {list(__buffer_registry.keys())}."
175+
f"Buffer class '{path}' not found in registered buffers: {list(__buffer_registry)}."
176176
)
177177

178178

@@ -185,7 +185,7 @@ def get_ndbuffer_class(reload_config: bool = False) -> type[NDBuffer]:
185185
if ndbuffer_class:
186186
return ndbuffer_class
187187
raise BadConfigError(
188-
f"NDBuffer class '{path}' not found in registered buffers: {list(__ndbuffer_registry.keys())}."
188+
f"NDBuffer class '{path}' not found in registered buffers: {list(__ndbuffer_registry)}."
189189
)
190190

191191

0 commit comments

Comments
 (0)