a *Na@s&dZddlZddlmZdddZdS)z backports.makefile ~~~~~~~~~~~~~~~~~~ Backports the Python 3 ``socket.makefile`` method for use with anything that wants to create a "fake" socket object. N)SocketIOrc Cst|hdkstd|fd|v}d|vp2| }|s@|s@Jd|v}d} |rX| d7} |rd| d7} t|| } |jd7_|durd }|d krtj}|d kr|std | S|r|rt| | |} n&|rt| |} n|sJt| |} |r| St | |||} || _ | S) z: Backport of ``socket.makefile`` from Python 3.5. >rbwz&invalid mode %r (only r, w, b allowed)rrrNrz!unbuffered streams must be binary) set ValueErrorrZ_makefile_refsioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriter TextIOWrappermode) selfr bufferingencodingerrorsnewlinewritingreadingbinaryrawmoderawbuffertextr~/private/var/folders/js/6pj4vh5d4zd0k6bxv74qrbhr0000gr/T/pip-target-22xwyzbs/lib/python/urllib3/packages/backports/makefile.pybackport_makefile s@   r )rNNNN)__doc__r socketrr rrrrs