Skip to content

Commit

Permalink
Remove .keys() when not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Sep 6, 2024
1 parent 7c33fae commit d26f5d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/zarr/core/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def parse_zarr_format(data: Any) -> ZarrFormat:
def parse_attributes(data: Any) -> dict[str, Any]:
if data is None:
return {}
elif isinstance(data, dict) and all(isinstance(v, str) for v in data.keys()):
elif isinstance(data, dict) and all(isinstance(k, str) for k in data):
return data
msg = f"Expected dict with string keys. Got {type(data)} instead."
raise TypeError(msg)
Expand Down
8 changes: 4 additions & 4 deletions src/zarr/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def fully_qualified_name(cls: type) -> str:


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

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


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


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


Expand Down

0 comments on commit d26f5d3

Please sign in to comment.