def __getstate__(self):
        """
        Fix pickling.
        """
        state = {
            "_log": self._log.level,
            "_meta": self._meta,
            "_source": self._source,
            "_size": self._size,
            "_initial_version": self._initial_version,
            "tree": self._generate_tree()
        }
        # ensure that there are no ndarray proxies which cannot be pickled
        queue = [(None, None, state["tree"])]
        while queue:
            parent, key, element = queue.pop()
            if isinstance(element, dict):
                for key, val in element.items():
                    queue.append((element, key, val))
            elif isinstance(element, (list, tuple)):
                for i, child in enumerate(element):
                    queue.append((element, i, child))
            elif isinstance(element, asdf.tags.core.ndarray.NDArrayType):
                parent[key] = element.__array__()
        return state
def __getstate__ ( self ) : state = { "_log" : self . _log . level , "_meta" : self . _meta , "_source" : self . _source , "_size" : self . _size , "_initial_version" : self . _initial_version , "tree" : self . _generate_tree ( ) } queue = [ ( None , None , state [ "tree" ] ) ] while queue : parent , key , element = queue . pop ( ) if isinstance ( element , dict ) : for key , val in element . items ( ) : queue . append ( ( element , key , val ) ) elif isinstance ( element , ( list , tuple ) ) : for i , child in enumerate ( element ) : queue . append ( ( element , i , child ) ) elif isinstance ( element , asdf . tags . core . ndarray . NDArrayType ) : parent [ key ] = element . __array__ ( ) return state
Fix pickling.