????

Your IP : 18.116.170.100


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/urllib3/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/urllib3/__pycache__/_collections.cpython-311.pyc

�

�܋f�A��D�ddlmZddlZddlmZddlmZmZddlm	Z	ej
rddlmZGd�de��Z
d	d
gZejd��Zejd��Zejd
��Zejd
ejeefejejeefdfZGd�de��Zdd�ZGd�d	ejeefejeef��ZGd�dejejeef��ZGd�d
ejeef��Z dS)�)�annotationsN)�OrderedDict)�Enum�auto)�RLock)�Protocolc��eZdZdd�Zd	d�ZdS)
�HasGettableStringKeys�return�typing.Iterator[str]c��dS�N���selfs �K/opt/cloudlinux/venv/lib64/python3.11/site-packages/urllib3/_collections.py�keyszHasGettableStringKeys.keys����C��key�strc��dSrr�rrs  r�__getitem__z!HasGettableStringKeys.__getitem__rrN�rr�rrrr)�__name__�
__module__�__qualname__rrrrrr
r

s<������	�	�	�	�	�	�	�	�	�	rr
�RecentlyUsedContainer�HTTPHeaderDict�_KT�_VT�_DTc�"�eZdZe��ZdS)�	_SentinelN)rrrr�
not_passedrrrr&r&'s����������J�J�Jrr&�	potential�objectr�ValidHTTPHeaderSource | Nonec���t|t��r|St|tj��r1tjtjt
t
f|��St|tj��rAtjtjtjt
t
f|��St|d��r%t|d��rtjd|��SdS)Nrrr
)	�
isinstancer!�typing�Mapping�castr�Iterable�Tuple�hasattr)r(s r�%ensure_can_construct_http_header_dictr3+s����)�^�,�,����	�I�v�~�	.�	.���{�6�>�#�s�(�3�Y�?�?�?�	�I�v��	/�	/���{�6�?�6�<��S��+A�B�I�N�N�N�	��F�	#�	#���	�=�(I�(I���{�2�I�>�>�>��trc���eZdZUdZded<ded<ded<ded	<		dd�fd�
Zdd�Zd d�Zd!d�Zd"d�Z	d#d�Z
d$d�Zd%d�Z�xZ
S)&r a�
    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�Nonec���t�����||_||_t	��|_t
��|_dSr)�super�__init__r7r9rr5rr:)rr<r9�	__class__s   �rr@zRecentlyUsedContainer.__init__RsD���
	����������
