parameters: (self, size = -1)
return_statement: return buf + "\n"
docstring: Read a line with approx. size. If size is negative,
             read a whole line.
docstring_summary: Read a line with approx. size. If size is negative,
             read a whole line.
docstring_tokens: Read a line with approx . size . If size is negative read a whole line .
function: def readline(self, size = -1):
          """Read a line with approx. size. If size is negative,
             read a whole line.
          """
          if size < 0:
              size = sys.maxint
          elif size == 0:
              return ''
  
          # check for a newline already in buffer
          nl, nllen = self._checkfornewline()
  
          if nl >= 0:
              # the next line was already in the buffer
              nl = min(nl, size)
          else:
              # no line break in buffer - try to read more
              size -= len(self.linebuffer)
              while nl < 0 and size > 0:
                  buf = self.read(min(size, 100))
                  if not buf:
                      break
                  self.linebuffer += buf
                  size -= len(buf)
  
                  # check for a newline in buffer
                  nl, nllen = self._checkfornewline()
  
              # we either ran out of bytes in the file, or
              # met the specified size limit without finding a newline,
              # so return current buffer
              if nl < 0:
                  s = self.linebuffer
                  self.linebuffer = ''
                  return s
  
          buf = self.linebuffer[:nl]
          self.lastdiscard = self.linebuffer[nl:nl + nllen]
          self.linebuffer = self.linebuffer[nl + nllen:]
  
          # line is always returned with \n as newline char (except possibly
          # for a final incomplete line in the file, which is handled above).
          return buf + "\n"
function_tokens: def readline ( self , size = - 1 ) : if size < 0 : size = sys . maxint elif size == 0 : return '' # check for a newline already in buffer nl , nllen = self . _checkfornewline ( ) if nl >= 0 : # the next line was already in the buffer nl = min ( nl , size ) else : # no line break in buffer - try to read more size -= len ( self . linebuffer ) while nl < 0 and size > 0 : buf = self . read ( min ( size , 100 ) ) if not buf : break self . linebuffer += buf size -= len ( buf ) # check for a newline in buffer nl , nllen = self . _checkfornewline ( ) # we either ran out of bytes in the file, or # met the specified size limit without finding a newline, # so return current buffer if nl < 0 : s = self . linebuffer self . linebuffer = '' return s buf = self . linebuffer [ : nl ] self . lastdiscard = self . linebuffer [ nl : nl + nllen ] self . linebuffer = self . linebuffer [ nl + nllen : ] # line is always returned with \n as newline char (except possibly # for a final incomplete line in the file, which is handled above). return buf + "\n"