+
     ]iD  c                  s   ^ RI Ht ^ RIt^ RIHt ^ RIHtHt ^ RIH	t	 ]P                  '       d   ^ RIHt ^ RIHt  ! R R	]4      tR
R.t]P                   ! R4      t]P                   ! R4      t]P                   ! R4      t]P(                  R]P*                  ]]3,          ]P.                  ]]]3,          ,          R	3,          t ! R R]4      tR R lt ! R R
]P8                  ]]3,          ]P:                  ]]3,          4      t ! R R]]]]3,          ,          4      t  ! R R]P:                  ]]3,          4      t!R# )    )annotationsN)OrderedDict)Enumauto)RLock)Protocol)Selfc                  s.    ] tR t^tR R ltR R ltRtR# )HasGettableStringKeysc                   V ^8  d   QhRR/#    returnztyping.Iterator[str] Zformat   "9/usr/lib/python3.14/site-packages/urllib3/_collections.py__annotate__"HasGettableStringKeys.__annotate__   s    33.3    c                	    R # Nr   self   &r   keysZHasGettableStringKeys.keys       r   c                    V ^8  d   QhRRRR/# r   keystrr   r   r   r   r   r   r      s    333333r   c                	r   r   r   r   r      &&r   __getitem__Z!HasGettableStringKeys.__getitem__   r   r   r   N)__name__
__module____qualname____firstlineno__r   r!   __static_attributes__r   r   r   r   r      s    333r   r   RecentlyUsedContainerHTTPHeaderDict_KT_VT_DTc                  s$    ] tR t^'t]! 4       tRtR# )	_Sentinelr   N)r"   r#   r$   r%   r   
not_passedr&   r   r   r   r,   r,   '   s	    Jr   r,   c                    V ^8  d   QhRRRR/# )r   	potentialobjectr   ValidHTTPHeaderSource | Noner   r   r   r   r   r   +   s      !r   c                s   \        V \        4      '       d   V # \        V \        P                  4      '       d7   \        P                  ! \        P                  \
        \
        3,          V 4      # \        V \        P                  4      '       dB   \        P                  ! \        P                  \        \
        \
        3,          ,          V 4      # \        V R 4      '       d*   \        V R4      '       d   \        P                  ! RV 4      # R# )r   r!   r   N)	
