def can_handle(url): if not url.startswith('file://'): log.debug("able to handle %s? no, not starting with file://" % url) return False path = url2path(url) if not h5py.is_hdf5(path): log.debug("able to handle %s? no, not hdf5 file" % url) return False log.debug("able to handle %s? yes" % url) return True
def can_handle(url): if not url.startswith('file://'): log.debug("able to handle %s? no, invalid url" % url) return False path = url2path(url) if not is_bag(path): log.debug("able to handle %s? no, not a BAG" % url) return False log.debug("able to handle %s? yes" % url) return True
def can_handle(url): if not url.startswith('file://'): log.debug("able to handle %s? no, not starting with file://" % url) return False if not url.endswith('.asc'): log.debug("able to handle %s? no, missing .asc extension" % url) return False first_line = open(url2path(url)).readline() if first_line.split()[0].upper() != "NCOLS": log.debug("able to handle %s? no, invalid first line" % url) return False log.debug("able to handle %s? yes" % url) return True
def __init__(self, url): if not self.can_handle(url): raise ValueError(url) self._url = url path = url2path(url) self.f = h5py.File(path, 'r')
def getFilePath(self): return url2path(self._url)
def __init__(self, url): if not self.can_handle(url): raise ValueError(url) self._url = url path = url2path(url) self.f = BAGFile(path, 'r')