Skip to content

Commit 963ebe8

Browse files
committed
Refactor metadata support checks
Removes conditional checks based on store type for metadata support. This ensures metadata functionality is consistently available for all stores, simplifying logic and improving reliability.
1 parent 0a30d43 commit 963ebe8

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

mlarray/mlarray.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,8 @@ def _construct_in_memory(
16481648

16491649
self._store = store_builder(**builder_kwargs)
16501650

1651+
self.support_metadata = True
1652+
16511653
self._update_blosc2_meta()
16521654
self._validate_and_add_meta(self.meta)
16531655

@@ -1747,14 +1749,14 @@ def _update_blosc2_meta(self):
17471749
Updates ``self.meta.blosc2`` from the underlying store when the array
17481750
is present.
17491751
"""
1750-
if self.meta._has_array.has_array == True:
1752+
if self.support_metadata and self.meta._has_array.has_array == True:
17511753
self.meta.blosc2.chunk_size = list(self._store.chunks)
17521754
self.meta.blosc2.block_size = list(self._store.blocks)
17531755

17541756
def _read_meta(self):
17551757
"""Read MLArray metadata from the underlying store, if available."""
17561758
meta = Meta()
1757-
if self.support_metadata and isinstance(self._store, blosc2.ndarray.NDArray):
1759+
if self.support_metadata:
17581760
meta = self._store.vlmeta["mlarray"]
17591761
meta = Meta.from_mapping(meta)
17601762
self._validate_and_add_meta(meta)
@@ -1766,7 +1768,7 @@ def _write_metadata(self, force=False):
17661768
force (bool): If True, write even when mmap_mode is read-only.
17671769
"""
17681770
is_writable = False
1769-
if self.support_metadata and isinstance(self._store, blosc2.ndarray.NDArray):
1771+
if self.support_metadata:
17701772
if self.mode in ('a', 'w') and self.mmap_mode is None:
17711773
is_writable = True
17721774
elif self.mmap_mode in ('r+', 'w+'):

0 commit comments

Comments
 (0)