Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/urllib3/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/urllib3/__pycache__/_collections.cpython-312.pyc

�

%ٜg�C��6�ddlmZddlZddlmZddlmZmZddlm	Z	ejrddlmZddlm
Z
Gd�d	e�Zd
dgZej d�Zej d
�Zej d�Zej(dej*eefej.eeefd	fZGd�de�Z				dd�ZGd�d
ej8eefej:eef�ZGd�deeeef�Z Gd�dej:eef�Z!y)�)�annotationsN)�OrderedDict)�Enum�auto)�RLock)�Protocol)�Selfc��eZdZdd�Zdd�Zy)�HasGettableStringKeysc��y�N���selfs �?/usr/local/lib/python3.12/site-packages/urllib3/_collections.py�keyszHasGettableStringKeys.keys����c��yr
r�r�keys  r�__getitem__z!HasGettableStringKeys.__getitem__rrN��returnztyping.Iterator[str]�r�strrr)�__name__�
__module__�__qualname__rrrrrrrs��3�3rr�RecentlyUsedContainer�HTTPHeaderDict�_KT�_VT�_DTc��eZdZe�Zy)�	_SentinelN)rrrr�
not_passedrrrr&r&'s	����Jrr&c��t|t�r|St|tj�r1tjtjt
t
f|�St|tj�r8tjtjtt
t
f|�St|d�r"t|d�rtjd|�Sy)Nrrr)	�
isinstancer!�typing�Mapping�castr�Iterable�tuple�hasattr)�	potentials r�%ensure_can_construct_http_header_dictr1+s����)�^�,���	�I�v�~�~�	.��{�{�6�>�>�#�s�(�3�Y�?�?�	�I�v���	/��{�{�6�?�?�5��c��?�;�Y�G�G�	��F�	#��	�=�(I��{�{�2�I�>�>�rc���eZdZUdZded<ded<ded<ded	<		d					d�fd
�
Zdd�Zdd�Zdd
�Zdd�Z	dd�Z
dd�Zdd�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�lockc�z��t�|��||_||_t	�|_t
�|_yr
)�super�__init__r5r7rr3rr8)r�maxsizer7�	__class__s   �rr;zRecentlyUsedContainer.__init__Rs1���
	������
