def get_mapper(protocol, fs, path): if protocol == 's3': from s3fs.mapping import S3Map return S3Map(path, fs) elif protocol == 'gcs': from gcsfs.mapping import GCSMap return GCSMap(path, fs) else: raise NotImplementedError
def make_store(path): m = re.match("^gc?s://", path) if m: return GCSMap(path[len(m.group(0)):], gcs=gcsFileSystem()) if path.startswith("s3://"): s3 = S3FileSystem() return S3Map(path[len("s3://"):], s3=s3) return zarr.DirectoryStore(path)
def get_mapper(fs, path): # This is not the right way to do this. # At the very least, we should have the correct failed import messages if fs.protocol == 'file': from zarr.storage import DirectoryStore return DirectoryStore(path) elif fs.protocol == 's3': from s3fs.mapping import S3Map return S3Map(path, fs) elif fs.protocol in ['gcs', 'gs']: from gcsfs.mapping import GCSMap return GCSMap(path, fs) elif fs.protocol == 'hdfs': from hdfs3.mapping import HDFSMap return HDFSMap(fs, path) else: raise ValueError('No mapper for protocol "%s"' % fs.protocol)