Exemplo n.º 1
0
def get_zarr_store(file_path):
    """Get the storage type
    """
    import zarr
    ZARR_STORE_MAP = {
        "lmdb": zarr.LMDBStore,
        "zip": zarr.ZipStore,
        "dbm": zarr.DBMStore,
        "default": zarr.DirectoryStore
    }

    suffix, subsuffix = get_subsuffix(file_path)
    if suffix != 'zarr' or (subsuffix is not None
                            and subsuffix not in ZARR_STORE_MAP):
        return ZARR_STORE_MAP['default'](file_path)
    else:
        return ZARR_STORE_MAP[subsuffix](file_path)
Exemplo n.º 2
0
def test_get_subsuffix():
    assert get_subsuffix("asds.lmdb.zarr") == ('zarr', 'lmdb')
    assert get_subsuffix("/asdasd.asd/asds.lmdb.zarr") == ('zarr', 'lmdb')
    assert get_subsuffix("asds.zarr") == ('zarr', "")
    assert get_subsuffix("asdszarr") == ('', '')