(self, newstart, newstop)
Set start and stop index.
Set start and stop index.
Set start and stop index .
def ring_set_boundaries(self, newstart, newstop):
        """Set start and stop index."""
        length = (newstop - newstart) % self._ring_length
        # rotate buffer to account for new start and stop
        # these are between length - ring_length and length
        start_index = self._ring_index(newstart)
        stop_index = self._ring_index(newstop)
        start = self._ring_index(self._start)
        # drop any extended buffer beyond ring limits
        self._buffer = self._buffer[:self._start + self._ring_length]
        # cut to ring limits, we should be exactly the right size
        start -= len(self._buffer) - self._ring_length
        self._buffer = self._buffer[-self._ring_length:]
        # rotate so that the stop index is at the end
        shift = len(self._buffer[start+length:])
        self._buffer = self._buffer[start+length:] + self._buffer[:start+length]
        start += shift
        start = start % self._ring_length
        # insert zeros before buffer to get the correct modulo
        while start % self._ring_length != newstart:
            start += 1
            self._buffer = [(b'\0\0', 0)] + self._buffer
        self._start = start
def ring_set_boundaries ( self , newstart , newstop ) : length = ( newstop - newstart ) % self . _ring_length # rotate buffer to account for new start and stop # these are between length - ring_length and length start_index = self . _ring_index ( newstart ) stop_index = self . _ring_index ( newstop ) start = self . _ring_index ( self . _start ) # drop any extended buffer beyond ring limits self . _buffer = self . _buffer [ : self . _start + self . _ring_length ] # cut to ring limits, we should be exactly the right size start -= len ( self . _buffer ) - self . _ring_length self . _buffer = self . _buffer [ - self . _ring_length : ] # rotate so that the stop index is at the end shift = len ( self . _buffer [ start + length : ] ) self . _buffer = self . _buffer [ start + length : ] + self . _buffer [ : start + length ] start += shift start = start % self . _ring_length # insert zeros before buffer to get the correct modulo while start % self . _ring_length != newstart : start += 1 self . _buffer = [ ( b'\0\0' , 0 ) ] + self . _buffer self . _start = start