U e. @shddlmZddlmZddlmZmZddlm Z dddd d Z d d d ddZ dddddZ dS)) annotationsN)!MultipartInvariantViolationDefectStartBoundaryNotFoundDefect)HeaderParsingErrorobjectbool)objreturncCslz |WStk rYnXz|jWStk r<YnXz |jdkWStk r^YnXtddS)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.)isclosedAttributeErrorclosedfp ValueError)r rC/opt/hc_python/lib/python3.8/site-packages/urllib3/util/response.py is_fp_closed s  rzhttplib.HTTPMessageNone)headersr cCsnt|tjs tdt|dd}|sF|}t|ttfrF|}dd|j D}|s^|rjt ||ddS)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 .NcSsg|]}t|ttfs|qSr) isinstancerr).0defectrrr Os z)assert_header_parsing..)defects unparsed_data) rhttplib HTTPMessage TypeErrortype is_multipart get_payloadbytesstrrr)rrpayloadrrrrassert_header_parsing(s  r%zhttplib.HTTPResponse)responser cCs|j}|dkS)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)_methodupper)r&Z method_strrrris_response_to_head[s r*) __future__r http.clientclientrZ email.errorsrr exceptionsrrr%r*rrrrs   3