parameters: (self, n)
return_statement: return buf
docstring: Read up to n bytes with at most one read() system call.
docstring_summary: Read up to n bytes with at most one read() system call.
docstring_tokens: Read up to n bytes with at most one read () system call .
function: 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
function_tokens: 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