Ë
    äÿæi«   ã                  ó.  — U d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ ddl	m
Z
 ddlmZ ej                  rd d	lmZ d
Z eg d¢«      ZdZ	 	 d dlZedz  Z	 ej.                  dk\  rd dlmZ nd dlmZ edz  Z G d„ de«      Zej:                  Zded<   ej@                  e!ef   Z"h d£Z#	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z$	 	 	 	 	 	 dd„Z%dd„Z& G d„ dejN                  «      Z(	 	 	 	 	 	 	 	 d d„Z)y# e$ r d dlZY Œ«w xY w# e$ r Y Œ±w xY w# e$ r Y Œšw xY w)!é    )ÚannotationsN)Ú	b64encode)ÚEnumé   )ÚUnrewindableBodyErroré   )Úto_bytes)ÚFinalz@@@SKIP_HEADER@@@)úaccept-encodingÚhostú
user-agentzgzip,deflatez,br)é   é   )Úzstdz,zstdc                  ó   — e Zd ZdZy)Ú_TYPE_FAILEDTELLr   N)Ú__name__Ú
__module__Ú__qualname__Útoken© ó    úi/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/urllib3/util/request.pyr   r   ,   s   „ Ø�Er   r   zFinal[_TYPE_FAILEDTELL]Ú_FAILEDTELL>   ÚGETÚHEADÚTRACEÚDELETEÚCONNECTÚOPTIONSc                ót  — i }|r>t        |t        «      rn(t        |t        «      rdj                  |«      }nt        }||d<   |r||d<   | rd|d<   |r.dt        |j                  d«      «      j                  «       › �|d<   |r.dt        |j                  d«      «      j                  «       › �|d	<   |rd
|d<   |S )aˆ  
    Shortcuts for generating request headers.

    :param keep_alive:
        If ``True``, adds 'connection: keep-alive' header.

    :param accept_encoding:
        Can be a boolean, list, or string.
        ``True`` translates to 'gzip,deflate'.  If the dependencies for
        Brotli (either the ``brotli`` or ``brotlicffi`` package) and/or
        Zstandard (the ``backports.zstd`` package for Python before 3.14)
        algorithms are installed, then their encodings are
        included in the string ('br' and 'zstd', respectively).
        List will get joined by comma.
        String will be used as provided.

    :param user_agent:
        String representing the user-agent you want, such as
        "python-urllib3/0.6"

    :param basic_auth:
        Colon-separated username:password string for 'authorization: basic ...'
        auth header.

    :param proxy_basic_auth:
        Colon-separated username:password string for 'proxy-authorization: basic ...'
        auth header.

    :param disable_cache:
        If ``True``, adds 'cache-control: no-cache' header.

    Example:

    .. code-block:: python

        import urllib3

        print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0"))
        # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'}
        print(urllib3.util.make_headers(accept_encoding=True))
        # {'accept-encoding': 'gzip,deflate'}
    Ú,r   r   z
keep-aliveÚ
connectionzBasic zlatin-1Úauthorizationzproxy-authorizationzno-cachezcache-control)Ú
isinstanceÚstrÚlistÚjoinÚACCEPT_ENCODINGr   ÚencodeÚdecode)Ú
keep_aliveÚaccept_encodingÚ
user_agentÚ
basic_authÚproxy_basic_authÚdisable_cacheÚheaderss          r   Úmake_headersr3   <   sÖ   € ðd !€GÙÜ�o¤sÔ+ØÜ˜¬Ô.Ø!Ÿh™h Ó7‰Oä-ˆOØ%4ˆÐ!Ñ"áØ *ˆ�ÑáØ ,ˆ�Ñáà”Y˜z×0Ñ0°Ó;Ó<×CÑCÓEÐFÐGð 	�Ñ ñ à”YÐ/×6Ñ6°yÓAÓB×IÑIÓKÐLÐMð 	Ð%Ñ&ñ Ø#-ˆ�Ñ à€Nr   c                ó’   — |�t        | |«       |S t        | dd«      �	 | j                  «       }|S |S # t        $ r
 t        }Y |S w xY w)z
    If a position is provided, move file to that point.
    Otherwise, we'll attempt to record a position for future use.
    NÚtell)Úrewind_bodyÚgetattrr5   ÚOSErrorr   )ÚbodyÚposs     r   Úset_file_positionr;   Ž   sc   € ð €Ü�D˜#Ôð €Jô 
��v˜tÓ	$Ð	0ð	Ø—)‘)“+ˆCð €Jˆ3€Jøô ò 	ô ‰Cà€Jð	ús   Ÿ3 ³AÁAc                óä   — t        | dd«      }|�t        |t        «      r
	  ||«       y|t
        u rt	        d«      ‚t        dt        |«      › d�«      ‚# t        $ r}t	        d«      |‚d}~ww xY w)zæ
    Attempt to rewind body to a certain position.
    Primarily used for request redirects and retries.

    :param body:
        File-like object that supports seek.

    :param int pos:
        Position to seek to in file.
    ÚseekNzAAn error occurred when rewinding request body for redirect/retry.zRUnable to record file position for rewinding request body during a redirect/retry.z1body_pos must be of type integer, instead it was Ú.)r7   r%   Úintr8   r   r   Ú
