/usr/lib/python3.9/site-packages/urllib3/util/__pycache__
Edit: /usr/lib/python3.9/site-packages/urllib3/util/__pycache__/response.cpython-39.pyc (2301B)
a
t~®`¶
ã @ sP d dl mZ d dlmZmZ ddlmZ ddlmZ dd„ Z
dd „ Zd
d„ ZdS )
é )Úabsolute_import)Ú!MultipartInvariantViolationDefectÚStartBoundaryNotFoundDefecté )ÚHeaderParsingError)Úhttp_clientc C sf z
| ¡ W S ty Y n0 z| jW S ty8 Y n0 z| jdu W S tyX Y n0 tdƒ‚dS )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.)ZisclosedÚAttributeErrorÚclosedÚfpÚ
ValueError)Úobj© r
ú9/usr/lib/python3.9/site-packages/urllib3/util/response.pyÚis_fp_closed s
r c C sˆ t | tjƒstd t| ƒ¡ƒ‚t| ddƒ}t| ddƒ}d}|r^| ¡ s^|ƒ }t |tt fƒr^|}|rpdd„ |D ƒ}|sx|r„t
||d�‚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 S s g | ]}t |ttfƒs|‘qS r
)Ú
isinstancer r )Ú.0Zdefectr
r
r Ú
R s
ÿþz)assert_header_parsing..)r Ú
unparsed_data)r ÚhttplibZHTTPMessageÚ TypeErrorÚformatÚtypeÚgetattrZis_multipartÚbytesÚstrr )Zheadersr r r Zpayloadr
r
r Úassert_header_parsing( s þr c C s$ | 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.
é ZHEAD)Ú_methodr ÚintÚupper)ZresponseÚmethodr
r
r Úis_response_to_head^ s
r# N)
Z
__future__r Zemail.errorsr r Ú
exceptionsr Zpackages.six.movesr r r r r# r
r
r
r Ú s 6