-
-
Notifications
You must be signed in to change notification settings - Fork 368
Closed
Description
This line imports some buffer implementation details into the store abc. Importing implementation details into the abstract base classes makes them not so abstract, and gives rise to circular imports.
zarr-python/src/zarr/abc/store.py
Line 9 in 22b177c
| from zarr.core.buffer.core import default_buffer_prototype |
That function is used here:
zarr-python/src/zarr/abc/store.py
Lines 420 to 444 in 22b177c
| async def getsize(self, key: str) -> int: | |
| """ | |
| Return the size, in bytes, of a value in a Store. | |
| Parameters | |
| ---------- | |
| key : str | |
| Returns | |
| ------- | |
| nbytes : int | |
| The size of the value (in bytes). | |
| Raises | |
| ------ | |
| FileNotFoundError | |
| When the given key does not exist in the store. | |
| """ | |
| # Note to implementers: this default implementation is very inefficient since | |
| # it requires reading the entire object. Many systems will have ways to get the | |
| # size of an object without reading it. | |
| value = await self.get(key, prototype=default_buffer_prototype()) | |
| if value is None: | |
| raise FileNotFoundError(key) | |
| return len(value) |
This is something that could be avoided if the store classes were associated with buffer types. xref #2473.
Metadata
Metadata
Assignees
Labels
No labels