def __init__(self, obj, dshape=None, metadata=None, layout=None, params=None): # Datashape # --------- if isinstance(dshape, basestring): dshape = _dshape(dshape) if not dshape: # The user just passed in a raw data source, try # and infer how it should be layed out or fail # back on dynamic types. self._datashape = dshape = CTableSource.infer_datashape(obj) else: # The user overlayed their custom dshape on this # data, check if it makes sense CTableSource.check_datashape(obj, given_dshape=dshape) self._datashape = dshape # Source # ------ if isinstance(obj, ByteProvider): self.data = obj else: self.data = CTableSource(obj, dshape=dshape, params=params) # children graph nodes self.children = [] self.space = Space(self.data) # Layout # ------ if layout: self._layout = layout elif not layout: self._layout = self.data.default_layout() # Metadata # -------- self._metadata = NDTable._metaheader + (metadata or []) # Parameters # ---------- self.params = params
def __init__(self, obj, dshape=None, metadata=None, layout=None, params=None): # Datashape # --------- if isinstance(dshape, basestring): dshape = _dshape(dshape) if not dshape: # The user just passed in a raw data source, try # and infer how it should be layed out or fail # back on dynamic types. self._datashape = dshape = CTableSource.infer_datashape(obj) else: # The user overlayed their custom dshape on this # data, check if it makes sense CTableSource.check_datashape(obj, given_dshape=dshape) self._datashape = dshape # Source # ------ if isinstance(obj, ByteProvider): self.data = obj else: self.data = CTableSource(obj, dshape=dshape, params=params) # children graph nodes self.children = [] self.space = Space(self.data) # Layout # ------ if layout: self._layout = layout elif not layout: self._layout = self.data.default_layout() # Metadata # -------- self._metadata = NDTable._metaheader + (metadata or []) # Parameters # ---------- self.params = params