HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/urllib3/__pycache__/_collections.cpython-310.pyc
o

�h�C�@s4ddlmZddlZddlmZddlmZmZddlm	Z	ej
r5ddlmZddlm
Z
Gdd	�d	e�Zd
dgZe�d�Ze�d
�Ze�d�Zejdejeefejeeefd	fZGdd�de�Zddd�ZGdd
�d
ejeefejeef�ZGdd�deeeef�Z Gdd�dejeef�Z!dS)�)�annotationsN)�OrderedDict)�Enum�auto)�RLock)�Protocol)�Selfc@s eZdZd
dd�Zddd�Zd	S)�HasGettableStringKeys�return�typing.Iterator[str]cC�dS�N���selfrr�G/usr/local/CyberCP/lib/python3.10/site-packages/urllib3/_collections.py�keys�zHasGettableStringKeys.keys�key�strcCrr
r�rrrrr�__getitem__rz!HasGettableStringKeys.__getitem__N�r
r�rrr
r)�__name__�
__module__�__qualname__rrrrrrr	s
r	�RecentlyUsedContainer�HTTPHeaderDict�_KT�_VT�_DTc@seZdZe�ZdS)�	_SentinelN)rrrr�
not_passedrrrrr"'s
r"�	potential�objectr
�ValidHTTPHeaderSource | NonecCszt|t�r|St|tj�rt�tjttf|�St|tj�r+t�tjtttf|�St|d�r;t|d�r;t�d|�SdS)Nrrr	)	�
isinstancer�typing�Mapping�castr�Iterable�tuple�hasattr)r$rrr�%ensure_can_construct_http_header_dict+s
r.cs�eZdZUdZded<ded<ded<ded	<	
	d%d&�fdd�
Zd'dd�Zd(dd�Zd)dd�Zd*dd�Z	d+dd�Z
d,d d!�Zd-d#d$�Z�Z
S).ra�
    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
    ztyping.OrderedDict[_KT, _VT]�
_container�int�_maxsize�#typing.Callable[[_VT], None] | None�dispose_funcr�lock�
N�maxsizer
�Nonecs*t���||_||_t�|_t�|_dSr
)�super�__init__r1r3rr/rr4)rr6r3��	__class__rrr9Rs

zRecentlyUsedContainer.__init__rrr cCsD|j�|j�|�}||j|<|Wd�S1swYdSr
)r4r/�pop)rr�itemrrrr]s

$�z!RecentlyUsedContainer.__getitem__�valuec	Cs�d}|j�5z||j�|�f}||j|<Wnty2||j|<t|j�|jkr0|jjdd�}YnwWd�n1s=wY|durT|jrV|\}}|�|�dSdSdS)NF)�last)r4r/r<�KeyError�lenr1�popitemr3)rrr>�evicted_item�_�
evicted_valuerrr�__setitem__ds"
�����z!RecentlyUsedContainer.__setitem__cCsJ|j�|j�|�}Wd�n1swY|jr#|�|�dSdSr
)r4r/r<r3)rrr>rrr�__delitem__}s��z!RecentlyUsedContainer.__delitem__cCs4|j�
t|j�Wd�S1swYdSr
)r4rAr/rrrr�__len__�s$�zRecentlyUsedContainer.__len__�typing.NoReturncCstd��)Nz7Iteration over this class is unlikely to be threadsafe.)�NotImplementedErrorrrrr�__iter__�s�zRecentlyUsedContainer.__iter__cCs`|j�t|j���}|j��Wd�n1swY|jr,|D]	}|�|�q$dSdSr
)r4�listr/�values�clearr3)rrMr>rrrrN�s��zRecentlyUsedContainer.clear�set[_KT]cCs8|j�t|j���Wd�S1swYdSr
)r4�setr/rrrrrr�s$�zRecentlyUsedContainer.keys)r5N)r6r0r3r2r
r7)rrr
r )rrr>r r
r7)rrr
r7�r
r0)r
rI)r
r7)r
rO)rrr�__doc__�__annotations__r9rrFrGrHrKrNr�
__classcell__rrr:rr?s 

�






c@sBeZdZUdZded<ddd�Zdd
d�Zdd
d�Zddd�ZdS)�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�_headers�headersr
r7cCs
||_dSr
)rV)rrWrrrr9��
zHTTPHeaderDictItemView.__init__r0cCstt|j����Sr
)rArLrV�	iteritemsrrrrrH�szHTTPHeaderDictItemView.__len__� typing.Iterator[tuple[str, str]]cCs
|j��Sr
)rVrYrrrrrK�rXzHTTPHeaderDictItemView.__iter__r=r%�boolcCsDt|t�r t|�dkr |\}}t|t�r t|t�r |j�||�SdS)N�F)r'r,rArrV�_has_value_for_header)rr=�
passed_key�
passed_valrrr�__contains__�s
z#HTTPHeaderDictItemView.__contains__N)rWrr
r7rQ�r
rZ)r=r%r
r[)	rrrrRrSr9rHrKr`rrrrrU�s



