
    Lg                     L    d dl mZ d dlmZmZ ddlmZ ddlmZ	 d Z
d Zd Zd	S )
    )absolute_import)!MultipartInvariantViolationDefectStartBoundaryNotFoundDefect   )HeaderParsingError)http_clientc                     	 |                                  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 nw xY wt	          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    ]/var/www/html/4nations/venv/lib/python3.11/site-packages/pip/_vendor/urllib3/util/response.pyis_fp_closedr   	   s     ||~~   z    v~    @
A
AAs)    
##. 
;;A 
AAc                    t          | t          j                  s/t          d                    t          |                               t          | dd          }t          | dd          }d}|r<|                                 s( |            }t          |t          t          f          r|}|rd |D             }|s|rt          ||          dS )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          |t          t          f          |!S  )
isinstancer   r   ).0defects     r   
<listcomp>z)assert_header_parsing.<locals>.<listcomp>R   sD     
 
 
46WX 

 
 
    )r   unparsed_data)r   httplibHTTPMessage	TypeErrorformattypegetattris_multipartbytesstrr   )headersr   r   r   payloads        r   assert_header_parsingr(   (   s     gw233 T<CCDMMRRSSSgy$//G'=$77KM ( ##%% 	(!kmmG'E3<00 ( ' 

 
!
 
 
  O- O NNNNO Or   c                 v    | j         }t          |t                    r|dk    S |                                dk    S )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##r   N)
__future__r   email.errorsr   r   
exceptionsr   packages.six.movesr   r   r   r(   r1   r   r   r   <module>r6      s    & & & & & & W W W W W W W W + + + + + + 7 7 7 7 7 7B B B>3O 3O 3Ol$ $ $ $ $r   