�(���%�-����G��	rc��|j5|jj|�}||j|<|cddd�S#1swYyxYwr
)r8r3�pop)rr�items   rrz!RecentlyUsedContainer.__getitem__]s8��
�Y�Y��?�?�&�&�s�+�D�#'�D�O�O�C� ���Y�Y�s�,A�Ac��d}|j5	||jj|�f}||j|<ddd�|�$|jr|\}}|j|�yyy#t$rP||j|<t	|j�|j
kDr|jj
d��}Y��wxYw#1swY��xYw)NF)�last)r8r3r?�KeyError�lenr5�popitemr7)rr�value�evicted_item�_�
evicted_values      r�__setitem__z!RecentlyUsedContainer.__setitem__ds�����
�Y�Y�
G� #�D�O�O�$7�$7��$<�<��',�����$��&�#��(9�(9�+��A�}����m�,�):�#���
G�(-�����$��t���'�$�-�-�7�$(�?�?�#:�#:��#:�#F�L��
G���Y�s)�C�,A,�,AC�C�C�C�Cc��|j5|jj|�}ddd�|jr|j�yy#1swY�(xYwr
)r8r3r?r7)rrrFs   r�__delitem__z!RecentlyUsedContainer.__delitem__}sH��
�Y�Y��O�O�'�'��,�E��������e�$���Y�s�A�Ac�p�|j5t|j�cddd�S#1swYyxYwr
)r8rDr3rs r�__len__zRecentlyUsedContainer.__len__�s��
�Y�Y��t���'��Y�Y�s�,�5c��td��)Nz7Iteration over this class is unlikely to be threadsafe.)�NotImplementedErrorrs r�__iter__zRecentlyUsedContainer.__iter__�s��!�E�
�	
rc�
�|j5t|jj��}|jj	�ddd�|j
rD]}|j|��yy#1swY�/xYwr
)r8�listr3�values�clearr7)rrTrFs   rrUzRecentlyUsedContainer.clear�se��
�Y�Y��$�/�/�0�0�2�3�F��O�O�!�!�#��
������!�!�%�(� ���Y�s�>A9�9Bc��|j5t|jj��cddd�S#1swYyxYwr
)r8�setr3rrs rrzRecentlyUsedContainer.keys�s(��
�Y�Y��t���+�+�-�.��Y�Y�s	�#:�A)�
N)r<r4r7r6r�None)rr"rr#)rr"rFr#rrY)rr"rrY�rr4)rztyping.NoReturn)rrY)rzset[_KT])rrr�__doc__�__annotations__r;rrJrLrNrQrUr�
__classcell__�r=s@rr r ?sl����-�,��M�5�5�
�K��<@�	��	�:�	�
�		��-�2%�(�
�
)�/rc�<�eZdZUdZded<d	d�Zd
d�Zdd�Zdd�Zy)
�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��||_yr
)ra)r�headerss  rr;zHTTPHeaderDictItemView.__init__�s	����
rc�Z�tt|jj���Sr
)rDrSra�	iteritemsrs rrNzHTTPHeaderDictItemView.__len__�s���4��
�
�/�/�1�2�3�3rc�6�|jj�Sr
)rarers rrQzHTTPHeaderDictItemView.__iter__�s���}�}�&�&�(�(rc���t|t�rOt|�dk(rA|\}}t|t�r,t|t�r|jj||�Sy)N�F)r)r.rDrra�_has_value_for_header)rr@�
passed_key�
passed_vals    r�__contains__z#HTTPHeaderDictItemView.__contains__�sM���d�E�"�s�4�y�A�~�%)�"�J�
��*�c�*�z�*�c�/J��}�}�:�:�:�z�R�R�rN)rcr!rrYrZ�rz typing.Iterator[tuple[str, str]])r@�objectr�bool)	rrrr[r\r;rNrQrlrrrr`r`�s#���8�� �4�)�rr`c�|��eZdZUdZded<d!d"�fd�
Zd#d�Zd$d�Zd%d�Zd&d�Z	d'd(�fd	�
Z
d)d
�Zd)d�Zd*d�Z
d+d
�Zd%d�Zdd�d,d�Zd-d�Zej&d.d��Zej&d/d��Zej,f					d0d�Zd1d�ZeZeZeZeZd2d�Zd3d�Zd1d�Zd4d�Zd4d�Z d5d�Z!d6d�Z"d7d�Z#d8d�Z$d8d �Z%�xZ&S)9r!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]]r3c����t�|��i|_|�3t|t�r|j|�n|j
|�|r|j
|�yyr
)r:r;r3r)r!�
_copy_from�extend)rrc�kwargsr=s   �rr;zHTTPHeaderDict.__init__�sQ���
����������'�>�2�����(����G�$���K�K���rc��t|t�r|jd�}||g|j|j	�<y)N�latin-1)r)�bytes�decoder3�lower�rr�vals   rrJzHTTPHeaderDict.__setitem__�s2���c�5�!��*�*�Y�'�C�(+�S�z�����	�	��$rc�d�|j|j�}dj|dd�S)N�, ��r3ry�joinrzs   rrzHTTPHeaderDict.__getitem__s+���o�o�c�i�i�k�*���y�y��Q�R��!�!rc�:�|j|j�=yr
�r3ryrs  rrLzHTTPHeaderDict.__delitem__s���O�O�C�I�I�K�(rc�\�t|t�r|j�|jvSy�NF)r)rryr3rs  rrlzHTTPHeaderDict.__contains__s$���c�3���9�9�;�$�/�/�1�1�rc�$��t�|�||�Sr
)r:�
setdefault)rr�defaultr=s   �rr�zHTTPHeaderDict.setdefault
s����w�!�#�w�/�/rc�"�t|�}|�yt|�|�}|j�D��cic]\}}|j�|��c}}|j�D��cic]\}}|j�|��c}}k(Scc}}wcc}}wr�)r1�type�
itermergedry)r�other�maybe_constructable�other_as_http_header_dict�k�vs      r�__eq__zHTTPHeaderDict.__eq__s���C�E�J���&��(2��T�
�3F�(G�%�)-���):�;�):���A����	�1��):�;�%>�%I�%I�%K�@
�%K�T�Q��A�G�G�I�q�L�%K�@
�
�	
��;��@
s�B�$Bc�&�|j|�Sr
)r�)rr�s  r�__ne__zHTTPHeaderDict.__ne__s���;�;�u�%�%�%rc�,�t|j�Sr
)rDr3rs rrNzHTTPHeaderDict.__len__s���4�?�?�#�#rc#�XK�|jj�D]	}|d���y�w)Nr)r3rT)r�valss  rrQzHTTPHeaderDict.__iter__!s&�����O�O�*�*�,�D��q�'�M�-�s�(*c�*�	||=y#t$rYywxYwr
)rCrs  r�discardzHTTPHeaderDict.discard&s ��	��S�	���	��	�s��	�F)�combinec��t|t�r|jd�}|j�}||g}|jj||�}||ur3t
|�dk\sJ�|r|ddz|z|d<y|j|�yy)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')]
        rvrh���r}N)r)rwrxryr3r�rD�append)rrr{r��	key_lower�new_valsr�s       r�addzHTTPHeaderDict.add,s���(�c�5�!��*�*�Y�'�C��I�I�K�	���:�����)�)�)�X�>���4���t�9��>�!�>����8�d�?�S�0��R�����C� � rc�0�t|�dkDrtdt|��d���t|�dk\r|dnd}t|t�r+|j	�D]\}}|j||��n�t|tj�r+|j�D]\}}|j||��n�t|tj�rUt
jtjtttf|�}|D]\}}|j||��nBt|d�r6t|d�r*|j�D]}|j|||��|j�D]\}}|j||��y)	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)rD�	TypeErrorr)r!rer�r*r+�itemsr-r,r.rr/r)r�argsrtr�rr{rFs       rrszHTTPHeaderDict.extendOsF��
�t�9�q�=��A�#�d�)��G�T��
��t�9��>��Q��r���e�^�,�!�O�O�-���S�����c�"�.�
��v�~�~�
.�!�K�K�M���S�����c�"�*�
��v���
/��K�K�����c�3�h�� @�%�H�E�#�
��U�����e�$�$�
�U�F�
#���}�(E��z�z�|������e�C�j�)�$�!�,�,�.�J�C���H�H�S�%� �)rc��yr
rrs  r�getlistzHTTPHeaderDict.getlistps��.1rc��yr
r)rrr�s   rr�zHTTPHeaderDict.getlistss��BErc��	|j|j�}|ddS#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)r3ryrCr&r')rrr�r�s    rr�zHTTPHeaderDict.getlistvsQ��
	��?�?�3�9�9�;�/�D����8�O���	��)�.�.�.��	��N�	�s�$�A�A�Ac�>�gd�}|D]}|j|��|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�headers   r�_prepare_for_method_changez)HTTPHeaderDict._prepare_for_method_change�s'��
