def __getitem__(self, item): if item == self.DATA_KEY: return self.data elif gx.is_mapping(self._data): if gx.is_str(item): return self._data[item] else: return recursive_getitem(self._data, item) raise KeyError
def __getitem__(self, item): if self.indices is None: raise RuntimeError( 'index the data first; otherwise the indices are not available' ) if item == self.INDEX_KEY: return self.indices elif item == self.DATA_KEY: return self.data elif gx.is_mapping(self.indices): if gx.is_str(item): return self.indices[item] else: return recursive_getitem(self.indices, item) raise KeyError
def items(self): yield self.DATA_KEY, self.data yield self.INDEX_KEY, self.indices if gx.is_mapping(self.indices): yield from self.indices.items()
def __iter__(self): yield self.DATA_KEY yield self.INDEX_KEY if gx.is_mapping(self.indices): yield from self.indices
def items(self): yield self.DATA_KEY, self.data if gx.is_mapping(self.data): yield from self.data.items()
def __iter__(self): yield self.DATA_KEY if gx.is_mapping(self.data): yield from self.data