# Path: zarr/_storage/store.py
# class Store(BaseStore):
#     """Abstract store class used by implementations following the Zarr v2 spec.
# 
#     Adds public `listdir`, `rename`, and `rmdir` methods on top of BaseStore.
# 
#     .. added: 2.11.0
# 
#     """
# 
#     def listdir(self, path: str = "") -> List[str]:
#         path = normalize_storage_path(path)
#         return _listdir_from_keys(self, path)
# 
#     def rmdir(self, path: str = "") -> None:
#         if not self.is_erasable():
#             raise NotImplementedError(
#                 f'{type(self)} is not erasable, cannot call "rmdir"'
#             )  # pragma: no cover
#         path = normalize_storage_path(path)
#         _rmdir_from_keys(self, path)
# 
# Path: zarr/util.py
# def json_dumps(o: Any) -> bytes:
#     """Write JSON in a consistent, human-readable way."""
#     return json.dumps(o, indent=4, sort_keys=True, ensure_ascii=True,
#                       separators=(',', ': ')).encode('ascii')


from collections.abc import MutableMapping
from zarr._storage.store import Store
from zarr.util import json_dumps



class Attributes(MutableMapping):
    """Class providing access to user attributes on an array or group. Should not be
    instantiated directly, will be available via the `.attrs` property of an array or
    group.

    Parameters
    ----------
    store : MutableMapping
        The store in which to store the attributes.
    key : str, optional
        The key under which the attributes will be stored.
    read_only : bool, optional
        If True, attributes cannot be modified.
    cache : bool, optional
        If True (default), attributes will be cached locally.
    synchronizer : Synchronizer
        Only necessary if attributes may be modified from multiple threads or processes.

    """

    def __init__(self, store, key='.zattrs', read_only=False, cache=True,
                 synchronizer=None):

# Path: zarr/_storage/store.py
# class Store(BaseStore):
#     """Abstract store class used by implementations following the Zarr v2 spec.
# 
#     Adds public `listdir`, `rename`, and `rmdir` methods on top of BaseStore.
# 
#     .. added: 2.11.0
# 
#     """
# 
#     def listdir(self, path: str = "") -> List[str]:
#         path = normalize_storage_path(path)
#         return _listdir_from_keys(self, path)
# 
#     def rmdir(self, path: str = "") -> None:
#         if not self.is_erasable():
#             raise NotImplementedError(
#                 f'{type(self)} is not erasable, cannot call "rmdir"'
#             )  # pragma: no cover
#         path = normalize_storage_path(path)
#         _rmdir_from_keys(self, path)
# 
# Path: zarr/util.py
# def json_dumps(o: Any) -> bytes:
#     """Write JSON in a consistent, human-readable way."""
#     return json.dumps(o, indent=4, sort_keys=True, ensure_ascii=True,
#                       separators=(',', ': ')).encode('ascii')


# Path: zarr/attrs.py
from collections.abc import MutableMapping
from zarr._storage.store import Store
from zarr.util import json_dumps




class Attributes(MutableMapping):
    """Class providing access to user attributes on an array or group. Should not be
    instantiated directly, will be available via the `.attrs` property of an array or
    group.

    Parameters
    ----------
    store : MutableMapping
        The store in which to store the attributes.
    key : str, optional
        The key under which the attributes will be stored.
    read_only : bool, optional
        If True, attributes cannot be modified.
    cache : bool, optional
        If True (default), attributes will be cached locally.
    synchronizer : Synchronizer
        Only necessary if attributes may be modified from multiple threads or processes.

    """

    def __init__(self, store, key='.zattrs', read_only=False, cache=True,
                 synchronizer=None):

        self.store = Store._ensure_store(store)