zarr.storage#
Attributes#
Classes#
Store for remote data based on FSSpec. |
|
Store for GPU memory. |
|
Store for the local file system. |
|
Store that logs all calls to another wrapped store. |
|
Store for local memory. |
|
Store that uses obstore for fast read/write from AWS, GCP, Azure. |
|
Path-like interface for a Store. |
|
Store that wraps an existing Store. |
|
Store using a ZIP file. |
Package Contents#
- class zarr.storage.FsspecStore(
- fs: fsspec.asyn.AsyncFileSystem,
- read_only: bool = False,
- path: str = '/',
- allowed_exceptions: tuple[type[Exception], Ellipsis] = ALLOWED_EXCEPTIONS,
Bases:
zarr.abc.store.Store
Store for remote data based on FSSpec.
- Parameters:
- fsAsyncFileSystem
The Async FSSpec filesystem to use with this store.
- read_onlybool
Whether the store is read-only
- pathstr
The root path of the store. This should be a relative path and must not include the filesystem scheme.
- allowed_exceptionstuple[type[Exception], …]
When fetching data, these cases will be deemed to correspond to missing keys.
- Attributes:
- fs
- allowed_exceptions
- supports_writes
- supports_deletes
- supports_partial_writes
- supports_listing
- Raises:
- TypeError
If the Filesystem does not support async operations.
- ValueError
If the path argument includes a scheme.
- Warns:
- UserWarning
If the file system (fs) was not created with asynchronous=True.
- async delete_dir(prefix: str) None [source]#
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- classmethod from_mapper(
- fs_map: fsspec.mapping.FSMap,
- read_only: bool = False,
- allowed_exceptions: tuple[type[Exception], Ellipsis] = ALLOWED_EXCEPTIONS,
Create a FsspecStore from a FSMap object.
- Parameters:
- fs_mapFSMap
Fsspec mutable mapping object.
- read_onlybool
Whether the store is read-only, defaults to False.
- allowed_exceptionstuple, optional
The exceptions that are allowed to be raised when accessing the store. Defaults to ALLOWED_EXCEPTIONS.
- Returns:
- FsspecStore
- classmethod from_upath(
- upath: Any,
- read_only: bool = False,
- allowed_exceptions: tuple[type[Exception], Ellipsis] = ALLOWED_EXCEPTIONS,
Create a FsspecStore from an upath object.
- Parameters:
- upathUPath
The upath to the root of the store.
- read_onlybool
Whether the store is read-only, defaults to False.
- allowed_exceptionstuple, optional
The exceptions that are allowed to be raised when accessing the store. Defaults to ALLOWED_EXCEPTIONS.
- Returns:
- FsspecStore
- classmethod from_url(
- url: str,
- storage_options: dict[str, Any] | None = None,
- read_only: bool = False,
- allowed_exceptions: tuple[type[Exception], Ellipsis] = ALLOWED_EXCEPTIONS,
Create a FsspecStore from a URL. The type of store is determined from the URL scheme.
- Parameters:
- urlstr
The URL to the root of the store.
- storage_optionsdict, optional
The options to pass to fsspec when creating the filesystem.
- read_onlybool
Whether the store is read-only, defaults to False.
- allowed_exceptionstuple, optional
The exceptions that are allowed to be raised when accessing the store. Defaults to ALLOWED_EXCEPTIONS.
- Returns:
- FsspecStore
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int [source]#
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int #
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool #
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- async list() collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- async list_dir(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async list_prefix(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- classmethod open(*args: Any, **kwargs: Any) Self #
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None #
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- abstract set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, zarr.core.common.BytesLike]],
- Async:
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- with_read_only(read_only: bool = False) FsspecStore [source]#
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- fs: fsspec.asyn.AsyncFileSystem#
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.GpuMemoryStore(
- store_dict: collections.abc.MutableMapping[str, zarr.core.buffer.gpu.Buffer] | None = None,
- *,
- read_only: bool = False,
Bases:
MemoryStore
Store for GPU memory.
Stores every chunk in GPU memory irrespective of the original location.
The dictionary of buffers to initialize this memory store with must be GPU Buffers.
Writing data to this store through
.set
will move the buffer to the GPU if necessary.- Parameters:
- store_dictMutableMapping, optional
A mutable mapping with string keys and
zarr.core.buffer.gpu.Buffer
values.- read_onlybool
Whether to open the store in read-only mode.
- async delete_dir(prefix: str) None #
Remove all keys and prefixes in the store that begin with a given prefix.
- classmethod from_dict(
- store_dict: collections.abc.MutableMapping[str, zarr.core.buffer.Buffer],
Create a GpuMemoryStore from a dictionary of buffers at any location.
The dictionary backing the newly created
GpuMemoryStore
will not be the same asstore_dict
.- Parameters:
- store_dictmapping
A mapping of strings keys to arbitrary Buffers. The buffer data will be moved into a
gpu.Buffer
.
- Returns:
- GpuMemoryStore
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int #
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int #
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool #
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- async list() collections.abc.AsyncIterator[str] #
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- async list_dir(prefix: str) collections.abc.AsyncIterator[str] #
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async list_prefix(prefix: str) collections.abc.AsyncIterator[str] #
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- classmethod open(*args: Any, **kwargs: Any) Self #
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None #
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- abstract set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, bytes | bytearray | memoryview[int]]],
- Async:
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- with_read_only(read_only: bool = False) MemoryStore #
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.LocalStore(root: pathlib.Path | str, *, read_only: bool = False)[source]#
Bases:
zarr.abc.store.Store
Store for the local file system.
- Parameters:
- rootstr or Path
Directory to use as root of store.
- read_onlybool
Whether the store is read-only
- Attributes:
- supports_writes
- supports_deletes
- supports_partial_writes
- supports_listing
- root
- async delete(key: str) None [source]#
Remove a key from the store.
- Parameters:
- keystr
Notes
If
key
is a directory within this store, the entire directory atstore.root / key
is deleted.
- async delete_dir(prefix: str) None [source]#
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype | None = None,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int [source]#
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int #
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool #
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- async list() collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- async list_dir(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async list_prefix(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async move(dest_root: pathlib.Path | str) None [source]#
Move the store to another path. The old root directory is deleted.
- classmethod open(*args: Any, **kwargs: Any) Self #
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a (key, value) pair.
- Parameters:
- keystr
- valueBuffer
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- async set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, bytes | bytearray | memoryview]],
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- with_read_only(read_only: bool = False) LocalStore [source]#
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- root: pathlib.Path#
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.LoggingStore(
- store: T_Store,
- log_level: str = 'DEBUG',
- log_handler: logging.Handler | None = None,
Bases:
zarr.storage._wrapper.WrapperStore
[T_Store
]Store that logs all calls to another wrapped store.
- Parameters:
- storeStore
Store to wrap
- log_levelstr
Log level
- log_handlerlogging.Handler
Log handler
- Attributes:
- counterdict
Counter of number of times each method has been called
- async delete_dir(prefix: str) None [source]#
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int [source]#
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int [source]#
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str = '') bool [source]#
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- async list() collections.abc.AsyncGenerator[str, None] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- async list_dir(prefix: str) collections.abc.AsyncGenerator[str, None] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async list_prefix(prefix: str) collections.abc.AsyncGenerator[str, None] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- log(hint: Any = '') collections.abc.Generator[None, None, None] [source]#
Context manager to log method calls
Each call to the wrapped store is logged to the configured logger and added to the counter dict.
- classmethod open(store_cls: type[T_Store], *args: Any, **kwargs: Any) Self [source]#
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a (key, value) pair.
- Parameters:
- keystr
- valueBuffer
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- async set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, bytes | bytearray | memoryview]],
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- abstract with_read_only(read_only: bool = False) Store #
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- counter: collections.defaultdict[str, int]#
- log_handler = None#
- log_level = 'DEBUG'#
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.MemoryStore(
- store_dict: collections.abc.MutableMapping[str, zarr.core.buffer.Buffer] | None = None,
- *,
- read_only: bool = False,
Bases:
zarr.abc.store.Store
Store for local memory.
- Parameters:
- store_dictdict
Initial data
- read_onlybool
Whether the store is read-only
- Attributes:
- supports_writes
- supports_deletes
- supports_partial_writes
- supports_listing
- async delete_dir(prefix: str) None #
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int #
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int #
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool #
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- async list() collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- async list_dir(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async list_prefix(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- classmethod open(*args: Any, **kwargs: Any) Self #
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- abstract set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, bytes | bytearray | memoryview[int]]],
- Async:
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- with_read_only(read_only: bool = False) MemoryStore [source]#
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.ObjectStore(store: obstore.store.ObjectStore, *, read_only: bool = False)[source]#
Bases:
zarr.abc.store.Store
Store that uses obstore for fast read/write from AWS, GCP, Azure.
- Parameters:
- storeobstore.store.ObjectStore
An obstore store instance that is set up with the proper credentials.
- read_onlybool
Whether to open the store in read-only mode.
Warning
ObjectStore is experimental and subject to API changes without notice. Please raise an issue with any comments/concerns about the store.
- async delete_dir(prefix: str) None #
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int [source]#
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int [source]#
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool #
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- list() collections.abc.AsyncGenerator[str, None] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- list_dir(prefix: str) collections.abc.AsyncGenerator[str, None] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- list_prefix(prefix: str) collections.abc.AsyncGenerator[str, None] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- classmethod open(*args: Any, **kwargs: Any) Self #
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a (key, value) pair.
- Parameters:
- keystr
- valueBuffer
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- abstract set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, zarr.core.common.BytesLike]],
- Async:
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- with_read_only(read_only: bool = False) ObjectStore [source]#
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- store: obstore.store.ObjectStore#
The underlying obstore instance.
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.StorePath(store: zarr.abc.store.Store, path: str = '')[source]#
Path-like interface for a Store.
- Parameters:
- storeStore
The store to use.
- pathstr
The path within the store.
- async delete() None [source]#
Delete the key from the store.
- Raises:
- NotImplementedError
If the store does not support deletion.
- async exists() bool [source]#
Check if the key exists in the store.
- Returns:
- bool
True if the key exists in the store, False otherwise.
- async get(
- prototype: zarr.core.buffer.BufferPrototype | None = None,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Read bytes from the store.
- Parameters:
- prototypeBufferPrototype, optional
The buffer prototype to use when reading the bytes.
- byte_rangeByteRequest, optional
The range of bytes to read.
- Returns:
- bufferBuffer or None
The read bytes, or None if the key does not exist.
- async is_empty() bool [source]#
Check if any keys exist in the store with the given prefix.
- Returns:
- bool
True if no keys exist in the store with the given prefix, False otherwise.
- classmethod open(
- store: zarr.abc.store.Store,
- path: str,
- mode: zarr.core.common.AccessModeLiteral | None = None,
- Async:
Open StorePath based on the provided mode.
If the mode is None, return an opened version of the store with no changes.
If the mode is ‘r+’, ‘w-’, ‘w’, or ‘a’ and the store is read-only, raise a ValueError.
If the mode is ‘r’ and the store is not read-only, return a copy of the store with read_only set to True.
If the mode is ‘w-’ and the store is not read-only and the StorePath contains keys, raise a FileExistsError.
If the mode is ‘w’ and the store is not read-only, delete all keys nested within the StorePath.
- Parameters:
- modeAccessModeLiteral
The mode to use when initializing the store path.
The accepted values are:
'r'
: read only (must exist)'r+'
: read/write (must exist)'a'
: read/write (create if doesn’t exist)'w'
: read/write (overwrite if exists)'w-'
: read/write (create if doesn’t exist).
- Raises:
- FileExistsError
If the mode is ‘w-’ and the store path already exists.
- ValueError
If the mode is not “r” and the store is read-only, or
- async set(
- value: zarr.core.buffer.Buffer,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Write bytes to the store.
- Parameters:
- valueBuffer
The buffer to write.
- byte_rangeByteRequest, optional
The range of bytes to write. If None, the entire buffer is written.
- Raises:
- NotImplementedError
If byte_range is not None, because Store.set does not support partial writes yet.
- async set_if_not_exists(default: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- defaultBuffer
The buffer to store if the key is not already present.
- store: zarr.abc.store.Store#
- class zarr.storage.WrapperStore(store: T_Store)[source]#
Bases:
zarr.abc.store.Store
,Generic
[T_Store
]Store that wraps an existing Store.
By default all of the store methods are delegated to the wrapped store instance, which is accessible via the
._store
attribute of this class.Use this class to modify or extend the behavior of the other store classes.
- async delete_dir(prefix: str) None [source]#
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int #
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int #
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool [source]#
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- list() collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- list_dir(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- list_prefix(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- classmethod open(store_cls: type[T_Store], *args: Any, **kwargs: Any) Self [source]#
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a (key, value) pair.
- Parameters:
- keystr
- valueBuffer
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- async set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, zarr.core.common.BytesLike]],
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- abstract with_read_only(read_only: bool = False) Store #
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- class zarr.storage.ZipStore(
- path: pathlib.Path | str,
- *,
- mode: ZipStoreAccessModeLiteral = 'r',
- read_only: bool | None = None,
- compression: int = zipfile.ZIP_STORED,
- allowZip64: bool = True,
Bases:
zarr.abc.store.Store
Store using a ZIP file.
- Parameters:
- pathstr
Location of file.
- modestr, optional
One of ‘r’ to read an existing file, ‘w’ to truncate and write a new file, ‘a’ to append to an existing file, or ‘x’ to exclusively create and write a new file.
- compressionint, optional
Compression method to use when writing to the archive.
- allowZip64bool, optional
If True (the default) will create ZIP files that use the ZIP64 extensions when the zipfile is larger than 2 GiB. If False will raise an exception when the ZIP file would require ZIP64 extensions.
- Attributes:
- allowed_exceptions
- supports_writes
- supports_deletes
- supports_partial_writes
- supports_listing
- path
- compression
- allowZip64
- async delete_dir(prefix: str) None [source]#
Remove all keys and prefixes in the store that begin with a given prefix.
- async exists(key: str) bool [source]#
Check if a key exists in the store.
- Parameters:
- keystr
- Returns:
- bool
- async get(
- key: str,
- prototype: zarr.core.buffer.BufferPrototype,
- byte_range: zarr.abc.store.ByteRequest | None = None,
Retrieve the value associated with a given key.
- Parameters:
- keystr
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- byte_rangeByteRequest, optional
ByteRequest may be one of the following. If not provided, all data associated with the key is retrieved. - RangeByteRequest(int, int): Request a specific range of bytes in the form (start, end). The end is exclusive. If the given range is zero-length or starts after the end of the object, an error will be returned. Additionally, if the range ends after the end of the object, the entire remainder of the object will be returned. Otherwise, the exact requested range will be returned. - OffsetByteRequest(int): Request all bytes starting from a given byte offset. This is equivalent to bytes={int}- as an HTTP header. - SuffixByteRequest(int): Request the last int bytes. Note that here, int is the size of the request, not the byte offset. This is equivalent to bytes=-{int} as an HTTP header.
- Returns:
- Buffer
- async get_partial_values(
- prototype: zarr.core.buffer.BufferPrototype,
- key_ranges: collections.abc.Iterable[tuple[str, zarr.abc.store.ByteRequest | None]],
Retrieve possibly partial values from given key_ranges.
- Parameters:
- prototypeBufferPrototype
The prototype of the output buffer. Stores may support a default buffer prototype.
- key_rangesIterable[tuple[str, tuple[int | None, int | None]]]
Ordered set of key, range pairs, a key may occur multiple times with different ranges
- Returns:
- list of values, in the order of the key_ranges, may contain null/none for missing keys
- async getsize(key: str) int #
Return the size, in bytes, of a value in a Store.
- Parameters:
- keystr
- Returns:
- nbytesint
The size of the value (in bytes).
- Raises:
- FileNotFoundError
When the given key does not exist in the store.
- async getsize_prefix(prefix: str) int #
Return the size, in bytes, of all values under a prefix.
- Parameters:
- prefixstr
The prefix of the directory to measure.
- Returns:
- nbytesint
The sum of the sizes of the values in the directory (in bytes).
See also
zarr.Array.nbytes_stored
Store.getsize
Notes
getsize_prefix
is just provided as a potentially faster alternative to listing all the keys under a prefix callingStore.getsize()
on each.In general,
prefix
should be the path of an Array or Group in the Store. Implementations may differ on the behavior when some otherprefix
is provided.
- async is_empty(prefix: str) bool #
Check if the directory is empty.
- Parameters:
- prefixstr
Prefix of keys to check.
- Returns:
- bool
True if the store is empty, False otherwise.
- async list() collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store.
- Returns:
- AsyncIterator[str]
- async list_dir(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys and prefixes with a given prefix and which do not contain the character “/” after the given prefix.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async list_prefix(prefix: str) collections.abc.AsyncIterator[str] [source]#
Retrieve all keys in the store that begin with a given prefix. Keys are returned relative to the root of the store.
- Parameters:
- prefixstr
- Returns:
- AsyncIterator[str]
- async move(path: pathlib.Path | str) None [source]#
Move the store to another path.
- classmethod open(*args: Any, **kwargs: Any) Self #
- Async:
Create and open the store.
- Parameters:
- *argsAny
Positional arguments to pass to the store constructor.
- **kwargsAny
Keyword arguments to pass to the store constructor.
- Returns:
- Store
The opened store instance.
- async set(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a (key, value) pair.
- Parameters:
- keystr
- valueBuffer
- async set_if_not_exists(key: str, value: zarr.core.buffer.Buffer) None [source]#
Store a key to
value
if the key is not already present.- Parameters:
- keystr
- valueBuffer
- abstract set_partial_values(
- key_start_values: collections.abc.Iterable[tuple[str, int, bytes | bytearray | memoryview[int]]],
- Async:
Store values at a given key, starting at byte range_start.
- Parameters:
- key_start_valueslist[tuple[str, int, BytesLike]]
set of key, range_start, values triples, a key may occur multiple times with different range_starts, range_starts (considering the length of the respective values) must not specify overlapping ranges for the same key
- abstract with_read_only(read_only: bool = False) Store #
Return a new store with a new read_only setting.
The new store points to the same location with the specified new read_only state. The returned Store is not automatically opened, and this store is not automatically closed.
- Parameters:
- read_only
If True, the store will be created in read-only mode. Defaults to False.
- Returns:
- A new store of the same type with the new read only attribute.
- path: pathlib.Path#
- property supports_consolidated_metadata: bool#
Does the store support consolidated metadata?.
If it doesn’t an error will be raised on requests to consolidate the metadata. Returning False can be useful for stores which implement their own consolidation mechanism outside of the zarr-python implementation.
- zarr.storage.StoreLike: TypeAlias = Store | StorePath | FSMap | Path | str | dict[str, Buffer]#