Skip to content

Commit 1362cc6

Browse files
committed
tidy up formatting of zarr.metadata api docs
1 parent 9f6b875 commit 1362cc6

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/zarr/metadata/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
from zarr.metadata.migrate_v3 import migrate_to_v3, migrate_v2_to_v3, remove_metadata
2-
3-
__all__ = ["migrate_to_v3", "migrate_v2_to_v3", "remove_metadata"]

src/zarr/metadata/migrate_v3.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import numcodecs.abc
66

77
import zarr
8+
from zarr import Array, Group
89
from zarr.abc.codec import ArrayArrayCodec, BytesBytesCodec, Codec
910
from zarr.abc.store import Store
1011
from zarr.codecs.blosc import BloscCodec, BloscShuffle
1112
from zarr.codecs.bytes import BytesCodec
1213
from zarr.codecs.gzip import GzipCodec
1314
from zarr.codecs.transpose import TransposeCodec
1415
from zarr.codecs.zstd import ZstdCodec
15-
from zarr.core.array import Array
1616
from zarr.core.buffer.core import default_buffer_prototype
1717
from zarr.core.chunk_key_encodings import V2ChunkKeyEncoding
1818
from zarr.core.common import (
@@ -25,14 +25,14 @@
2525
)
2626
from zarr.core.dtype.common import HasEndianness
2727
from zarr.core.dtype.wrapper import TBaseDType, TBaseScalar, ZDType
28-
from zarr.core.group import Group, GroupMetadata
28+
from zarr.core.group import GroupMetadata
2929
from zarr.core.metadata.v2 import ArrayV2Metadata
3030
from zarr.core.metadata.v3 import ArrayV3Metadata
3131
from zarr.core.sync import sync
3232
from zarr.registry import get_codec_class
3333
from zarr.storage import StorePath
3434

35-
logger = logging.getLogger(__name__)
35+
_logger = logging.getLogger(__name__)
3636

3737

3838
def migrate_v2_to_v3(
@@ -41,10 +41,10 @@ def migrate_v2_to_v3(
4141
output_store: Store | None = None,
4242
dry_run: bool = False,
4343
) -> None:
44-
"""Migrate all v2 metadata in a zarr hierarchy to v3.
44+
"""Migrate all v2 metadata in a Zarr store to v3.
4545
46-
This will create a zarr.json file at each level (for every group / array). v2 files (.zarray, .zattrs etc.)
47-
will be left as-is.
46+
This will create a zarr.json file at each level of a Zarr hierarchy (for every group / array).
47+
v2 files (.zarray, .zattrs etc.) will be left as-is.
4848
4949
Parameters
5050
----------
@@ -69,7 +69,7 @@ def migrate_v2_to_v3(
6969

7070

7171
def migrate_to_v3(zarr_v2: Array | Group, output_path: StorePath, dry_run: bool = False) -> None:
72-
"""Migrate all v2 metadata in a zarr array/group to v3.
72+
"""Migrate all v2 metadata in a Zarr array/group to v3.
7373
7474
Note - if a group is provided, then all arrays / groups within this group will also be converted.
7575
A zarr.json file will be created for each level and written to output_path, with any v2 files
@@ -141,7 +141,7 @@ async def remove_metadata(
141141
if force or await _metadata_exists(
142142
cast(Literal[2, 3], alternative_metadata), store_path / parent_path
143143
):
144-
logger.info("Deleting metadata at %s", store_path / file_path)
144+
_logger.info("Deleting metadata at %s", store_path / file_path)
145145
if not dry_run:
146146
awaitables.append((store_path / file_path).delete())
147147
else:
@@ -287,7 +287,7 @@ async def _save_v3_metadata(
287287
if await zarr_json_path.exists():
288288
raise ValueError(f"{ZARR_JSON} already exists at {zarr_json_path}")
289289

290-
logger.info("Saving metadata to %s", zarr_json_path)
290+
_logger.info("Saving metadata to %s", zarr_json_path)
291291
to_save = metadata_v3.to_buffer_dict(default_buffer_prototype())
292292

293293
if not dry_run:

0 commit comments

Comments
 (0)