rUcs`eZdZUdZded<dVdW�fd	d
�
ZdXdd�ZdYdd�ZdZdd�Zd[dd�Z	d\d]�fdd�
Z
d^dd�Zd^d d!�Zd_d#d$�Z
d`d&d'�ZdZd(d)�Zd*d+�dad-d.�Zdbd1d2�Zejdcd4d5��Zejddd8d5��Zejfded:d5�Zdfd<d=�ZeZeZeZeZdgd>d?�Zdhd@dA�ZdfdBdC�ZdidEdF�ZdidGdH�Z djdJdK�Z!dkdNdO�Z"dldPdQ�Z#dmdRdS�Z$dmdTdU�Z%�Z&S)nrap
    :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/NrWr&�kwargsrcsNt���i|_|durt|t�r|�|�n|�|�|r%|�|�dSdSr
)r8r9r/r'r�
_copy_from�extend)rrWrbr:rrr9�s


�zHTTPHeaderDict.__init__r�valr
r7cCs*t|t�r
|�d�}||g|j|��<dS)N�latin-1)r'�bytes�decoder/�lower�rrrerrrrF�s

zHTTPHeaderDict.__setitem__cCs |j|��}d�|dd��S)N�, ��r/ri�joinrjrrrrszHTTPHeaderDict.__getitem__cCs|j|��=dSr
�r/rirrrrrGszHTTPHeaderDict.__delitem__r%r[cCst|t�r|��|jvSdS)NF)r'rrir/rrrrr`s
zHTTPHeaderDict.__contains__��defaultcst��||�Sr
)r8�
setdefault�rrrqr:rrrr
szHTTPHeaderDict.setdefault�othercCsDt|�}|dur
dSt|�|�}dd�|��D�dd�|��D�kS)NFcSsi|]	\}}|��|�qSr)ri)�.0�k�vrrr�
<dictcomp>sz)HTTPHeaderDict.__eq__.<locals>.<dictcomp>)r.�type�
itermerged)rrt�maybe_constructable�other_as_http_header_dictrrr�__eq__s�zHTTPHeaderDict.__eq__cCs|�|�Sr
)r})rrtrrr�__ne__szHTTPHeaderDict.__ne__r0cCs
t|j�Sr
)rAr/rrrrrHrXzHTTPHeaderDict.__len__rccs �|j��D]}|dVqdS)Nr)r/rM)r�valsrrrrK!s��zHTTPHeaderDict.__iter__cCs"z||=WdStyYdSwr
)r@rrrr�discard&s
�zHTTPHeaderDict.discardF)�combiner�cCsxt|t�r
|�d�}|��}||g}|j�||�}||ur:t|�dks%J�|r3|dd||d<dS|�|�dSdS)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')]
        rfr\���rkN)r'rgrhrir/rrrA�append)rrrer��	key_lower�new_valsrrrr�add,s

