3
ãde‰  ã               @   s&   d Z ddlZddlmZ 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p4| }|sB|sBt‚d|k}d}	|rZ|	d7 }	|rf|	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|
|
|ƒ}n&|rÚtj|
|ƒ}n|sât‚tj	|
|ƒ}|rö|S t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   úZ/var/www/agendate/envp3/lib/python3.6/site-packages/urllib3/packages/backports/makefile.pyÚbackport_makefile   s@    
r!   )r   NNNN)Ú__doc__r   Úsocketr   r!   r   r   r   r    Ú<module>   s   