def delete_plan(self, plan):
        """Delete the portion of a plan that has yet to occur.

        :arg plan: integer ID of a plan, as given by ``with self.plan() as plan:``

        """
        branch, turn, tick = self._btt()
        to_delete = []
        plan_ticks = self._plan_ticks[plan]
        for trn, tcks in plan_ticks.items():  # might improve performance to use a WindowDict for plan_ticks
            if turn == trn:
                for tck in tcks:
                    if tck >= tick:
                        to_delete.append((trn, tck))
            elif trn > turn:
                to_delete.extend((trn, tck) for tck in tcks)
        # Delete stuff that happened at contradicted times, and then delete the times from the plan
        where_cached = self._where_cached
        time_plan = self._time_plan
        for trn, tck in to_delete:
            for cache in where_cached[branch, trn, tck]:
                cache.remove(branch, trn, tck)
                if hasattr(cache, 'deldb'):
                    cache.deldb(branch, trn, tck)
            del where_cached[branch, trn, tck]
            plan_ticks[trn].remove(tck)
            if not plan_ticks[trn]:
                del plan_ticks[trn]
            del time_plan[branch, trn, tck]
def delete_plan ( self , plan ) : branch , turn , tick = self . _btt ( ) to_delete = [ ] plan_ticks = self . _plan_ticks [ plan ] for trn , tcks in plan_ticks . items ( ) : if turn == trn : for tck in tcks : if tck >= tick : to_delete . append ( ( trn , tck ) ) elif trn > turn : to_delete . extend ( ( trn , tck ) for tck in tcks ) where_cached = self . _where_cached time_plan = self . _time_plan for trn , tck in to_delete : for cache in where_cached [ branch , trn , tck ] : cache . remove ( branch , trn , tck ) if hasattr ( cache , 'deldb' ) : cache . deldb ( branch , trn , tck ) del where_cached [ branch , trn , tck ] plan_ticks [ trn ] . remove ( tck ) if not plan_ticks [ trn ] : del plan_ticks [ trn ] del time_plan [ branch , trn , tck ]
Delete the portion of a plan that has yet to occur.

        :arg plan: integer ID of a plan, as given by ``with self.plan() as plan:``