HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/urllib3/packages/backports/__pycache__/makefile.cpython-310.pyc
o

�~�`��@s(dZddlZddlmZ	ddd�ZdS)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
Cst|�hd�kstd|f��d|v}d|vp|}|s |s J�d|v}d}	|r,|	d7}	|r2|	d7}	t||	�}
|jd7_|durDd	}|d
krKtj}|d
krW|sUtd��|
S|rc|rct�|
|
|�}n|rlt�|
|�}n
|spJ�t�|
|�}|rz|St�	||||�}||_
|S)z:
    Backport of ``socket.makefile`` from Python 3.5.
    >�br�wz&invalid mode %r (only r, w, b allowed)rrr��N���rz!unbuffered streams must be binary)�set�
ValueErrorr�_makefile_refs�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
�selfr�	buffering�encoding�errors�newline�writing�reading�binary�rawmode�raw�buffer�text�r�E/usr/lib/python3/dist-packages/urllib3/packages/backports/makefile.py�backport_makefile
s@
r!)rNNNN)�__doc__r�socketrr!rrrr �<module>s
