(self, num)
return output
Read num characters.
Read num characters.
Read num characters .
def read(self, num):
        """Read num characters."""
        output = self.peek(num)
        # check for \x1A - EOF char will actually stop further reading
        # (that's true in disk text files but not on COM devices)
        if b'\x1A' in output:
            output = output[:output.index(b'\x1A')]
        # drop read chars from buffer
        self._readahead = self._readahead[len(output):]
        if len(output) <= 1:
            self._previous = self._current
        else:
            self._previous = output[-2:]
        self._current = output[-1:]
        return output
def read ( self , num ) : output = self . peek ( num ) # check for \x1A - EOF char will actually stop further reading # (that's true in disk text files but not on COM devices) if b'\x1A' in output : output = output [ : output . index ( b'\x1A' ) ] # drop read chars from buffer self . _readahead = self . _readahead [ len ( output ) : ] if len ( output ) <= 1 : self . _previous = self . _current else : self . _previous = output [ - 2 : ] self . _current = output [ - 1 : ] return output