
Kh                 @   sA   d  Z  d d l Z d d l m Z d d d d d d d  Z d S)z
backports.makefile
~~~~~~~~~~~~~~~~~~

Backports the Python 3 ``socket.makefile`` method for use with anything that
wants to create a "fake" socket object.
    N)SocketIOrc             C   s  t  |  d d d h k s. t d | f   d | k } d | k pJ | } | s_ | s_ t  d | k } d }	 | r |	 d 7}	 | r |	 d 7}	 t |  |	  }
 |  j d 7_ | d k r d
 } | d k  r t j } | d k r | s t d	   |
 S| r| rt j |
 |
 |  } n9 | r7t j |
 |  } n | sCt  t j	 |
 |  } | r_| St j
 | | | |  } | | _ | S)z:
    Backport of ``socket.makefile`` from Python 3.5.
    r   wbz&invalid mode %r (only r, w, b allowed)    Nr   z!unbuffered streams must be binary)set
ValueErrorAssertionErrorr   Z_makefile_refsioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriterTextIOWrappermode)selfr   	bufferingencodingerrorsnewlinewritingreadingbinaryrawmoderawbuffertext r   _/mod/web/acousticsspace/venv/lib/python3.5/site-packages/urllib3/packages/backports/makefile.pybackport_makefile   s@    

		r!   )__doc__r   socketr   r!   r   r   r   r    <module>   s   