isinstancer(   typingMappingcastr   Iterabletuplehasattr)r/   r   r   %ensure_can_construct_http_header_dictr9   +   s     )^,,	Iv~~	.	. {{6>>#s(3Y??	Iv	/	/ {{6??5c?;YGG	F	#	#	=(I(I{{2I>>r   c                  s   a  ] tR t^?t$ RtR]R&   R]R&   R]R&   R]R	&   RR
 V 3R llltR R ltR R ltR R lt	R R lt
R R ltR R ltR R ltRtV ;t# )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 ^8  d   QhRRRRRR/# )r   maxsizer;   r>   r=   r   Noner   r   r   r   r   "RecentlyUsedContainer.__annotate__R   s(     	 		 :	 
		r   c                	sx   < \         SV `  4        Wn        W n        \	        4       V n        \        4       V n        R # r   )super__init__r<   r>   r   r:   r   r?   )r   rA   r>   	__class__   &&&r   rE   ZRecentlyUsedContainer.__init__R   s-    
 	(%-G	r   c               r.   )r   r   r)   r   r*   r   r   r   r   r   rC   ]   s      s s r   c                	s    V P                   ;_uu_ 4        V P                  P                  V4      pW P                  V&   VuuR R R 4       #   + '       g   i     R # ; ir   )r?   r:   pop)r   r   item   && r   r!   Z!RecentlyUsedContainer.__getitem__]   s:    YYY??&&s+D#'OOC  YYYs   +AA	c               r@   )r   r   r)   valuer*   r   rB   r   r   r   r   r   rC   d   s!     - -s -3 -4 -r   c                	s   R pV P                   ;_uu_ 4         WP                  P                  V4      3pW P                  V&   R R R 4       Ve,   V P                  '       d   Vw  rEV P                  V4       R # R # R #   \         dR    Y P                  T&   \	        T P                  4      T P
                  8  d   T P                  P                  RR7      p Li ; i  + '       g   i     L; i)NF)Zlast)r?   r:   rH   KeyErrorlenr<   Zpopitemr>   )r   r   rK   Zevicted_itemZ_Zevicted_values   &&&   r   __setitem__Z!RecentlyUsedContainer.__setitem__d   s    YYYG  #OO$7$7$<<',$ & #(9(9(9+Am, ):#  G (-$t'$--7 $(??#:#:#:#FLG Ys)   C*A<<ACCCCC+	c               r.   )r   r   r)   r   rB   r   r   r   r   r   rC   }   s     % %s %t %r   c                	s    V P                   ;_uu_ 4        V P                  P                  V4      pR R R 4       V P                  '       d   V P                  X4       R # R #   + '       g   i     L7; ir   )r?   r:   rH   r>   )r   r   rK   rJ   r   __delitem__Z!RecentlyUsedContainer.__delitem__}   sM    YYYOO'',E  e$  Ys   A  A0	c               r	   r   r   r;   r   r   r   r   r   rC      s     ( ( (r   c                	s    V P                   ;_uu_ 4        \        V P                  4      uuR R R 4       #   + '       g   i     R # ; ir   )r?   rM   r:   r   r   r   __len__ZRecentlyUsedContainer.__len__   s#    YYYt' YYYs	   5A	c               r	   )r   r   ztyping.NoReturnr   r   r   r   r   rC      s     
 
/ 
r   c                	s    \        R 4      h)z7Iteration over this class is unlikely to be threadsafe.)ZNotImplementedErrorr   r   r   __iter__ZRecentlyUsedContainer.__iter__   s    !E
 	
r   c               r	   )r   r   rB   r   r   r   r   r   rC      s     ) )t )r   c                	s<   V P                   ;_uu_ 4        \        V P                  P                  4       4      pV P                  P	                  4        R R R 4       V P
                  '       d   X F  pV P                  V4       K  	  R # R #   + '       g   i     L@; ir   )r?   listr:   valuesclearr>   )r   rT   rK      &  r   rU   ZRecentlyUsedContainer.clear   sj    YYY$//0023FOO!!# 
 !!%(    Ys   >BB	c               r	   )r   r   zset[_KT]r   r   r   r   r   rC      s     / /h /r   c                	s    V P                   ;_uu_ 4        \        V P                  P                  4       4      uuR R R 4       #   + '       g   i     R # ; ir   )r?   setr:   r   r   r   r   r   ZRecentlyUsedContainer.keys   s,    YYYt++-. YYYs   #AA	)r:   r<   r>   r?   )i
   N)r"   r#   r$   r%   __doc____annotations__rE   r!   rN   rO   rQ   rR   rU   r   r&   __classcell__rF      @r   r'   r'   ?   sR     -,M55
K	 	-2%(

)/ /r   c                  sV    ] tR t^t$ RtR]R&   R R ltR R ltR R	 ltR
 R lt	Rt
R# )HTTPHeaderDictItemViewa;  
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               r.   )r   headersr(   r   rB   r   r   r   r   r   #HTTPHeaderDictItemView.__annotate__   s          4  r   c                	s    Wn         R # r   r^   )r   r_   r    r   rE   ZHTTPHeaderDictItemView.__init__   s    r   c               r	   rP   r   r   r   r   r   r`      s     4 4 4r   c                	sZ    \        \        V P                  P                  4       4      4      # r   )rM   rS   r^   	iteritemsr   r   r   rQ   ZHTTPHeaderDictItemView.__len__   s    4//1233r   c               r	   r   r   z typing.Iterator[tuple[str, str]]r   r   r   r   r   r`      s     ) ): )r   c                	s6    V P                   P                  4       # r   )r^   rb   r   r   r   rR   ZHTTPHeaderDictItemView.__iter__   s    }}&&((r   c               r.   )r   rI   r0   r   boolr   r   r   r   r   r`      s       D r   c                	s    \        V\        4      '       d\   \        V4      ^8X  dL   Vw  r#\        V\        4      '       d2   \        V\        4      '       d   V P                  P                  W#4      # R# )r   F)r2   r7   rM   r   r^   _has_value_for_header)r   rI   Z
passed_keyZ
passed_val   &&  r   __contains__Z#HTTPHeaderDictItemView.__contains__   sR    dE""s4yA~%)"J*c**z*c/J/J}}:::RRr   ra   N)r"   r#   r$   r%   rX   rY   rE   rQ   rR   rg   r&   r   r   r   r]   r]      s(    8  4) r   r]   c                  s  a  ] tR t^t$ RtR]R&   R=R V 3R llltR R ltR R	 ltR
 R lt	R R lt
R>R V 3R llltR R ltR R ltR R ltR R ltR R ltRR/R R lltR R lt]P(                  R  R! l4       t]P(                  R" R# l4       t]P.                  3R$ R% lltR& R' lt]t]t]t]tR( R) ltR* R+ ltR, R- ltR. R/ lt R0 R1 lt!R2 R3 lt"R4 R5 lt#R6 R7 lt$R8 R9 lt%R: R; lt&R<t'V ;t(# )?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               r.   )r   r_   r1   kwargsr   r   r   r   r   r   HTTPHeaderDict.__annotate__   s     	  	  < 	 s 	 r   c                	s   < \         SV `  4        / V n        Ve:   \        V\        4      '       d   V P                  V4       MV P                  V4       V'       d   V P                  V4       R # R # r   )rD   rE   r:   r2   r(   
_copy_fromextend)r   r_   rh   rF   s   &&,r   rE   ZHTTPHeaderDict.__init__   sT    '>22(G$KK r   c               $    V ^8  d   QhRRRRRR/# )r   r   r   valr   rB   r   r   r   r   r   ri      s!     2 2s 2 2 2r   c                	s    \        V\        4      '       d   VP                  R 4      pW.V P                  VP	                  4       &   R# latin-1Nr2   bytesdecoder:   lowerr   r   rm      &&&r   rN   ZHTTPHeaderDict.__setitem__   s3    c5!!**Y'C(+z		$r   c               r   r   r   r   r   r   r   ri     s     " "s "s "r   c                	s    \        V\        4      '       d   VP                  R 4      pV P                  VP	                  4       ,          pRP                  VR,          4      # )ro   , i   NN)r2   rq   rr   r:   rs   joinrt   rJ   r   r!   ZHTTPHeaderDict.__getitem__  sD    c5!!**Y'Coociik*yyR!!r   c               r.   r   r   r   r   rB   r   r   r   r   r   ri     s     ) )s )t )r   c                	s    \        V\        4      '       d   VP                  R 4      pV P                  VP	                  4        R# rn   rp   r   r    r   rO   ZHTTPHeaderDict.__delitem__  s/    c5!!**Y'COOCIIK(r   c               r.   )r   r   r0   r   rd   r   r   r   r   r   ri     s       4 r   c                	s    \        V\        4      '       d   VP                  R 4      p\        V\        4      '       d   VP	                  4       V P
                  9   # R# )ro   F)r2   rq   rr   r   rs   r:   r   r    r   rg   ZHTTPHeaderDict.__contains__  sB    c5!!**Y'Cc399;$//11r   c               s$    V ^8  d   QhRRRRRR/# )r   r   r   defaultr   r   r   r   r   r   ri     s!     0 0c 0C 0 0r   c                	s"   < \         SV `  W4      # r   )rD   
setdefault)r   r   rz   rF   rG   r   r{   ZHTTPHeaderDict.setdefault  s    w!#//r   c               r.   r   otherr0   r   rd   r   r   r   r   r   ri     s     	
 	
F 	
t 	
r   c                	s,   \        V4      pVf   R# \        V 4      ! V4      pV P                  4        UUu/ uF  w  rEVP                  4       VbK  	  uppVP                  4        UUu/ uF  w  rEVP                  4       VbK  	  upp8H  # u uppi u uppi )NF)r9   type
itermergedrs   )r   r}   maybe_constructableZother_as_http_header_dictZkZvs   &&    r   __eq__ZHTTPHeaderDict.__eq__  s    CEJ&(,T
3F(G%)-):;):	1):;%>%I%I%K@
%KTQAGGIqL%K@
 
 	
; @
s   B
(Bc               r.   r|   r   r   r   r   r   ri   !  s     & &F &t &r   c                	s.    V P                  V4      '       * # r   )r   )r   r}   r    r   __ne__ZHTTPHeaderDict.__ne__!  s    ;;u%%%r   c               r	   rP   r   r   r   r   r   ri   $  s     $ $ $r   c                	s,    \        V P                  4      # r   )rM   r:   r   r   r   rQ   ZHTTPHeaderDict.__len__$  s    4??##r   c               r	   r
   r   r   r   r   r   ri   '  s      . r   c              #  	sf   "   V P                   P                  4        F  pV^ ,          x  K  	  R# 5i)r    N)r:   rT   )r   vals   & r   rR   ZHTTPHeaderDict.__iter__'  s%     OO**,Dq'M -s   /1c               r.   ry   r   r   r   r   r   ri   ,  s      3 4 r   c                	s0     W R #   \          d     R # i ; ir   )rL   r   r    r   discardZHTTPHeaderDict.discard,  s    		 		s    combineFc               s(    V ^8  d   QhRRRRRRRR/# )r   r   r   rm   r   rd   r   rB   r   r   r   r   r   ri   2  s(     !! !!s !! !!$ !!4 !!r   c               sL   \        V\        4      '       d   VP                  R4      pVP                  4       pW.pV P                  P                  WE4      pWVJdJ   \        V4      ^8  g   Q hV'       d   VR,          R,           V,           VR&   R# VP                  V4       R# R# )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')]
