
    g.                    P    d dl mZ d dlmZ d dlmZmZ ddlm	Z	 d	dZ
d
dZddZy)    )annotationsN)!MultipartInvariantViolationDefectStartBoundaryNotFoundDefect   )HeaderParsingErrorc                    	 | j                         S # t        $ r Y nw xY w	 | j                  S # t        $ r Y nw xY w	 | j                  du S # t        $ r Y t	        d      w xY w)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    U/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/urllib3/util/response.pyis_fp_closedr   	   s{     ||~ zz  vv~ 
@
AAs)    	. 	::A 	A"!A"c                f   t        | t        j                        st        dt	        |        d      d}| j                         s(| j                         }t        |t        t        f      r|}| j                  D cg c]  }t        |t        t        f      s| }}|s|rt        ||      yc c}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.
    zexpected httplib.Message, got .N)defectsunparsed_data)
isinstancehttplibHTTPMessage	TypeErrortypeis_multipartget_payloadbytesstrr   r   r   r   )headersr   payloaddefectr   s        r   assert_header_parsingr!   (   s     gw2238gqIJJM !%%'gs|,#M oo%F02ST
 	%   - NN  s   ;B.c                @    | j                   }|j                         dk(  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)r   zhttplib.HTTPMessager+   None)r&   zhttplib.HTTPResponser+   r,   )
__future__r   http.clientclientr   email.errorsr   r   
exceptionsr   r   r!   r(    r)   r   <module>r4      s#    "  W +B>0Of
(r)   