def __setstate__(self, state): if isinstance(state, dict): warn(u'Unpickling an old datamatrix') self.__dict__.update(state) return # Is used by pickle.load. Because __getstate__() strips the _id, we # need to generate a new id for the DataMatrix upon unpickling. global _id OrderedState.__setstate__(self, state) object.__setattr__(self, u'_id', _id) for name, column in self.columns: column._datamatrix = self _id += 1
def __setstate__(self, state): OrderedState.__setstate__(self, state) # Start with a _metaindex=None after unpickling self._metaindex = None
def __getstate__(self): # Is used by pickle.dump. To make sure that identical datamatrices with # different _ids are considered identical, we strip the _id property. return OrderedState.__getstate__(self, ignore=u'_id')
def __getstate__(self): # Is used by pickle.dump. To make sure that Index objects with only a # different _metaindex are considered identical return OrderedState.__getstate__(self, ignore=u'_metaindex')