ValueErrorÚtype)r9   Úbody_posÚ	body_seekÚes       r   r6   r6   ¢   s�   € ô ˜˜f dÓ+€IØÐ¤¨H´cÔ!:ð	Ù�hÕð
 
”[Ñ	 Ü#ð4ó
ð 	
ô
 Ø?ÄÀXÃÐ?OÈqÐQó
ð 	
øô ò 	Ü'ØSóàðûð	ús   ¡A Á	A/ÁA*Á*A/c                  ó"   — e Zd ZU ded<   ded<   y)ÚChunksAndContentLengthztyping.Iterable[bytes] | NoneÚchunksz
int | NoneÚcontent_lengthN)r   r   r   Ú__annotations__r   r   r   rF   rF   À   s   … Ø)Ó)ØÔr   rF   c                ó¦  ‡ ‡— ‰ €d}|j                  «       t        vrd}nld}nit        ‰ t        t        f«      rt        ‰ «      f}t        |d   «      }n8t        ‰ d«      rdˆˆ fd„} |«       }d}n	 t        ‰ «      }‰ f}|j                  }t        ||¬«      S # t        $ r. 	 t        ‰ «      }d}n# t        $ r t        d‰ ›�«      d‚w xY wY ŒCw xY w)aR  Takes the HTTP request method, body, and blocksize and
    transforms them into an iterable of chunks to pass to
    socket.sendall() and an optional 'Content-Length' header.

    A 'Content-Length' of 'None' indicates the length of the body
    can't be determined so should use 'Transfer-Encoding: chunked'
    for framing instead.
    Nr   Úreadc               3  óš   •K  — t        ‰t        j                  «      } 	 ‰j                  ‰«      }|sy | r|j	                  d«      }|–— Œ,­w)Nzutf-8)r%   ÚioÚ
TextIOBaserK   r*   )r*   Ú	datablockÚ	blocksizer9   s     €€r   Úchunk_readablez&body_to_chunks.<locals>.chunk_readableæ   sK   øè ø€ Ü ¤b§m¡mÓ4ˆFØØ ŸI™I iÓ0�	Ù ØÙØ )× 0Ñ 0°Ó 9�IØ’ð ùs   ƒAAzO'body' must be a bytes-like object, file-like object, or iterable. Instead was )rG   rH   )Úreturnztyping.Iterable[bytes])ÚupperÚ_METHODS_NOT_EXPECTING_BODYr%   r&   Úbytesr	   ÚlenÚhasattrÚ
memoryviewÚnbytesÚ	TypeErrorÚiterrF   )r9   ÚmethodrP   rG   rH   rQ   Úmvs   ` `    r   Úbody_to_chunksr^   Å   sù   ù€ ð$ €|ØˆØ�<‰<‹>Ô!<Ñ<Ø‰Nà!‰Nô 
�Dœ3¤˜,Ô	'Ü˜4“.Ð"ˆÜ˜V A™Y›‰ô 
��vÔ	ö	 ñ  Ó!ˆØ‰ð	'ä˜DÓ!ˆBð �WˆFØŸY™YˆNä!¨ÀÔOÐOøô ò 		ðä˜d›�Ø!%‘øÜò Üð8Ø8<°xðAóð ððúñ ð			ús*   Á2B Â	CÂ#B1Â0CÂ1C
Ã
CÃC)NNNNNN)r,   úbool | Noner-   zbool | list[str] | str | Noner.   ú
str | Noner/   r`   r0   r`   r1   r_   rR   zdict[str, str])r9   z
typing.Anyr:   ú_TYPE_BODY_POSITION | NonerR   ra   )r9   ztyping.IO[typing.AnyStr]rB   Ú_TYPE_BODY_POSITIONrR   ÚNone)r9   ztyping.Any | Noner\   r&   rP   r?   rR   rF   )*Ú
__future__r   rM   ÚsysÚtypingÚbase64r   Úenumr   Ú
exceptionsr   Úutilr	   ÚTYPE_CHECKINGr
   ÚSKIP_HEADERÚ	frozensetÚSKIPPABLE_HEADERSr)   Ú
brotlicffiÚ_unused_module_brotliÚImportErrorÚbrotliÚversion_infoÚcompressionr   Ú_unused_module_zstdÚ	backportsr   r   r   rI   ÚUnionr?   rb   rT   r3   r;   r6   Ú
NamedTuplerF   r^   r   r   r   Ú<module>ry      s¼  ðÞ "ã 	Û 
Û Ý Ý å .Ý à	×ÒÝð "€ÙÒGÓHÐ à €ðð/Û2ð �uÑ€OðØ
×Ñ˜7Ò"Þ;å9ð �wÑ€Oô�tô ð (8×'=Ñ'=€Ð$Ó =à—l‘l 3Ð(8Ð#8Ñ9Ð ò WÐ ð #Ø59Ø!Ø!Ø#'Ø!%ðOØðOà2ðOð ðOð ð	Oð
 !ðOð ðOð óOðdØ
ðØ5ðàóó(
ô<˜V×.Ñ.ô ð
BPØ
ðBPØ%(ðBPØ58ðBPàôBPøðW ò /Ý.ð/ûàò 	Ùð	ûð ò 	Ùð	ús<   ÁC2 ÁD Ã2	C>Ã;D Ã=C>Ã>D ÄD	ÄD	ÄDÄD