def init_attributes(self, store, read_only=False, cache=True): key = 'attrs' sync_path = mkdtemp() atexit.register(shutil.rmtree, sync_path) synchronizer = ProcessSynchronizer(sync_path) return Attributes(store, synchronizer=synchronizer, key=key, read_only=read_only, cache=cache)
def init_attributes(self, store, read_only=False): key = 'attrs' store[key] = json.dumps(dict()).encode('ascii') sync_path = mkdtemp() atexit.register(shutil.rmtree, sync_path) synchronizer = ProcessSynchronizer(sync_path) return Attributes(store, synchronizer=synchronizer, key=key, read_only=read_only)
def create_array(self, read_only=False, **kwargs): path = tempfile.mkdtemp() atexit.register(atexit_rmtree, path) store = DirectoryStore(path) init_array(store, **kwargs) sync_path = tempfile.mkdtemp() atexit.register(atexit_rmtree, sync_path) synchronizer = ProcessSynchronizer(sync_path) return Array(store, synchronizer=synchronizer, read_only=read_only, cache_metadata=False)
def init_attributes(self, store, read_only=False, cache=True, zarr_version=zarr_version): key = '.zattrs' if zarr_version == 2 else meta_root + 'attrs' sync_path = mkdtemp() atexit.register(shutil.rmtree, sync_path) synchronizer = ProcessSynchronizer(sync_path) return Attributes(store, synchronizer=synchronizer, key=key, read_only=read_only, cache=cache)
def create_array(self, read_only=False, **kwargs): path = tempfile.mkdtemp() atexit.register(atexit_rmtree, path) store = DirectoryStore(path) cache_metadata = kwargs.pop('cache_metadata', False) cache_attrs = kwargs.pop('cache_attrs', False) write_empty_chunks = kwargs.pop('write_empty_chunks', True) init_array(store, **kwargs) sync_path = tempfile.mkdtemp() atexit.register(atexit_rmtree, sync_path) synchronizer = ProcessSynchronizer(sync_path) return Array(store, synchronizer=synchronizer, read_only=read_only, cache_metadata=cache_metadata, cache_attrs=cache_attrs, write_empty_chunks=write_empty_chunks)
def create_group(self, store=None, path=None, read_only=False, chunk_store=None, synchronizer=None): if store is None: store, chunk_store = self.create_store() init_group(store, path=path, chunk_store=chunk_store) sync_path = tempfile.mkdtemp() atexit.register(atexit_rmtree, sync_path) synchronizer = ProcessSynchronizer(sync_path) g = Group(store, path=path, read_only=read_only, synchronizer=synchronizer, chunk_store=chunk_store) return g