(self, n)
return buf
Read up to n bytes with at most one read() system call.
Read up to n bytes with at most one read() system call.
Read up to n bytes with at most one read () system call .
def read1(self, n):
        """Read up to n bytes with at most one read() system call."""

        if n is None or n < 0:
            buf = self._readbuffer[self._offset:]
            self._readbuffer = b''
            self._offset = 0
            while not self._eof:
                data = self._read1(self.MAX_N)
                if data:
                    buf += data
                    break
            return buf

        end = n + self._offset
        if end < len(self._readbuffer):
            buf = self._readbuffer[self._offset:end]
            self._offset = end
            return buf

        n = end - len(self._readbuffer)
        buf = self._readbuffer[self._offset:]
        self._readbuffer = b''
        self._offset = 0
        if n > 0:
            while not self._eof:
                data = self._read1(n)
                if n < len(data):
                    self._readbuffer = data
                    self._offset = n
                    buf += data[:n]
                    break
                if data:
                    buf += data
                    break
        return buf
def read1 ( self , n ) : if n is None or n < 0 : buf = self . _readbuffer [ self . _offset : ] self . _readbuffer = b'' self . _offset = 0 while not self . _eof : data = self . _read1 ( self . MAX_N ) if data : buf += data break return buf end = n + self . _offset if end < len ( self . _readbuffer ) : buf = self . _readbuffer [ self . _offset : end ] self . _offset = end return buf n = end - len ( self . _readbuffer ) buf = self . _readbuffer [ self . _offset : ] self . _readbuffer = b'' self . _offset = 0 if n > 0 : while not self . _eof : data = self . _read1 ( n ) if n < len ( data ) : self . _readbuffer = data self . _offset = n buf += data [ : n ] break if data : buf += data break return buf