U .e@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|dddhks td|fd|k}d|kp4| }|sB|sBtd|k}d} |rZ| d7} |rf| d7} t|| } |jd7_|dkrd}|d krtj}|d kr|std | S|r|rt| | |} n&|rt| |} n|stt | |} |r| St | |||} || _ | S) z: Backport of ``socket.makefile`` from Python 3.5. rwbz&invalid mode %r (only r, w, b allowed)Nrz!unbuffered streams must be binary) set ValueErrorAssertionErrorrZ_makefile_refsioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriter TextIOWrappermode) selfr bufferingencodingerrorsnewlineZwritingZreadingZbinaryZrawmoderawbuffertextrS/usr/lib/python3.8/site-packages/pip/_vendor/urllib3/packages/backports/makefile.pybackport_makefiles@   r)rNNNN)__doc__r Zsocketrrrrrrs