
    nbi|                        d dl mZ d dlZd dlZd dlZd dlZej        rd dlmZ	 ddZ
ddZ G d d          ZddZddZdS )    )annotationsNobjobjectreturnboolc                    	 |                                  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)r   s    l/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/urllib3_future/util/response.pyis_fp_closedr      s     ||~~   z    v~    @
A
AAs)    
##. 
;;A 
AAvaluestr typing.Iterable[tuple[str, str]]c              #  ~   K   t          j        dt           j                  }t          j        ||           E d{V  dS )zGiven an Alt-Svc value, extract from it the protocol-id and the alt-authority.
    https://httpwg.org/specs/rfc7838.html#alt-svczD(h[0-9]{1,3}(?:[\-0-9]{0,5}))=(?:[\"\']?)([a-z0-9\-_:.]+)(?:[\"\']?)N)recompile
IGNORECASEfindall)r   patterns     r   parse_alt_svcr   +   sM       jO
 G
 z'5)))))))))))    c                  2    e Zd ZdZddZddZdd	ZddZdS )BytesQueueBuffera  Memory-efficient bytes buffer

    To return decoded data in read() and still follow the BufferedIOBase API, we need a
    buffer to always return the correct amount of bytes.

    This buffer should be filled using calls to put()

    Our maximum memory usage is determined by the sum of the size of:

     * self.buffer, which contains the full data
     * the largest chunk that we will copy in get()
    r   Nonec                D    t          j                    | _        d| _        d S )Nr   )collectionsdequebuffer_sizeselfs    r   __init__zBytesQueueBuffer.__init__D   s    ?J?P?R?R


r   intc                    | j         S N)r"   r#   s    r   __len__zBytesQueueBuffer.__len__H   s
    zr   databytesc                t    | j                             |           | xj        t          |          z  c_        d S r(   )r!   appendr"   len)r$   r*   s     r   putzBytesQueueBuffer.putK   s2    4   

c$ii



r   nc                0   |dk    rdS | j         st          d          |dk     rt          d          t          | j         d                   |k    rIt	          | j         d         t
                    r)| xj        |z  c_        | j                                         S d}t          j	                    }||k     r||z
  }| j                                         }t          |          }||k     rct          |          }|d |         ||d          }}|                    |           | j                             |           | xj        |z  c_        n8|                    |           | xj        |z  c_        ||z  }| j         sn||k     |                                S )Nr   r   zbuffer is emptyzn should be > 0)r!   RuntimeErrorr   r.   
isinstancer+   r"   popleftioBytesIO
memoryviewwrite
appendleftgetvalue)	r$   r0   fetchedret	remainingchunkchunk_length
left_chunkright_chunks	            r   getzBytesQueueBuffer.getO   s   663 	00111UU.///t{1~!##
4;q>5(I(I#JJ!OJJ;&&(((jllkkGIK''))Eu::L<''"5))*/

*;U9::=NK
		*%%%&&{333

i'

		%   

l*

|#G; # kk& ||~~r   N)r   r   )r   r&   )r*   r+   r   r   )r0   r&   r   r+   )__name__
__module____qualname____doc__r%   r)   r/   rB    r   r   r   r   6   sn                      ! ! ! ! ! !r   r   headershttplib.HTTPMessager   c                v   ddl mm ddlm} ddlm} t          | |j                  s t          dt          |            d          d}|                                 s2|                                 }t          |t          t          f          r|}fd| j        D             }|s|r |||	          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.
    r   )!MultipartInvariantViolationDefectStartBoundaryNotFoundDefect   )HeaderParsingErrorNzexpected httplib.Message, got .c                8    g | ]}t          |f          |S rG   )r3   ).0defectrK   rL   s     r   
<listcomp>z)assert_header_parsing.<locals>.<listcomp>   sE       02ST
 
  r   )defectsunparsed_data)email.errorsrK   rL   
exceptionsrN   http.clientclientr3   HTTPMessage	TypeErrortypeis_multipartget_payloadr+   r   rT   )rH   rN   httplibrU   payloadrT   rK   rL   s         @@r   assert_header_parsingra   s   s5           0/////!!!!!! gw233 KIgIIIJJJM !! $%%''gs|,, 	$#M    o  G  O- O  NNNNO Or   responsehttplib.HTTPResponsec                @    | 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)rb   
method_strs     r   is_response_to_headri      s#     !J''r   )r   r   r   r   )r   r   r   r   )rH   rI   r   r   )rb   rc   r   r   )
__future__r   r   r5   r   typingTYPE_CHECKINGrX   rY   r_   r   r   r   ra   ri   rG   r   r   <module>rm      s    " " " " " "     				 				 	 "!!!!!!B B B B>* * * *: : : : : : : :z7O 7O 7O 7Ot
( 
( 
( 
( 
( 
(r   