�
��fg�
��L�ddlmZddlmZmZddlmZddlmZ d�Z
d�Zd�Zd S)
�)�absolute_import)�!MultipartInvariantViolationDefect�StartBoundaryNotFoundDefect�)�HeaderParsingError)�http_clientc��� |���S#t$rYnwxYw |jS#t$rYnwxYw |jduS#t$rYnwxYwt d���)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����
�
�
���
����
��v��~����
�
�
���
�����@�
A�
A�As)��
#�#�.�
;�;�A�
A�Ac��t|tj��s/td�t|�������t
|dd��}t
|dd��}d}|r<|���s(|��}t|ttf��r|}|rd�|D��}|s|rt||����dS)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.
z"expected httplib.Message, got {0}.�defectsN�get_payloadc�J�g|] }t|ttf���|��!S�)�
isinstancerr)�.0�defects r�
<listcomp>z)assert_header_parsing.<locals>.<listcomp>RsD��
�
�
����4�6W�X���
��
�
�
�)r�
unparsed_data)r�httplib�HTTPMessage� TypeError�format�type�getattr�is_multipart�bytes�strr)�headersrrr�payloads r�assert_header_parsingr((s���g�w�2�3�3�T��<�C�C�D��M�M�R�R�S�S�S��g�y�$�/�/�G��'�=�$�7�7�K��M��(��#�#�%�%� (�!�k�m�m�G��'�E�3�<�0�0�
(� '�
��
�
�
�!�
�
�
���O�-�O� ��
�N�N�N�N�O�Orc�v�|j}t|t��r|dkS|���dkS)z�
Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine.
:param http.client.HTTPResponse response:
Response to check if the originating request
used 'HEAD' as a method.
��HEAD)�_methodr�int�upper)�response�methods r�is_response_to_headr1^s;���
�F��&�#������{���<�<�>�>�V�#�#rN)
�
__future__r�email.errorsrr�
exceptionsr� six.movesrrrr(r1rrr�<module>r6s���&�&�&�&�&�&�W�W�W�W�W�W�W�W�+�+�+�+�+�+�,�,�,�,�,�,�B�B�B�>3O�3O�3O�l
$�
$�
$�
$�
$r |