Read a single line from rfile buffer and return it.

        Args:
            size (int): minimum amount of data to read

        Returns:
            bytes: One line from rfile.
331526
def readline(self, size=None):
        
        if size is not None:
            data = self.rfile.readline(size)
            self.bytes_read += len(data)
            self._check_length()
            return data

        # User didn't specify a size ...
        # We read the line in chunks to make sure it's not a 100MB line !
        res = []
        while True:
            data = self.rfile.readline(256)
            self.bytes_read += len(data)
            self._check_length()
            res.append(data)
            # See https://github.com/cherrypy/cherrypy/issues/421
            if len(data) < 256 or data[-1:] == LF:
                return EMPTY.join(res)
151524
def streamRead(self, size):
        
        size = int(size)
        data = self.stream.read(size)
        size = len(data)
        if size == 0:
            self._close()
            return dict(message="Finished", size=0)

        self._sendResult(dict(message="reading...", stream=True, size=size))
        sys.stdout.write(data)
1023354
def read(self, size):
        
        data = None
        while True:
            try:
                data = self.handle.recv(size)
            except socket.timeout as socket_error:
                self._reconnect(socket_error)
            except socket.error as socket_error:
                # this is fine, just retry
                if socket_error.errno == errno.EINTR:
                    continue
                self._reconnect(IOError)
            if not data:
                self._reconnect(IOError)
            break
        return data
373168
def read(self, size=1024):
        
        data = self.fileobj.recv(size)
        if not data:
            self.flag_eof = True
            raise EOFError('Pty is closed')

        return self.decoder.decode(data, final=False)
1055370
def _peek(self, size=-1):
        
        with self._seek_lock:
            seek = self._seek
        with handle_os_exceptions():
            return self._read_range(seek, seek + size)
394287
def readline(self, size = None):
        ''''''

        if self.closed: raise ValueError('file closed')
        if self._mode in _allowed_write:
            raise Exception('file opened for write only')
        if self._read_finished: return None

        line = b''
        while not line.endswith(b'\n') and not self._read_finished and (size is None or len(line) <= size):
            line += self.read(1)
        return line
929304
def read(self, size=1):
        
        if self.is_closed_flag:
            raise Exception("Unable to read - already closed!")
        if self.get_remaining_size() < size:
            raise Exception("Unable to read byte buffer - too short remaining data size!")
        self.read_count += size
        return self.file.read(size)
261619
def __read(self, size):
        
        c = len(self.buf)
        while c < size:
            buf = self.fileobj.read(self.bufsize)
            if not buf:
                break
            self.buf += buf
            c += len(buf)
        buf = self.buf[:size]
        self.buf = self.buf[size:]
        return buf
948117
def read(self, size = None):
        
        r = self._buffer
        self._buffer = b''
        if size is not None:
            size -= len(r)
        r = r + self._response.read(size)
        return r
232560
def readline(self, size=None):
        """"""

# TODO: Add support for Unicode.
        (line, nl) = self.__buffer.read_until_nl(self.__retrieve_data)

        if self.__sf.access_type_has_universal_nl and nl is not None:
            self.__newlines[nl] = True

        return line
551243
def _read(self, size):
        
        data = ''
        while len(data) < size:
            try:
                chunk = self.socket.recv(size-len(data))
            except socket.error as (err, msg):
                self.connected = False
                raise ScratchError("[Errno %d] %s" % (err, msg))
            if chunk == '':
                self.connected = False
                raise ScratchConnectionError("Connection broken")
            data += chunk
        return data
1161275
def recv(self, size = None):
        

        size = size if size is not None else 1500

        return os.read(self.fd, size)
916873
def read_bytes(self, length) -> bytes:
        
        value = self.stream.read(length)
        return value
582681
def read(self, size = None):
        
        r = self._buffer
        self._buffer = bytes()
        if size is not None:
            size -= len(r)
        r = r + self._response.read(size)
        #raise RuntimeError
        return r
218995
def recv(self, size):
        
        try:
            start = datetime.now()
            while len(self.buffer) < size:
                if self.timeout is not None:
                    elapsed = (datetime.now() - start).microseconds
                    timeout = self.timeout * 1000 * 1000  # to microseconds
                    if elapsed >= timeout:
                        raise socket.timeout()
                r, w, x = select([self.process.stdout], [], [], 0.0)
                if r and r[0] == self.process.stdout:
                    b = os.read(self.process.stdout.fileno(), 1)
                    # Store in class-level buffer for persistence across
                    # timeouts; this makes us act more like a real socket
                    # (where timeouts don't actually drop data.)
                    self.buffer.append(b)
            result = ''.join(self.buffer)
            self.buffer = []
            return result
        except socket.timeout:
            raise  # socket.timeout is a subclass of IOError
        except IOError as e:
            raise ProxyCommandFailure(' '.join(self.cmd), e.strerror)
120843
async def read_chunk(self, size: int=chunk_size) -> bytes:
        
        if self._at_eof:
            return b''
        if self._length:
            chunk = await self._read_chunk_from_length(size)
        else:
            chunk = await self._read_chunk_from_stream(size)

        self._read_bytes += len(chunk)
        if self._read_bytes == self._length:
            self._at_eof = True
        if self._at_eof:
            newline = await self._content.readline()
            assert newline == self._newline, \
                'reader did not read all the data or it is malformed'
        return chunk
1029597
def read(self, size=None):
        
        if size is None:
            size = self.size - self.position
        else:
            size = min(size, self.size - self.position)

        buf = b""
        while size > 0:
            while True:
                data, start, stop, offset = self.map[self.map_index]
                if start <= self.position < stop:
                    break
                else:
                    self.map_index += 1
                    if self.map_index == len(self.map):
                        self.map_index = 0
            length = min(size, stop - self.position)
            if data:
                self.fileobj.seek(offset + (self.position - start))
                buf += self.fileobj.read(length)
            else:
                buf += NUL * length
            size -= length
            self.position += length
        return buf