
    hC                    B   S SK Jr  S SKrS SKJr  S SKJrJr  S SKJ	r	  \R                  (       a  S SKJr  S SKJr   " S S	\5      rS
S/r\R                   " S5      r\R                   " S5      r\R                   " S5      r\R(                  S\R*                  \\4   \R.                  \\\4      S	4   r " S S\5      r    SS jr " S S
\R8                  \\4   \R:                  \\4   5      r " S S\\\\4      5      r  " S S\R:                  \\4   5      r!g)    )annotationsN)OrderedDict)Enumauto)RLock)Protocol)Selfc                  (    \ rS rSrSS jrSS jrSrg)HasGettableStringKeys   c                    g N selfs    F/var/www/html/env/lib/python3.13/site-packages/urllib3/_collections.pykeysHasGettableStringKeys.keys           c                    g r   r   r   keys     r   __getitem__!HasGettableStringKeys.__getitem__   r   r   r   Nreturnztyping.Iterator[str]r   strr   r   )__name__
__module____qualname____firstlineno__r   r   __static_attributes__r   r   r   r   r      s    33r   r   RecentlyUsedContainerHTTPHeaderDict_KT_VT_DTc                  "    \ rS rSr\" 5       rSrg)	_Sentinel'   r   N)r    r!   r"   r#   r   
not_passedr$   r   r   r   r+   r+   '   s	    Jr   r+   c                   [        U [        5      (       a  U $ [        U [        R                  5      (       a2  [        R                  " [        R                  [
        [
        4   U 5      $ [        U [        R                  5      (       a9  [        R                  " [        R                  [        [
        [
        4      U 5      $ [        U S5      (       a(  [        U S5      (       a  [        R                  " SU 5      $ g )Nr   r   r   )	
isinstancer&   typingMappingcastr   Iterabletuplehasattr)	potentials    r   %ensure_can_construct_http_header_dictr7   +   s     )^,,	Iv~~	.	. {{6>>#s(3Y??	Iv	/	/ {{6??5c?;YGG	F	#	#	=(I(I{{2I>>r   c                     ^  \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'     S     SU 4S jjjrSS jrSS jrSS jr	SS jr
SS jrSS jrSS jrSrU =r$ )r%   ?   am  
Provides a thread-safe dict-like container which maintains up to
``maxsize`` keys while throwing away the least-recently-used keys beyond
``maxsize``.

:param maxsize:
    Maximum number of recent elements to retain.

:param dispose_func:
    Every time an item is evicted from the container,
    ``dispose_func(value)`` is called.  Callback which will get called
ztyping.OrderedDict[_KT, _VT]
_containerint_maxsize#typing.Callable[[_VT], None] | Nonedispose_funcr   lockc                v   > [         TU ]  5         Xl        X l        [	        5       U l        [        5       U l        g r   )super__init__r<   r>   r   r:   r   r?   )r   maxsizer>   	__class__s      r   rB   RecentlyUsedContainer.__init__R   s-    
 	(%-G	r   c                    U R                      U R                  R                  U5      nX R                  U'   UsS S S 5        $ ! , (       d  f       g = fr   )r?   r:   pop)r   r   items      r   r   !RecentlyUsedContainer.__getitem__]   s6    YY??&&s+D#'OOC  YYs   +A
Ac                   S nU R                       XR                  R                  U5      4nX R                  U'   S S S 5        Ub(  U R                  (       a  Uu  pEU R                  U5        g g g ! [         aM    X R                  U'   [	        U R                  5      U R
                  :  a  U R                  R                  SS9n Nf = f! , (       d  f       N= f)NF)last)r?   r:   rG   KeyErrorlenr<   popitemr>   )r   r   valueevicted_item_evicted_values         r   __setitem__!RecentlyUsedContainer.__setitem__d   s    YYG  #OO$7$7$<<',$ & #(9(9+Am, ):#  G (-$t'$--7 $(??#:#:#:#FLG Ys)   C	*A//ACC	CC		
Cc                    U R                      U R                  R                  U5      nS S S 5        U R                  (       a  U R                  W5        g g ! , (       d  f       N2= fr   )r?   r:   rG   r>   )r   r   rO   s      r   __delitem__!RecentlyUsedContainer.__delitem__}   sH    YYOO'',E  e$  Ys   A
A#c                z    U R                      [        U R                  5      sS S S 5        $ ! , (       d  f       g = fr   )r?   rM   r:   r   s    r   __len__RecentlyUsedContainer.__len__   s    YYt' YYs   ,
:c                    [        S5      e)Nz7Iteration over this class is unlikely to be threadsafe.)NotImplementedErrorr   s    r   __iter__RecentlyUsedContainer.__iter__   s    !E
 	
r   c                "   U R                      [        U R                  R                  5       5      nU R                  R	                  5         S S S 5        U R
                  (       a  W H  nU R                  U5        M     g g ! , (       d  f       N;= fr   )r?   listr:   valuesclearr>   )r   ra   rO   s      r   rb   RecentlyUsedContainer.clear   se    YY$//0023FOO!!# 
 !!%(    Ys   >B  
Bc                    U R                      [        U R                  R                  5       5      sS S S 5        $ ! , (       d  f       g = fr   )r?   setr:   r   r   s    r   r   RecentlyUsedContainer.keys   s(    YYt++-. YYs	   #:
A)r:   r<   r>   r?   )
   N)rC   r;   r>   r=   r   None)r   r'   r   r(   )r   r'   rO   r(   r   rh   )r   r'   r   rh   r   r;   )r   ztyping.NoReturn)r   rh   )r   zset[_KT])r    r!   r"   r#   __doc____annotations__rB   r   rS   rV   rY   r]   rb   r   r$   __classcell__rD   s   @r   r%   r%   ?   sv     -,M55
K <@		 :	 
		 	-2%(

)/ /r   c                  L    \ rS rSr% SrS\S'   SS jrSS jrSS jrSS jr	S	r
g
)HTTPHeaderDictItemView   a;  
HTTPHeaderDict is unusual for a Mapping[str, str] in that it has two modes of
address.

If we directly try to get an item with a particular name, we will get a string
back that is the concatenated version of all the values:

>>> d['X-Header-Name']
'Value1, Value2, Value3'

However, if we iterate over an HTTPHeaderDict's items, we will optionally combine
these values based on whether combine=True was called when building up the dictionary

>>> d = HTTPHeaderDict({"A": "1", "B": "foo"})
>>> d.add("A", "2", combine=True)
>>> d.add("B", "bar")
>>> list(d.items())
[
    ('A', '1, 2'),
    ('B', 'foo'),
    ('B', 'bar'),
]

This class conforms to the interface required by the MutableMapping ABC while
also giving us the nonstandard iteration behavior we want; items with duplicate
keys, ordered by time of first insertion.
r&   _headersc                    Xl         g r   rq   )r   headerss     r   rB   HTTPHeaderDictItemView.__init__   s    r   c                Z    [        [        U R                  R                  5       5      5      $ r   )rM   r`   rq   	iteritemsr   s    r   rY   HTTPHeaderDictItemView.__len__   s    4//1233r   c                6    U R                   R                  5       $ r   )rq   rw   r   s    r   r]   HTTPHeaderDictItemView.__iter__   s    }}&&((r   c                    [        U[        5      (       aX  [        U5      S:X  aI  Uu  p#[        U[        5      (       a0  [        U[        5      (       a  U R                  R                  X#5      $ g)N   F)r/   r4   rM   r   rq   _has_value_for_header)r   rH   
passed_key
passed_vals       r   __contains__#HTTPHeaderDictItemView.__contains__   sR    dE""s4yA~%)"J*c**z*c/J/J}}:::RRr   rs   N)rt   r&   r   rh   ri   r   z typing.Iterator[tuple[str, str]])rH   objectr   bool)r    r!   r"   r#   rj   rk   rB   rY   r]   r   r$   r   r   r   ro   ro      s#    8  4)r   ro   c                    ^  \ rS rSr% SrS\S'   S#S$U 4S jjjrS%S jrS&S jrS'S jr	S(S	 jr
S)S*U 4S
 jjjrS+S jrS+S jrS,S jrS-S jrS'S jrSS.S.S jjrS/S jr\R(                  S0S j5       r\R(                  S1S j5       r\R.                  4     S2S jjrS3S jr\r\r\r\rS4S jrS5S jrS3S jrS6S jr S6S jr!S7S jr"S8S jr#S9S jr$S:S  jr%S:S! jr&S"r'U =r($ );r&      a  
:param headers:
    An iterable of field-value pairs. Must not contain multiple field names
    when compared case-insensitively.

:param kwargs:
    Additional field-value pairs to pass in to ``dict.update``.

A ``dict`` like container for storing HTTP Headers.

Field names are stored and compared case-insensitively in compliance with
RFC 7230. Iteration provides the first case-sensitive key seen for each
case-insensitive pair.

Using ``__setitem__`` syntax overwrites fields that compare equal
case-insensitively in order to maintain ``dict``'s api. For fields that
compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add``
in a loop.

If multiple fields that are equal case-insensitively are passed to the
constructor or ``.update``, the behavior is undefined and some will be
lost.

>>> headers = HTTPHeaderDict()
>>> headers.add('Set-Cookie', 'foo=bar')
>>> headers.add('set-cookie', 'baz=quxx')
>>> headers['content-length'] = '7'
>>> headers['SET-cookie']
'foo=bar, baz=quxx'
>>> headers['Content-Length']
'7'
z%typing.MutableMapping[str, list[str]]r:   c                   > [         TU ]  5         0 U l        Ub8  [        U[        5      (       a  U R                  U5        OU R                  U5        U(       a  U R                  U5        g g r   )rA   rB   r:   r/   r&   
_copy_fromextend)r   rt   kwargsrD   s      r   rB   HTTPHeaderDict.__init__   sT    '>22(G$KK r   c                    [        U[        5      (       a  UR                  S5      nX/U R                  UR	                  5       '   g )Nlatin-1)r/   bytesdecoder:   lowerr   r   vals      r   rS   HTTPHeaderDict.__setitem__   s3    c5!!**Y'C(+z		$r   c                d    U R                   UR                  5          nSR                  USS  5      $ )N,    r:   r   joinr   s      r   r   HTTPHeaderDict.__getitem__  s+    oociik*yyQR!!r   c                :    U R                   UR                  5       	 g r   r:   r   r   s     r   rV   HTTPHeaderDict.__delitem__  s    OOCIIK(r   c                h    [        U[        5      (       a  UR                  5       U R                  ;   $ gNF)r/   r   r   r:   r   s     r   r   HTTPHeaderDict.__contains__  s'    c399;$//11r   c                "   > [         TU ]  X5      $ r   )rA   
setdefault)r   r   defaultrD   s      r   r   HTTPHeaderDict.setdefault  s    w!#//r   c                ,   [        U5      nUc  g[        U 5      " U5      nU R                  5        VVs0 s H  u  pEUR                  5       U_M     snnUR                  5        VVs0 s H  u  pEUR                  5       U_M     snn:H  $ s  snnf s  snnf r   )r7   type
itermergedr   )r   othermaybe_constructableother_as_http_header_dictkvs         r   __eq__HTTPHeaderDict.__eq__  s    CEJ&(,T
3F(G%)-):;):	1):;%>%I%I%K@
%KTQAGGIqL%K@
 
 	
; @
s   B
'Bc                .    U R                  U5      (       + $ r   )r   )r   r   s     r   __ne__HTTPHeaderDict.__ne__  s    ;;u%%%r   c                ,    [        U R                  5      $ r   )rM   r:   r   s    r   rY   HTTPHeaderDict.__len__  s    4??##r   c              #  \   #    U R                   R                  5        H
  nUS   v   M     g 7f)Nr   )r:   ra   )r   valss     r   r]   HTTPHeaderDict.__iter__!  s%     OO**,Dq'M -s   *,c                *     X	 g ! [          a     g f = fr   )rL   r   s     r   discardHTTPHeaderDict.discard&  s    		 		s    
F)combinec               &   [        U[        5      (       a  UR                  S5      nUR                  5       nX/nU R                  R                  XE5      nXVLa9  [        U5      S:  d   eU(       a  US   S-   U-   US'   gUR                  U5        gg)a  Adds a (name, value) pair, doesn't overwrite the value if it already
exists.

If this is called with combine=True, instead of adding a new header value
as a distinct item during iteration, this will instead append the value to
any existing header value with a comma. If no existing header value exists
for the key, then the value will simply be added, ignoring the combine parameter.

>>> headers = HTTPHeaderDict(foo='bar')
>>> headers.add('Foo', 'baz')
>>> headers['foo']
'bar, baz'
>>> list(headers.items())
[('foo', 'bar'), ('foo', 'baz')]
>>> headers.add('foo', 'quz', combine=True)
>>> list(headers.items())
[('foo', 'bar, baz, quz')]
r   r|   r   N)r/   r   r   r   r:   r   rM   append)r   r   r   r   	key_lowernew_valsr   s          r   addHTTPHeaderDict.add,  s    ( c5!!**Y'CIIK	:)))> t9>!>8d?S0RC   r   c                l   [        U5      S:  a  [        S[        U5       S35      e[        U5      S:  a  US   OSn[        U[        5      (       a,  UR	                  5        H  u  pEU R                  XE5        M     GO[        U[        R                  5      (       a+  UR                  5        H  u  pEU R                  XE5        M     O[        U[        R                  5      (       aV  [        R                  " [        R                  [        [        [        4      U5      nU H  u  pFU R                  XF5        M     OM[        US5      (       a<  [        US5      (       a+  UR                  5        H  nU R                  XCU   5        M     UR                  5        H  u  pFU R                  XF5        M     g)	zGeneric import function for any type of header-like object.
Adapted version of MutableMapping.update in order to insert items
with self.add instead of self.__setitem__
r   z/extend() takes at most 1 positional arguments (z given)r   r   r   r   N)rM   	TypeErrorr/   r&   rw   r   r0   r1   itemsr3   r2   r4   r   r5   r   )r   argsr   r   r   r   rO   s          r   r   HTTPHeaderDict.extendO  sC   
 t9q=A#d)GT  t9>Qre^,,!OO-" .v~~..!KKM" *v//KKc3h @%HE#
$ $UF##}(E(E zz|Cj) $ !,,.JCHHS  )r   c                    g r   r   r   s     r   getlistHTTPHeaderDict.getlistp  s    .1r   c                    g r   r   )r   r   r   s      r   r   r   s  s    BEr   c                     U R                   UR                  5          nUSS $ ! [         a    U[        R                  L a  / s $ Us $ f = f)zeReturns a list of all the values for the named field. Returns an
empty list if the key doesn't exist.r   N)r:   r   rL   r+   r-   )r   r   r   r   s       r   r   r   v  sQ    
	??399;/D 8O  	)...	N	s   $ A
A
	A
c                B    / SQnU H  nU R                  U5        M     U $ )z~
Remove content-specific header fields before changing the request
method to GET or HEAD according to RFC 9110, Section 15.4.
)zContent-EncodingzContent-LanguagezContent-LocationzContent-TypezContent-LengthDigestzLast-Modified)r   )r   content_specific_headersheaders      r   _prepare_for_method_change)HTTPHeaderDict._prepare_for_method_change  s'    
$
  /FLL  /r   c                f    [        U 5      R                   S[        U R                  5       5       S3$ )N())r   r    dictr   r   s    r   __repr__HTTPHeaderDict.__repr__  s-    t*%%&aT__->(?'@BBr   c                x    U H4  nUR                  U5      nU/UQU R                  UR                  5       '   M6     g r   )r   r:   r   )r   r   r   r   s       r   r   HTTPHeaderDict._copy_from  s4    C--$C,/;#;DOOCIIK( r   c                H    [        U 5      " 5       nUR                  U 5        U$ r   )r   r   )r   clones     r   copyHTTPHeaderDict.copy  s     T
r   c              #     #    U  H5  nU R                   UR                  5          nUSS  H  nUS   U4v   M     M7     g7f)z8Iterate over all header lines, including duplicate ones.r   Nr   r   )r   r   r   r   s       r   rw   HTTPHeaderDict.iteritems  sA     C??399;/DABx1gsl"   s   =?c              #     #    U  H;  nU R                   UR                  5          nUS   SR                  USS 5      4v   M=     g7f)z:Iterate over all headers, merging duplicate ones together.r   r   r   Nr   r   s      r   r   HTTPHeaderDict.itermerged  sA     C//#))+.Ca&$))CG,,, s   AAc                    [        U 5      $ r   )ro   r   s    r   r   HTTPHeaderDict.items  s    %d++r   c                R    X;   a"  X R                   UR                  5          SS  ;   $ g)Nr   Fr   )r   header_namepotential_values      r   r}   $HTTPHeaderDict._has_value_for_header  s-    "ook6G6G6I&J12&NNNr   c                P    [        U5      nUc  [        $ U R                  U5        U $ r   )r7   NotImplementedr   )r   r   r   s      r   __ior__HTTPHeaderDict.__ior__  s.     DEJ&!!'(r   c                p    [        U5      nUc  [        $ U R                  5       nUR                  U5        U$ r   )r7   r   r   r   r   r   r   results       r   __or__HTTPHeaderDict.__or__  s9     DEJ&!!)*r   c                r    [        U5      nUc  [        $ [        U 5      " U5      nUR                  U 5        U$ r   )r7   r   r   r   r   s       r   __ror__HTTPHeaderDict.__ror__  s<     DEJ&!!d/0dr   )r:   r   )rt   ValidHTTPHeaderSource | Noner   r   )r   r   r   r   r   rh   r   )r   r   r   rh   )r   r   r   r   ) )r   r   r   r   r   r   )r   r   r   r   ri   r   )r   r   r   r   r   r   r   rh   )r   ValidHTTPHeaderSourcer   r   r   rh   )r   r   r   z	list[str])r   r   r   r)   r   list[str] | _DT)r   r   r   z_Sentinel | _DTr   r   )r   r	   )r   r   )r   r&   r   rh   r   )r   ro   )r   r   r   r   r   r   )r   r   r   r&   )r   r   r   r	   ))r    r!   r"   r#   rj   rk   rB   rS   r   rV   r   r   r   r   rY   r]   r   r   r   r0   overloadr   r+   r-   r   
getheadersgetallmatchingheadersigetget_allr   r   r   rw   r   r   r}   r   r   r   r$   rl   rm   s   @r   r&   r&      s   B 65	  	 2")
0 0	
&$
 :? !!F!B __1 1__E E 4=3G3G!0	$& J#D GC7

#-,
 r   )r6   r   r   r   )"
__future__r   r0   collectionsr   enumr   r   	threadingr   TYPE_CHECKINGr   typing_extensionsr	   r   __all__TypeVarr'   r(   r)   Unionr1   r   r3   r4   r   r+   r7   GenericMutableMappingr%   re   ro   r&   r   r   r   <module>r     s.   "  #  	  &4 4 #$4
5 nnUnnUnnU
NN38
OOE#s(O$  !(Z/FNN384f6K6KCQTH6U Z/z-SsCx1 -`SV**384 Sr   