$
� �/�F��L�L�� �/��rc�f�t|�j�dt|j���d�S)N�(�))r�r�dictr�rs r�__repr__zHTTPHeaderDict.__repr__�s-���t�*�%�%�&�a��T�_�_�->�(?�'@��B�Brc�t�|D]3}|j|�}|g|�|j|j�<�5yr
)r�r3ry)rr�rr{s    rrrzHTTPHeaderDict._copy_from�s4���C��-�-��$�C�,/�;�#�;�D�O�O�C�I�I�K�(�rc�H�t|��}|j|�|Sr
)r�rr)r�clones  r�copyzHTTPHeaderDict.copy�s"����T�
���
������rc#�zK�|D]2}|j|j�}|ddD]}|d|f���
�4y�w)z8Iterate over all header lines, including duplicate ones.r~Nrr�)rrr�r{s    rrezHTTPHeaderDict.iteritems�sB�����C��?�?�3�9�9�;�/�D��A�B�x���1�g�s�l�"� ��s�9;c#�K�|D]:}|j|j�}|ddj|dd�f���<y�w)z:Iterate over all headers, merging duplicate ones together.rr}r~Nrrzs   rr�zHTTPHeaderDict.itermerged�sB�����C��/�/�#�)�)�+�.�C��a�&�$�)�)�C���G�,�,�,��s�AAc��t|�Sr
)r`rs rr�zHTTPHeaderDict.items�s
��%�d�+�+rc�P�||vr"||j|j�ddvSy)Nr~Fr�)r�header_name�potential_values   rriz$HTTPHeaderDict._has_value_for_header�s1���$��"�d�o�o�k�6G�6G�6I�&J�1�2�&N�N�N�rc�N�t|�}|�tS|j|�|Sr
)r1�NotImplementedrs)rr�r�s   r�__ior__zHTTPHeaderDict.__ior__�s.��D�E�J���&�!�!����'�(��rc�n�t|�}|�tS|j�}|j|�|Sr
)r1r�r�rs�rr�r��results    r�__or__zHTTPHeaderDict.__or__�s9��D�E�J���&�!�!�������
�
�)�*��
rc�p�t|�}|�tSt|�|�}|j|�|Sr
)r1r�r�rsr�s    r�__ror__zHTTPHeaderDict.__ror__�s>��D�E�J���&�!�!���d��/�0���
�
�d���
rr
)rc�ValidHTTPHeaderSource | Nonertr)rrr{rrrYr)rrrrY)rrnrro)�)rrr�rrr)r�rnrrorZr)rrr{rr�rorrY)r��ValidHTTPHeaderSourcertrrrY)rrrz	list[str])rrr�r$r�list[str] | _DT)rrr�z_Sentinel | _DTrr�)rr	)rr)r�r!rrYrm)rr`)r�rr�rrro)r�rnrr!)r�rnrr	)'rrrr[r\r;rJrrLrlr�r�r�rNrQr�r�rsr*�overloadr�r&r'r��
getheaders�getallmatchingheaders�iget�get_allr�rrr�rer�r�rir�r�r�r]r^s@rr!r!�s�����B6�5�	 �2�"�)��
0�	
�&�$��
�:?�!!�F!�B�_�_�1��1��_�_�E��E�4=�3G�3G����!0��	��$�&�J�#���D��G�C�7�
�
#�-�,��
��r)r0rnrr�)"�
__future__rr*�collectionsr�enumrr�	threadingr�
TYPE_CHECKINGr�typing_extensionsr	r�__all__�TypeVarr"r#r$�Unionr+rr-r.r�r&r1�Generic�MutableMappingr rWr`r!rrr�<module>r�s4��"�
�#���	��� �&�4��4�#�$4�
5���f�n�n�U����f�n�n�U����f�n�n�U�������
�N�N�3��8��
�O�O�E�#�s�(�O�$�����������!��(Z/�F�N�N�3��8�4�f�6K�6K�C�QT�H�6U�Z/�z-�S��s�C�x��1�-�`S�V�*�*�3��8�4�Sr

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists