def test_gzip_json_files(self): with filetexts(texts, open=gzip.open) as filenames: dd = Files(sorted(filenames), JSON, open=gzip.open, subdshape=dshape) self.assertEqual(sorted(dd), sorted(data.values())) self.assertEqual(dd.dshape, Var() * dshape)
def __init__(self, files, descriptor, subdshape=None, schema=None, open=open): if isinstance(files, py2help._strtypes): files = glob(files) self.filenames = files self.open = open self.descriptor = descriptor if schema and not subdshape: subdshape = Var() * schema self.subdshape = dshape(subdshape)
def dshape(self): shape = list(self._child.dshape.shape) shape[0] = Var() return DataShape(*(shape + [self._child.dshape.measure]))
def dshape(self): if isinstance(self.subdshape[0], Var): return self.subdshape else: return Var() * self.subdshape