HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/urllib3/__pycache__/_collections.cpython-37.pyc
B

���g�C�@s8ddlmZddlZddlmZddlmZmZddlm	Z	ej
rbddlmZm
Z
Gdd�de�Zd	d
gZe�d�Ze�d�Ze�d
�Zejd
ejeefejejeefdfZGdd�de�Zddd�dd�ZGdd	�d	ejeefejeef�ZGdd�dejejeef�Z Gdd
�d
ejeef�Z!dS)�)�annotationsN)�OrderedDict)�Enum�auto)�RLock)�Protocol�Selfc@s*eZdZdd�dd�Zddd�dd�Zd	S)
�HasGettableStringKeysztyping.Iterator[str])�returncCsdS)N�)�selfrr�>/usr/local/lib/python3.7/site-packages/urllib3/_collections.py�keysszHasGettableStringKeys.keys�str)�keyr
cCsdS)Nr)rrrrr
�__getitem__sz!HasGettableStringKeys.__getitem__N)�__name__�
__module__�__qualname__rrrrrr
r	
sr	�RecentlyUsedContainer�HTTPHeaderDict�_KT�_VT�_DTc@seZdZe�ZdS)�	_SentinelN)rrrr�
not_passedrrrr
r'sr�objectzValidHTTPHeaderSource | None)�	potentialr
cCs�t|t�r|St|tj�r0t�tjttf|�St|tj�rXt�tjtjttf|�St|d�rxt|d�rxt�d|�SdSdS)Nrrr	)	�
isinstancer�typing�Mapping�castr�Iterable�Tuple�hasattr)rrrr
�%ensure_can_construct_http_header_dict+s
r%cs�eZdZUdZded<ded<ded<ded	<d%dddd
��fdd�
Zddd�dd�Zdddd�dd�Zddd�dd�Zdd�dd�Z	dd�dd�Z
dd�d d!�Zd"d�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�_maxsizez#typing.Callable[[_VT], None] | None�dispose_funcr�lock�
N�None)�maxsizer)r
cs*t���||_||_t�|_t�|_dS)N)�super�__init__r(r)rr&rr*)rr-r))�	__class__rr
r/Rs

zRecentlyUsedContainer.__init__rr)rr
c	Cs,|j�|j�|�}||j|<|SQRXdS)N)r*r&�pop)rr�itemrrr
r]s
z!RecentlyUsedContainer.__getitem__)r�valuer
c	Cs�d}|j�by||j�|�f}||j|<Wn<tk
rf||j|<t|j�|jkrb|jjdd�}YnXWdQRX|dk	r�|jr�|\}}|�|�dS)NF)�last)r*r&r1�KeyError�lenr(�popitemr))rrr3Zevicted_item�_�
evicted_valuerrr
�__setitem__ds
z!RecentlyUsedContainer.__setitem__c	Cs2|j�|j�|�}WdQRX|jr.|�|�dS)N)r*r&r1r))rrr3rrr
�__delitem__}sz!RecentlyUsedContainer.__delitem__)r
c	Cs|j�t|j�SQRXdS)N)r*r6r&)rrrr
�__len__�szRecentlyUsedContainer.__len__ztyping.NoReturncCstd��dS)Nz7Iteration over this class is unlikely to be threadsafe.)�NotImplementedError)rrrr
�__iter__�szRecentlyUsedContainer.__iter__c	CsL|j�t|j���}|j��WdQRX|jrHx|D]}|�|�q6WdS)N)r*�listr&�values�clearr))rr@r3rrr
rA�s
zRecentlyUsedContainer.clearzset[_KT]c	Cs |j�t|j���SQRXdS)N)r*�setr&r)rrrr
r�szRecentlyUsedContainer.keys)r+N)rrr�__doc__�__annotations__r/rr:r;r<r>rAr�
__classcell__rr)r0r
r?s