ro   rv   Ni)r2   rq   rr   rs   r:   r{   rM   Zappend)r   r   rm   r   Z	key_lowerZnew_valsr   s   &&&$   r   addZHTTPHeaderDict.add2  s    ( c5!!**Y'CIIK	:)))> t9>!>8d?S0RC   r   c               r@   )r   argsValidHTTPHeaderSourcerh   r   r   rB   r   r   r   r   r   ri   U  s"     ! !1 !S !T !r   c                s   \        V4      ^8  d   \        R\        V4       R24      h\        V4      ^8  d
   V^ ,          MRp\        V\        4      '       d-   VP	                  4        F  w  rEV P                  WE4       K  	  EM\        V\        P                  4      '       d,   VP                  4        F  w  rEV P                  WE4       K  	  M\        V\        P                  4      '       d_   \        P                  ! \        P                  \        \        \        3,          ,          V4      pV F  w  rFV P                  WF4       K  	  MS\        VR4      '       dB   \        VR4      '       d0   VP                  4        F  pV P                  WCV,          4       K  	  VP                  4        F  w  rFV P                  WF4       K  	  R# )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__
z/extend() takes at most 1 positional arguments (z given)r   r!   Nr   )rM   Z	TypeErrorr2   r(   rb   r   r3   r4   itemsr6   r5   r7   r   r8   r   )r   r   rh   r}   r   rm   rK   s   &*,    r   rk   ZHTTPHeaderDict.extendU  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               r.   )r   r   r   r   z	list[str]r   r   r   r   r   ri   w  s    113191r   c                	r   r   r   r   r    r   getlistHTTPHeaderDict.getlistv  s    .1r   c               r@   )r   r   r   rz   r+   r   list[str] | _DTr   r   r   r   r   ri   z  s    EE3EEEr   c                	r   r   r   )r   r   rz   ru   r   r   r   y  s    BEr   c               r@   )r   r   r   rz   z_Sentinel | _DTr   r   r   r   r   r   r   ri   |  s$      !0	r   c                s    \        V\        4      '       d   VP                  R4      p V P                  VP	                  4       ,          pVR,          #   \
         d    T\        P                  J d   . u # Tu # i ; i)zeReturns a list of all the values for the named field. Returns an
