original_docstring: Finds unused generated checkpoints
              and remove them from story steps.
docstring: Finds unused generated checkpoints
  and remove them from story steps.
docstring_tokens: Finds unused generated checkpoints and remove them from story steps .
code: def _remove_unused_generated_cps(self, story_steps, overlapping_cps,
                                       story_end_checkpoints):
          # type: (Dict[Text, StoryStep], Set[Text], Dict[Text, Text]) -> None
          """Finds unused generated checkpoints
              and remove them from story steps."""
  
          unused_cps = self._find_unused_checkpoints(story_steps.values(),
                                                     story_end_checkpoints)
  
          unused_overlapping_cps = unused_cps.intersection(overlapping_cps)
  
          unused_genr_cps = {cp_name
                             for cp_name in unused_cps
                             if cp_name.startswith(GENERATED_CHECKPOINT_PREFIX)}
  
          k_to_remove = set()
          for k, step in story_steps.items():
              # changed all ends
              updated = step.create_copy(use_new_id=False)
              updated.start_checkpoints = self._checkpoint_difference(
                      updated.start_checkpoints, unused_overlapping_cps)
  
              # remove generated unused end checkpoints
              updated.end_checkpoints = self._checkpoint_difference(
                      updated.end_checkpoints, unused_genr_cps)
  
              if (step.start_checkpoints and not updated.start_checkpoints or
                      step.end_checkpoints and not updated.end_checkpoints):
                  # remove story step if the generated checkpoints
                  # were the only ones
                  k_to_remove.add(k)
  
              story_steps[k] = updated
  
          # remove unwanted story steps
          for k in k_to_remove:
              del story_steps[k]
code_tokens: def _remove_unused_generated_cps ( self , story_steps , overlapping_cps , story_end_checkpoints ) : unused_cps = self . _find_unused_checkpoints ( story_steps . values ( ) , story_end_checkpoints ) unused_overlapping_cps = unused_cps . intersection ( overlapping_cps ) unused_genr_cps = { cp_name for cp_name in unused_cps if cp_name . startswith ( GENERATED_CHECKPOINT_PREFIX ) } k_to_remove = set ( ) for k , step in story_steps . items ( ) : updated = step . create_copy ( use_new_id = False ) updated . start_checkpoints = self . _checkpoint_difference ( updated . start_checkpoints , unused_overlapping_cps ) updated . end_checkpoints = self . _checkpoint_difference ( updated . end_checkpoints , unused_genr_cps ) if ( step . start_checkpoints and not updated . start_checkpoints or step . end_checkpoints and not updated . end_checkpoints ) : k_to_remove . add ( k ) story_steps [ k ] = updated for k in k_to_remove : del story_steps [ k ]
short_docstring: Finds unused generated checkpoints
  and remove them from story steps.
short_docstring_tokens: Finds unused generated checkpoints and remove them from story steps .
comment: # type: (Dict[Text, StoryStep], Set[Text], Dict[Text, Text]) -> None$SEP$"""Finds unused generated checkpoints
              and remove them from story steps."""$SEP$# changed all ends$SEP$# remove generated unused end checkpoints$SEP$# remove story step if the generated checkpoints$SEP$# were the only ones$SEP$# remove unwanted story steps