c@sVeZdZUdZded<ddd�dd�Zdd	�d
d�Zdd	�d
d�Zddd�dd�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�_headersr,)�headersr
cCs
||_dS)N)rG)rrHrrr
r/�szHTTPHeaderDictItemView.__init__r')r
cCstt|j����S)N)r6r?rG�	iteritems)rrrr
r<�szHTTPHeaderDictItemView.__len__z typing.Iterator[tuple[str, str]]cCs
|j��S)N)rGrI)rrrr
r>�szHTTPHeaderDictItemView.__iter__r�bool)r2r
cCsDt|t�r@t|�dkr@|\}}t|t�r@t|t�r@|j�||�SdS)N�F)r�tupler6rrG�_has_value_for_header)rr2Z
passed_keyZ
passed_valrrr
�__contains__�s
z#HTTPHeaderDictItemView.__contains__N)	rrrrCrDr/r<r>rNrrrr
rF�s
rFcseZdZUdZded<dTddd��fdd	�
Zddd
d�dd
�Zddd�dd�Zdd
d�dd�Zddd�dd�Z	dUdddd��fdd�
Z
ddd�dd�Zddd�dd�Zd d!�d"d#�Z
d$d!�d%d&�Zdd
d�d'd(�Zd)d*�dddd
d+�d,d-�Zd.dd
d/�d0d1�Zejdd2d�d3d4��Zejdd5d6d�d7d4��Zejfdd8d6d�d9d4�Zd:d!�d;d<�ZeZeZeZeZdd!�d=d>�Zdd
d�d?d@�Zdd!�dAdB�ZdCd!�dDdE�ZdCd!�dFdG�Z dHd!�dIdJ�Z!ddddK�dLdM�Z"ddd�dNdO�Z#ddd�dPdQ�Z$ddd�dRdS�Z%�Z&S)Vrap
    :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&NzValidHTTPHeaderSource | Noner)rH�kwargscsJt���i|_|dk	r8t|t�r.|�|�n
|�|�|rF|�|�dS)N)r.r/r&rr�
_copy_from�extend)rrHrO)r0rr
r/�s


zHTTPHeaderDict.__init__r,)r�valr
cCs*t|t�r|�d�}||g|j|��<dS)Nzlatin-1)r�bytes�decoder&�lower)rrrRrrr
r:�s

zHTTPHeaderDict.__setitem__)rr
cCs |j|��}d�|dd��S)Nz, �)r&rU�join)rrrRrrr
rszHTTPHeaderDict.__getitem__cCs|j|��=dS)N)r&rU)rrrrr
r;szHTTPHeaderDict.__delitem__rrJcCst|t�r|��|jkSdS)NF)rrrUr&)rrrrr
rNs
zHTTPHeaderDict.__contains__�)r�defaultr
cst��||�S)N)r.�
setdefault)rrrY)r0rr
rZ
szHTTPHeaderDict.setdefault)�otherr
cCsDt|�}|dkrdSt|�|�}dd�|��D�dd�|��D�kS)NFcSsi|]\}}||���qSr)rU)�.0�k�vrrr
�
<dictcomp>sz)HTTPHeaderDict.__eq__.<locals>.<dictcomp>)r%�type�
itermerged)rr[�maybe_constructableZother_as_http_header_dictrrr
�__eq__szHTTPHeaderDict.__eq__cCs|�|�S)N)rc)rr[rrr
�__ne__szHTTPHeaderDict.__ne__r')r
cCs
t|j�S)N)r6r&)rrrr
r<szHTTPHeaderDict.__len__ztyping.Iterator[str]ccs"x|j��D]}|dVqWdS)Nr)r&r@)r�valsrrr
r>!szHTTPHeaderDict.__iter__cCs$y
||=Wntk
rYnXdS)N)r5)rrrrr
�discard&s
zHTTPHeaderDict.discardF)�combine)rrRrgr
cCsrt|t�r|�d�}|��}||g}|j�||�}||k	rnt|�dksJt�|rd|dd||d<n
|�|�dS)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')]
        zlatin-1rK���z, N)	rrSrTrUr&rZr6�AssertionError�append)rrrRrg�	key_lower�new_valsrerrr