�(���%�-�-����G�G��	�	�	rrr"r#c��|j5|j�|��}||j|<|cddd��S#1swxYwYdSr)r:r5�pop)rr�items   rrz!RecentlyUsedContainer.__getitem__]s���
�Y�	�	��?�&�&�s�+�+�D�#'�D�O�C� ��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�
�&;�?�?�valuec��d}|j5	||j�|��f}||j|<nR#t$rE||j|<t	|j��|jkr|j�d���}YnwxYwddd��n#1swxYwY|�#|jr|\}}|�|��dSdSdS)NF)�last)r:r5rC�KeyError�lenr7�popitemr9)rrrF�evicted_item�_�
evicted_values      r�__setitem__z!RecentlyUsedContainer.__setitem__dsH����
�Y�	G�	G�
G� #�D�O�$7�$7��$<�$<�<��',����$�$���
G�
G�
G�(-����$��t��'�'�$�-�7�7�$(�?�#:�#:��#:�#F�#F�L���
G����	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G����	G�	G�	G�	G�&�#��(9�#�+��A�}����m�,�,�,�,�,�$�#�#�#s2�B�&3�B�AB�?B�B�B�B�Bc��|j5|j�|��}ddd��n#1swxYwY|jr|�|��dSdSr)r:r5rCr9)rrrFs   r�__delitem__z!RecentlyUsedContainer.__delitem__}s���
�Y�	-�	-��O�'�'��,�,�E�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-���	%����e�$�$�$�$�$�	%�	%s�/�3�3c�l�|j5t|j��cddd��S#1swxYwYdSr)r:rJr5rs r�__len__zRecentlyUsedContainer.__len__�s{��
�Y�	(�	(��t��'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s�)�-�-�typing.NoReturnc� �td���)Nz7Iteration over this class is unlikely to be threadsafe.)�NotImplementedErrorrs r�__iter__zRecentlyUsedContainer.__iter__�s��!�E�
�
�	
rc��|j5t|j�����}|j���ddd��n#1swxYwY|jr|D]}|�|���dSdSr)r:�listr5�values�clearr9)rrZrFs   rr[zRecentlyUsedContainer.clear�s���
�Y�	$�	$��$�/�0�0�2�2�3�3�F��O�!�!�#�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�
��	)��
)�
)���!�!�%�(�(�(�(�	)�	)�
)�
)s�AA�A�A�set[_KT]c��|j5t|j�����cddd��S#1swxYwYdSr)r:�setr5rrs rrzRecentlyUsedContainer.keys�s���
�Y�	/�	/��t��+�+�-�-�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/rE)r;N)r<r6r9r8rr=)rr"rr#)rr"rFr#rr=)rr"rr=�rr6)rrT)rr=)rr\)rrr�__doc__�__annotations__r@rrOrQrSrWr[r�
__classcell__�rAs@rr r ?s����������-�,�,�,��M�M�M�5�5�5�5��K�K�K��<@�	�	�	�	�	�	�	�����-�-�-�-�2%�%�%�%�(�(�(�(�
�
�
�
�
)�)�)�)�/�/�/�/�/�/�/�/rc�>�eZdZUdZded<dd�Zdd	�Zdd�Zdd�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�headersrr=c��||_dSr)rf)rrgs  rr@zHTTPHeaderDictItemView.__init__�s
����
�
�
rr6c�h�tt|j�������Sr)rJrYrf�	iteritemsrs rrSzHTTPHeaderDictItemView.__len__�s&���4��
�/�/�1�1�2�2�3�3�3r� typing.Iterator[tuple[str, str]]c�4�|j���Sr)rfrjrs rrWzHTTPHeaderDictItemView.__iter__�s���}�&�&�(�(�(rrDr)�boolc���t|t��r]t|��dkrJ|\}}t|t��r0t|t��r|j�||��SdS)N�F)r,�tuplerJrrf�_has_value_for_header)rrD�
passed_key�
passed_vals    r�__contains__z#HTTPHeaderDictItemView.__contains__�so���d�E�"�"�	S�s�4�y�y�A�~�~�%)�"�J�
��*�c�*�*�
S�z�*�c�/J�/J�
S��}�:�:�:�z�R�R�R��urN)rgr!rr=r_�rrk)rDr)rrm)	rrrr`rar@rSrWrtrrrrere�s~���������8���� � � � �4�4�4�4�)�)�)�)������rrec�X��eZdZUdZded<d;d<�fd	�
Zd=d�Zd>d�Zd?d�Zd@d�Z	dAdB�fd�
Z
dCd�ZdCd�ZdDd�Z
dEd�Zd?d�Zdd �dFd"�ZdGd%�ZejdHd'���ZejdId*���ZejfdJd,�ZeZeZeZeZdKd-�ZdLd.�ZdMd/�ZdNd1�ZdNd2�ZdOd4�Z dPd7�Z!dQd8�Z"dQd9�Z#dQd:�Z$�xZ%S)Rr!ap
    :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]]r5Nrgr*�kwargsrc���t�����i|_|�@t|t��r|�|��n|�|��|r|�|��dSdSr)r?r@r5r,r!�
_copy_from�extend)rrgrwrAs   �rr@zHTTPHeaderDict.__init__�s����
��������������'�>�2�2�
%�����(�(�(�(����G�$�$�$��	 ��K�K�������	 �	 rr�valrr=c��t|t��r|�d��}||g|j|���<dS)N�latin-1)r,�bytes�decoder5�lower�rrr{s   rrOzHTTPHeaderDict.__setitem__�sC���c�5�!�!�	(��*�*�Y�'�'�C�(+�S�z����	�	���$�$�$rc�z�|j|���}d�|dd���S)N�, ��r5r��joinr�s   rrzHTTPHeaderDict.__getitem__s0���o�c�i�i�k�k�*���y�y��Q�R�R��!�!�!rc�:�|j|���=dSr�r5r�rs  rrQzHTTPHeaderDict.__delitem__s���O�C�I�I�K�K�(�(�(rr)rmc�f�t|t��r|���|jvSdS)NF)r,rr�r5rs  rrtzHTTPHeaderDict.__contains__s.���c�3���	2��9�9�;�;�$�/�1�1��ur��defaultc�H��t���||��Sr)r?�
setdefault)rrr�rAs   �rr�zHTTPHeaderDict.setdefault
s����w�w�!�!�#�w�/�/�/r�otherc���t|��}|�dSt|��|��}d�|���D��d�|���D��kS)NFc�>�i|]\}}|���|��Sr�r���.0�k�vs   r�
<dictcomp>z)HTTPHeaderDict.__eq__.<locals>.<dictcomp>s&��;�;�;���A����	�	�1�;�;�;rc�>�i|]\}}|���|��Srr�r�s   rr�z)HTTPHeaderDict.__eq__.<locals>.<dictcomp>s9��@
�@
�@
�!�Q��A�G�G�I�I�q�@
�@
�@
r)r3�type�
itermerged)rr��maybe_constructable�other_as_http_header_dicts    r�__eq__zHTTPHeaderDict.__eq__s���C�E�J�J���&��5�(2��T�
�
�3F�(G�(G�%�;�;����):�):�;�;�;�@
�@
�%>�%I�%I�%K�%K�@
�@
�@
�
�	
rc�.�|�|��Sr)r�)rr�s  r�__ne__zHTTPHeaderDict.__ne__s���;�;�u�%�%�%�%rr6c�*�t|j��Sr)rJr5rs rrSzHTTPHeaderDict.__len__s���4�?�#�#�#rrc#�VK�|j���D]}|dV��
dS)Nr)r5rZ)r�valss  rrWzHTTPHeaderDict.__iter__!s<�����O�*�*�,�,�	�	�D��q�'�M�M�M�M�	�	rc�0�	||=dS#t$rYdSwxYwr)rIrs  r�discardzHTTPHeaderDict.discard&s4��	��S�	�	�	���	�	�	��D�D�	���s��
�F)�combiner�c�J�t|t��r|�d��}|���}||g}|j�||��}||urAt
|��dksJ�|r|ddz|z|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')]
        r}ro���r�N)r,r~rr�r5r�rJ�append)rrr{r��	key_lower�new_valsr�s       r�addzHTTPHeaderDict.add,s���(�c�5�!�!�	(��*�*�Y�'�'�C��I�I�K�K�	���:����)�)�)�X�>�>���4����t�9�9��>�>�>�>��
!���8�d�?�S�0��R�������C� � � � � � �r�args�ValidHTTPHeaderSourcec���t|��dkr tdt|���d����t|��dkr|dnd}t|t��r2|���D]\}}|�||����nt|tj��r1|���D]\}}|�||���n�t|tj	��r`t
j
tj	tjttf|��}|D]\}}|�||���nSt|d��rCt|d��r3|���D]}|�|||���|���D]\}}|�||���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__
        r�z/extend() takes at most 1 positional arguments (z given)rrrrN)rJ�	TypeErrorr,r!rjr�r-r.�itemsr0r/r1rr2r)rr�rwr�rr{rFs       rrzzHTTPHeaderDict.extendOs���
�t�9�9�q�=�=��T�#�d�)�)�T�T�T���
��t�9�9��>�>��Q���r���e�^�,�,�	*�!�O�O�-�-�
#�
#���S�����c�"�"�"�"�
#�
��v�~�
.�
.�	*�!�K�K�M�M�
#�
#���S�����c�"�"�"�"�
#�
��v��
/�
/�	*��K�����S�#�X�0F� G��O�O�E�#�
%�
%�
��U�����e�$�$�$�$�
%�
�U�F�
#�
#�	*���}�(E�(E�	*��z�z�|�|�
*�
*������e�C�j�)�)�)�)� �,�,�.�.�	!�	!�J�C���H�H�S�%� � � � �	!�	!r�	list[str]c��dSrrrs  r�getlistzHTTPHeaderDict.getlistp����rr$�list[str] | _DTc��dSrr)rrr�s   rr�zHTTPHeaderDict.getlisttr�r�_Sentinel | _DTc��	|j|���}|dd�S#t$r|tjurgcYS|cYSwxYw)zmReturns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist.r�N)r5r�rIr&r')rrr�r�s    rr�zHTTPHeaderDict.getlistxsg��
	��?�3�9�9�;�;�/�D�����8�O���	�	�	��)�.�.�.��	�	�	��N�N�N�	���s�+�A�A�Ac�t�t|��j�dt|������d�S)N�(�))r�r�dictr�rs r�__repr__zHTTPHeaderDict.__repr__�s4���t�*�*�%�B�B��T�_�_�->�->�(?�(?�B�B�B�Brc�x�|D]6}|�|��}|g|�|j|���<�7dSr)r�r5r�)rr�rr{s    rryzHTTPHeaderDict._copy_from�sI���	7�	7�C��-�-��$�$�C�,/�;�#�;�D�O�C�I�I�K�K�(�(�	7�	7rc�^�t|����}|�|��|Sr)r�ry)r�clones  r�copyzHTTPHeaderDict.copy�s,����T�
�
����
��������rrkc#�K�|D]:}|j|���}|dd�D]}|d|fV���;dS)z8Iterate over all header lines, including duplicate ones.r�Nrr�)rrr�r{s    rrjzHTTPHeaderDict.iteritems�sf�����	#�	#�C��?�3�9�9�;�;�/�D��A�B�B�x�
#�
#���1�g�s�l�"�"�"�"�
#�	#�	#rc#�K�|D]H}|j|���}|dd�|dd���fV��IdS)z:Iterate over all headers, merging duplicate ones together.rr�r�Nr�r�s   rr�zHTTPHeaderDict.itermerged�s_�����	-�	-�C��/�#�)�)�+�+�.�C��a�&�$�)�)�C����G�,�,�,�,�,�,�,�	-�	-rrec� �t|��Sr)rers rr�zHTTPHeaderDict.items�s��%�d�+�+�+r�header_name�potential_valuec�`�||vr)||j|���dd�vSdS)Nr�Fr�)rr�r�s   rrqz$HTTPHeaderDict._has_value_for_header�s9���$���"�d�o�k�6G�6G�6I�6I�&J�1�2�2�&N�N�N��urc�`�t|��}|�tS|�|��|Sr)r3�NotImplementedrz)rr�r�s   r�__ior__zHTTPHeaderDict.__ior__�s7��D�E�J�J���&�!�!����'�(�(�(��rc��t|��}|�tS|���}|�|��|Sr)r3r�r�rz�rr�r��results    r�__or__zHTTPHeaderDict.__or__�sD��D�E�J�J���&�!�!��������
�
�)�*�*�*��
rc��t|��}|�tSt|��|��}|�|��|Sr)r3r�r�rzr�s    r�__ror__zHTTPHeaderDict.__ror__�sL��D�E�J�J���&�!�!���d���/�0�0���
�
�d�����
rr)rgr*rwr)rrr{rrr=r)rrrr=)rr)rrm)r�)rrr�rrr)r�r)rrmr_r)rrr{rr�rmrr=)r�r�rwrrr=)rrrr�)rrr�r$rr�)rrr�r�rr�)rr)r�r!rr=)rr!ru)rre)r�rr�rrrm)r�r)rr!)&rrrr`rar@rOrrQrtr�r�r�rSrWr�r�rzr-�overloadr�r&r'�
getheaders�getallmatchingheaders�iget�get_allr�ryr�rjr�r�rqr�r�r�rbrcs@rr!r!�s�����������B6�5�5�5�	 �	 �	 �	 �	 �	 �	 �2�2�2�2�"�"�"�"�)�)�)�)�����
0�0�0�0�0�0�0�	
�	
�	
�	
�&�&�&�&�$�$�$�$�����
����:?�!!�!!�!!�!!�!!�!!�F!�!�!�!�B�_�����_���_�����_��4=�3G������&�J�#���D��G�C�C�C�C�7�7�7�7�
����
#�#�#�#�-�-�-�-�,�,�,�,�����
���������������r)r(r)rr*)!�
__future__rr-�collectionsr�enumrr�	threadingr�
TYPE_CHECKING�typing_extensionsrr
�__all__�TypeVarr"r#r$�Unionr.rr0r1r�r&r3�Generic�MutableMappingr �Setrer!rrr�<module>r�s4��"�"�"�"�"�"�
�
�
�
�#�#�#�#�#�#���������������	��
�+�*�*�*�*�*����������#�$4�
5���f�n�U�����f�n�U�����f�n�U�������
�N�3��8��
�O�F�L��c��*�+������������������(Z/�Z/�Z/�Z/�Z/�F�N�3��8�4�f�6K�C�QT�H�6U�Z/�Z/�Z/�z-�-�-�-�-�V�Z���S�#�X�(>�?�-�-�-�`C�C�C�C�C�V�*�3��8�4�C�C�C�C�Cr