empty list if the key doesn't exist.ro   rw   )r2   rq   rr   r:   rs   rL   r,   r-   )r   r   rz   r   s   &&& r   r   r   |  sl    
 c5!!**Y'C	??399;/D 8O  	)...	N	s   !A !A;6A;:A;c               r	   r   r   r   r   r   r   r   r   ri     s      D r   c                sB    . ROpV F  pV P                  V4       K  	  V # )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-LengthZDigestzLast-Modified)r   )r   Zcontent_specific_headersZheaderrV   r   _prepare_for_method_changeZ)HTTPHeaderDict._prepare_for_method_change  s'    
$
  /FLL  /r   c               r	   )r   r   r   r   r   r   r   r   ri     s     C C# Cr   c                	sf    \        V 4      P                   R \        V P                  4       4       R2# )Z(Z))r~   r"   Zdictr   r   r   r   __repr__ZHTTPHeaderDict.__repr__  s-    t*%%&aT__->(?'@BBr   c               r.   )r   r}   r(   r   rB   r   r   r   r   r   ri     s     7 7 74 7r   c                	sz    V F4  pVP                  V4      pV.VOV P                  VP                  4       &   K6  	  R # r   )r   r:   rs   )r   r}   r   rm   rf   r   rj   ZHTTPHeaderDict._copy_from  s4    C--$C,/;#;DOOCIIK( r   c               r	   r   r   r   r   r   r   ri     s      d r   c                	sH    \        V 4      ! 4       pVP                  V 4       V# r   )r~   rj   )r   Zcloner   r   copyZHTTPHeaderDict.copy  s     T
