HOME


Mini Shell 1.0
DIR: /usr/lib/python3/dist-packages/urllib3/util/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/urllib3/util/__pycache__/response.cpython-312.pyc
�

�g.
��P�ddlmZddlmZddlmZmZddlm	Z	d	d�Z
d
d�Zdd�Zy)�)�annotationsN)�!MultipartInvariantViolationDefect�StartBoundaryNotFoundDefect�)�HeaderParsingErrorc���	|j�S#t$rYnwxYw	|jS#t$rYnwxYw	|jduS#t$r
Yt	d��wxYw)zt
    Checks whether a given file-like object is closed.

    :param obj:
        The file-like object to check.
    Nz)Unable to determine whether fp is closed.)�isclosed�AttributeError�closed�fp�
ValueError)�objs �7/usr/lib/python3/dist-packages/urllib3/util/response.py�is_fp_closedr	s{��
��|�|�~����
��
��
��z�z����
��
��
��v�v��~����
��
�@�
A�A�
�s)��	��.�	:�:�
A�	A"�!A"c�f�t|tj�stdt	|��d���d}|j�s(|j
�}t|ttf�r|}|jD�cgc]}t|ttf�s|��}}|s|r
t||���ycc}w)a>
    Asserts whether all headers have been successfully parsed.
    Extracts encountered errors from the result of parsing headers.

    Only works on Python 3.

    :param http.client.HTTPMessage headers: Headers to verify.

    :raises urllib3.exceptions.HeaderParsingError:
        If parsing errors are found.
    zexpected httplib.Message, got �.N)�defects�
unparsed_data)
�
isinstance�httplib�HTTPMessage�	TypeError�type�is_multipart�get_payload�bytes�strrrrr)�headersr�payload�defectrs     r�assert_header_parsingr!(s����g�w�2�2�3��8��g���q�I�J�J��M����!��%�%�'���g��s�|�,�#�M��o�o�����0�2S�T�
�	��G���-� ��
�N�N� ��s�;B.c�@�|j}|j�dk(S)z�
    Checks whether the request of a response has been a HEAD-request.

    :param http.client.HTTPResponse response:
        Response to check if the originating request
        used 'HEAD' as a method.
    �HEAD)�_method�upper)�response�
method_strs  r�is_response_to_headr([s#���!�!�J������'�'�)r�object�return�bool)rzhttplib.HTTPMessager+�None)r&zhttplib.HTTPResponser+r,)
�
__future__r�http.client�clientr�email.errorsrr�
exceptionsrrr!r(�r)r�<module>r4s#��"��W�+�B�>0O�f
(r)