�add,s

zHTTPHeaderDict.add�ValidHTTPHeaderSource)�argsrOr
cOsBt|�dkr tdt|��d���t|�dkr4|dnd}t|t�rfx�|��D]\}}|�||�qLWn�t|tj�r�x�|��D]\}}|�||�q|Wn�t|tj	�r�t�
tj	tjttf|�}xZ|D]\}}|�||�q�Wn<t
|d��rt
|d��rx"|��D]}|�|||��qWx"|��D]\}}|�||��q$WdS)	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__
        rVz/extend() takes at most 1 positional arguments (z given)rrrrN)r6�	TypeErrorrrrIrmrr �itemsr"r!r#rr$r)rrorOr[rrRr3rrr
rQOs&
zHTTPHeaderDict.extendz	list[str]cCsdS)Nr)rrrrr
�getlistpszHTTPHeaderDict.getlistrzlist[str] | _DTcCsdS)Nr)rrrYrrr
rrtsz_Sentinel | _DTcCsFy|j|��}Wn"tk
r4|tjkr0gS|SX|dd�SdS)zmReturns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist.rVN)r&rUr5rr)rrrYrerrr
rrxs
rcCs.dddddddg}x|D]}|�|�qW|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-LengthZDigestz
Last-Modified)rf)rZcontent_specific_headers�headerrrr
�_prepare_for_method_change�s
z)HTTPHeaderDict._prepare_for_method_changecCst|�j�dt|����d�S)N�(�))r`r�dictra)rrrr
�__repr__�szHTTPHeaderDict.__repr__cCs0x*|D]"}|�|�}|f|�|j|��<qWdS)N)rrr&rU)rr[rrRrrr
rP�s

zHTTPHeaderDict._copy_fromcCst|��}|�|�|S)N)r`rP)r�clonerrr
�copy�s

zHTTPHeaderDict.copyz typing.Iterator[tuple[str, str]]ccsDx>|D]6}|j|��}x"|dd�D]}|d|fVq&WqWdS)z8Iterate over all header lines, including duplicate ones.rVNr)r&rU)rrrerRrrr
rI�s
zHTTPHeaderDict.iteritemsccs<x6|D].}|j|��}|dd�|dd��fVqWdS)z:Iterate over all headers, merging duplicate ones together.rz, rVN)r&rUrW)rrrRrrr
ra�s
zHTTPHeaderDict.itermergedrFcCst|�S)N)rF)rrrr
rq�szHTTPHeaderDict.items)�header_name�potential_valuer
cCs&||kr"||j|��dd�kSdS)NrVF)r&rU)rr{r|rrr
rM�sz$HTTPHeaderDict._has_value_for_headercCs"t|�}|dkrtS|�|�|S)N)r%�NotImplementedrQ)rr[rbrrr
�__ior__�s

zHTTPHeaderDict.__ior__cCs*t|�}|dkrtS|��}|�|�|S)N)r%r}rzrQ)rr[rb�resultrrr
�__or__�s
zHTTPHeaderDict.__or__cCs.t|�}|dkrtSt|�|�}|�|�|S)N)r%r}r`rQ)rr[rbrrrr
�__ror__�s
zHTTPHeaderDict.__ror__)N)rX)'rrrrCrDr/r:rr;rNrZrcrdr<r>rfrmrQr�overloadrrrrrt�
getheaders�getallmatchingheaders�iget�get_allrxrPrzrIrarqrMr~r�r�rErr)r0r
r�sB
 #!	
)"�
__future__rr�collectionsr�enumrr�	threadingr�
TYPE_CHECKING�typing_extensionsrrr	�__all__�TypeVarrrr�Unionr rr"r#rnrr%�Generic�MutableMappingr�SetrFrrrrr
�<module>s*


&] 0