�zHTTPHeaderDict.add�args�ValidHTTPHeaderSourcecOs$t|�dkrtdt|��d���t|�dkr|dnd}t|t�r1|��D]
\}}|�||�q%nPt|tj�rG|��D]
\}}|�||�q;n:t|tj	�rht�
tj	tttf|�}|D]
\}}|�||�q\nt
|d�r�t
|d�r�|��D]
}|�|||�qv|��D]
\}}|�||�q�dS)	z�Generic 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__
        rlz/extend() takes at most 1 positional arguments (z given)rrrrN)rA�	TypeErrorr'rrYr�r(r)�itemsr+r*r,rr-r)rr�rbrtrrer>rrrrdOs0�
����zHTTPHeaderDict.extend�	list[str]cCrr
rrrrr�getlistp�zHTTPHeaderDict.getlistr!�list[str] | _DTcCrr
rrsrrrr�sr��_Sentinel | _DTcCsHz	|j|��}Wnty|tjurgYS|YSw|dd�S)zmReturns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist.rlN)r/rir@r"r#)rrrqrrrrr�vs
�	rcCs gd�}|D]}|�|�q|S)z�
        Remove content-specific header fields before changing the request
        method to GET or HEAD according to RFC 9110, Section 15.4.
        )zContent-EncodingzContent-LanguagezContent-LocationzContent-TypezContent-Length�Digestz
Last-Modified)r�)r�content_specific_headers�headerrrr�_prepare_for_method_change�s	z)HTTPHeaderDict._prepare_for_method_changecCst|�j�dt|����d�S)N�(�))ryr�dictrzrrrr�__repr__�szHTTPHeaderDict.__repr__cCs,|D]}|�|�}|g|�|j|��<qdSr
)r�r/ri)rrtrrerrrrc�s
�zHTTPHeaderDict._copy_fromcCst|��}|�|�|Sr
)ryrc)r�clonerrr�copy�s

zHTTPHeaderDict.copyrZccs>�|D]}|j|��}|dd�D]	}|d|fVqqdS)z8Iterate over all header lines, including duplicate ones.rlNrro)rrrrerrrrY�s���zHTTPHeaderDict.iteritemsccs:�|D]}|j|��}|dd�|dd��fVqdS)z:Iterate over all headers, merging duplicate ones together.rrkrlNrmrjrrrrz�s
��zHTTPHeaderDict.itermergedrUcCst|�Sr
)rUrrrrr��szHTTPHeaderDict.items�header_name�potential_valuecCs&||vr||j|��dd�vSdS)NrlFro)rr�r�rrrr]�sz$HTTPHeaderDict._has_value_for_headercCs"t|�}|dur
tS|�|�|Sr
)r.�NotImplementedrd)rrtr{rrr�__ior__�s

zHTTPHeaderDict.__ior__cCs*t|�}|dur
tS|��}|�|�|Sr
)r.r�r�rd�rrtr{�resultrrr�__or__�s
zHTTPHeaderDict.__or__cCs.t|�}|dur
tSt|�|�}|�|�|Sr
)r.r�ryrdr�rrr�__ror__�s
zHTTPHeaderDict.__ror__r
)rWr&rbr)rrrerr
r7r)rrr
r7)rr%r
r[)rp)rrrqrr
r)rtr%r
r[rQr)rrrerr�r[r
r7)r�r�rbrr
r7)rrr
r�)rrrqr!r
r�)rrrqr�r
r�)r
r)r
r)rtrr
r7ra)r
rU)r�rr�rr
r[)rtr%r
r)rtr%r
r)'rrrrRrSr9rFrrGr`rrr}r~rHrKr�r�rdr(�overloadr�r"r#r��
getheaders�getallmatchingheaders�iget�get_allr�rcr�rYrzr�r]r�r�r�rTrrr:rr�sJ
!









#!�









	
)r$r%r
r&)"�
__future__rr(�collectionsr�enumrr�	threadingr�
TYPE_CHECKINGr�typing_extensionsrr	�__all__�TypeVarrr r!�Unionr)rr+r,r�r"r.�Generic�MutableMappingrrPrUrrrrr�<module>s2


��
&]0