def truncate(self, branch, turn, tick):
        """Delete all data after (not on) a specific tick"""
        parents, branches, keys, settings, presettings, keycache, send = self._truncate_stuff
        def truncate_branhc(branhc):
            if turn in branhc:
                trn = branhc[turn]
                trn.truncate(tick)
                branhc.truncate(turn)
                if not trn:
                    del branhc[turn]
            else:
                branhc.truncate(turn)
        for entities in parents.values():
            for keys in entities.values():
                for branches in keys.values():
                    if branch not in branches:
                        continue
                    truncate_branhc(branches[branch])
        for branches in branches.values():
            if branch not in branches:
                continue
            truncate_branhc(branches[branch])
        for keys in keys.values():
            for branches in keys.values():
                if branch not in branches:
                    continue
                truncate_branhc(branches[branch])
        truncate_branhc(settings[branch])
        truncate_branhc(presettings[branch])
        self.shallowest = OrderedDict()
        for entity_branch in keycache:
            if entity_branch[-1] == branch:
                truncate_branhc(keycache[entity_branch])
        send(self, branch=branch, turn=turn, tick=tick, action='truncate')
def truncate ( self , branch , turn , tick ) : parents , branches , keys , settings , presettings , keycache , send = self . _truncate_stuff def truncate_branhc ( branhc ) : if turn in branhc : trn = branhc [ turn ] trn . truncate ( tick ) branhc . truncate ( turn ) if not trn : del branhc [ turn ] else : branhc . truncate ( turn ) for entities in parents . values ( ) : for keys in entities . values ( ) : for branches in keys . values ( ) : if branch not in branches : continue truncate_branhc ( branches [ branch ] ) for branches in branches . values ( ) : if branch not in branches : continue truncate_branhc ( branches [ branch ] ) for keys in keys . values ( ) : for branches in keys . values ( ) : if branch not in branches : continue truncate_branhc ( branches [ branch ] ) truncate_branhc ( settings [ branch ] ) truncate_branhc ( presettings [ branch ] ) self . shallowest = OrderedDict ( ) for entity_branch in keycache : if entity_branch [ - 1 ] == branch : truncate_branhc ( keycache [ entity_branch ] ) send ( self , branch = branch , turn = turn , tick = tick , action = 'truncate' )
Delete all data after (not on) a specific tick