(self, mode="r", buffering=None, *,
                 encoding=None, errors=None, newline=None)
return text
makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename, except the only
        supported mode values are 'r' (default), 'w' and 'b'.
makefile(...) -> an I/O stream connected to the socket
makefile ( ... ) - > an I / O stream connected to the socket
def makefile(self, mode="r", buffering=None, *,
                 encoding=None, errors=None, newline=None):
        """makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename, except the only
        supported mode values are 'r' (default), 'w' and 'b'.
        """
        # XXX refactor to share code?
        if not set(mode) <= {"r", "w", "b"}:
            raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
        writing = "w" in mode
        reading = "r" in mode or not writing
        assert reading or writing
        binary = "b" in mode
        rawmode = ""
        if reading:
            rawmode += "r"
        if writing:
            rawmode += "w"
        raw = SocketIO(self, rawmode)
        self._io_refs += 1
        if buffering is None:
            buffering = -1
        if buffering < 0:
            buffering = io.DEFAULT_BUFFER_SIZE
        if buffering == 0:
            if not binary:
                raise ValueError("unbuffered streams must be binary")
            return raw
        if reading and writing:
            buffer = io.BufferedRWPair(raw, raw, buffering)
        elif reading:
            buffer = io.BufferedReader(raw, buffering)
        else:
            assert writing
            buffer = io.BufferedWriter(raw, buffering)
        if binary:
            return buffer
        encoding = io.text_encoding(encoding)
        text = io.TextIOWrapper(buffer, encoding, errors, newline)
        text.mode = mode
        return text
def makefile ( self , mode = "r" , buffering = None , * , encoding = None , errors = None , newline = None ) : # XXX refactor to share code? if not set ( mode ) <= { "r" , "w" , "b" } : raise ValueError ( "invalid mode %r (only r, w, b allowed)" % ( mode , ) ) writing = "w" in mode reading = "r" in mode or not writing assert reading or writing binary = "b" in mode rawmode = "" if reading : rawmode += "r" if writing : rawmode += "w" raw = SocketIO ( self , rawmode ) self . _io_refs += 1 if buffering is None : buffering = - 1 if buffering < 0 : buffering = io . DEFAULT_BUFFER_SIZE if buffering == 0 : if not binary : raise ValueError ( "unbuffered streams must be binary" ) return raw if reading and writing : buffer = io . BufferedRWPair ( raw , raw , buffering ) elif reading : buffer = io . BufferedReader ( raw , buffering ) else : assert writing buffer = io . BufferedWriter ( raw , buffering ) if binary : return buffer encoding = io . text_encoding ( encoding ) text = io . TextIOWrapper ( buffer , encoding , errors , newline ) text . mode = mode return text