-
-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature(api): add top level synchronous and asynchronous api * add group/open_group * minor doc improvement * sync with v3 branch * fix mypy errors * progress integrating store mode * basic tests are passing * docs and missing store utils file * fix parse shapelike test * fix bad merge * respond to reviews
- Loading branch information
Showing
17 changed files
with
2,167 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,68 @@ | ||
from __future__ import annotations | ||
|
||
import zarr.codecs # noqa: F401 | ||
from zarr._version import version as __version__ | ||
from zarr.api.synchronous import ( | ||
array, | ||
consolidate_metadata, | ||
copy, | ||
copy_all, | ||
copy_store, | ||
create, | ||
empty, | ||
empty_like, | ||
full, | ||
full_like, | ||
group, | ||
load, | ||
ones, | ||
ones_like, | ||
open, | ||
open_array, | ||
open_consolidated, | ||
open_group, | ||
open_like, | ||
save, | ||
save_array, | ||
save_group, | ||
tree, | ||
zeros, | ||
zeros_like, | ||
) | ||
from zarr.array import Array, AsyncArray | ||
from zarr.config import config # noqa: F401 | ||
from zarr.config import config | ||
from zarr.group import AsyncGroup, Group | ||
from zarr.store import ( | ||
StoreLike, | ||
make_store_path, | ||
) | ||
from zarr.sync import sync as _sync | ||
|
||
# in case setuptools scm screw up and find version to be 0.0.0 | ||
assert not __version__.startswith("0.0.0") | ||
|
||
|
||
async def open_auto_async(store: StoreLike) -> AsyncArray | AsyncGroup: | ||
store_path = make_store_path(store) | ||
try: | ||
return await AsyncArray.open(store_path) | ||
except KeyError: | ||
return await AsyncGroup.open(store_path) | ||
|
||
|
||
def open_auto(store: StoreLike) -> Array | Group: | ||
object = _sync( | ||
open_auto_async(store), | ||
) | ||
if isinstance(object, AsyncArray): | ||
return Array(object) | ||
if isinstance(object, AsyncGroup): | ||
return Group(object) | ||
raise TypeError(f"Unexpected object type. Got {type(object)}.") | ||
__all__ = [ | ||
"__version__", | ||
"config", | ||
"Array", | ||
"AsyncArray", | ||
"Group", | ||
"AsyncGroup", | ||
"tree", | ||
"array", | ||
"consolidate_metadata", | ||
"copy", | ||
"copy_all", | ||
"copy_store", | ||
"create", | ||
"empty", | ||
"empty_like", | ||
"full", | ||
"full_like", | ||
"group", | ||
"load", | ||
"ones", | ||
"ones_like", | ||
"open", | ||
"open_array", | ||
"open_consolidated", | ||
"open_group", | ||
"open_like", | ||
"save", | ||
"save_array", | ||
"save_group", | ||
"zeros", | ||
"zeros_like", | ||
] |
Empty file.
Oops, something went wrong.