(self, num_steps)
Trims a given number of steps from the end of the sequence.
Trims a given number of steps from the end of the sequence.
Trims a given number of steps from the end of the sequence .
def _trim_steps(self, num_steps):
    """Trims a given number of steps from the end of the sequence."""
    steps_trimmed = 0
    for i in reversed(range(len(self._events))):
      if self._events[i].event_type == PolyphonicEvent.STEP_END:
        if steps_trimmed == num_steps:
          del self._events[i + 1:]
          break
        steps_trimmed += 1
      elif i == 0:
        self._events = [
            PolyphonicEvent(event_type=PolyphonicEvent.START, pitch=None)]
        break
def _trim_steps ( self , num_steps ) : steps_trimmed = 0 for i in reversed ( range ( len ( self . _events ) ) ) : if self . _events [ i ] . event_type == PolyphonicEvent . STEP_END : if steps_trimmed == num_steps : del self . _events [ i + 1 : ] break steps_trimmed += 1 elif i == 0 : self . _events = [ PolyphonicEvent ( event_type = PolyphonicEvent . START , pitch = None ) ] break