r   c               r	   rc   r   r   r   r   r   ri     s     # #; #r   c              #  s   "   V  FA  pV P                   VP                  4       ,          pVR,           F  pV^ ,          V3x  K  	  KC  	  R# 5i)z8Iterate over all header lines, including duplicate ones.rw   Nr:   rs   )r   r   r   rm   s   &   r   rb   ZHTTPHeaderDict.iteritems  sA     C??399;/DBxx1gsl"   s   A
Ac               r	   rc   r   r   r   r   r   ri     s     - -< -r   c              #  s   "   V  FG  pV P                   VP                  4       ,          pV^ ,          RP                  VR,          4      3x  KI  	  R# 5i)z:Iterate over all headers, merging duplicate ones together.rv   rw   N)r:   rs   rx   rt   rV   r   r   ZHTTPHeaderDict.itermerged  s?     C//#))+.Ca&$))CG,,, s   AAc               r	   )r   r   r]   r   r   r   r   r   ri     s     , ,- ,r   c                	s    \        V 4      # r   )r]   r   r   r   r   ZHTTPHeaderDict.items  s    %d++r   c               rl   )r   header_namer   potential_valuer   rd   r   r   r   r   r   ri     s!       s t r   c                	sf    W9   d+   W P                   VP                  4       ,          R ,          9   # R# )rw   Fr   )r   r   r   ru   r   re   Z$HTTPHeaderDict._has_value_for_header  s+    "ook6G6G6I&J2&NNNr   c               r.   )r   r}   r0   r   r(   r   r   r   r   r   ri     s      V  r   c                	sR    \        V4      pVf   \        # V P                  V4       V # r   )r9   NotImplementedrk   )r   r}   r   rJ   r   __ior__ZHTTPHeaderDict.__ior__  s.     DEJ&!!'(r   c               r.   r   r}   r0   r   r   r   r   r   r   r   ri     s      F t r   c                	sr    \        V4      pVf   \        # V P                  4       pVP                  V4       V# r   )r9   r   r   rk   r   r}   r   Zresultrf   r   __or__ZHTTPHeaderDict.__or__  s9     DEJ&!!)*r   c               r.   r   r   r   r   r   r   ri     s      V  r   c                	st    \        V4      pVf   \        # \        V 4      ! V4      pVP                  V 4       V# r   )r9   r   r~   rk   r   rf   r   __ror__ZHTTPHeaderDict.__ror__  s<     DEJ&!!d/0dr   )r:   r   )Z ))r"   r#   r$   r%   rX   rY   rE   rN   r!   rO   rg   r{   r   r   rQ   rR   r   r   rk   r3   Zoverloadr   r,   r-   r   Z
getheadersZgetallmatchingheadersZigetZget_allr   rj   r   rb   r   r   re   r   r   r   r&   rZ   r[   r\   r   r(   r(      s    B 65	  	 2")
0 0	
&$
!! !!F!B __1 1__E E 4=3G3G(& J#D GC7

#-,
 r   )"Z
__future__r   r3   Zcollectionsr   Zenumr   r   Z	threadingr   ZTYPE_CHECKINGr   Ztyping_extensionsr   r   Z__all__ZTypeVarr)   r*   r+   ZUnionr4   r   r6   r7   r   r,   r9   ZGenericZMutableMappingr'   rW   r]   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 -`[V**384 [r   