Re;*ddlmZ ddlmZmZn#e$r ddlmZmZYnwxYw ddlmZn#e$rGddZYnwxYwddlm Z ddl m Z dd l m Z dd lmZmZd d gZeZGd d eZGdd eZdS))absolute_import)MappingMutableMapping)RLockceZdZdZdZdS)rcdSNselfs /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/urllib3/_collections.py __enter__zRLock.__enter__  DcdSr r )r exc_type exc_value tracebacks r __exit__zRLock.__exit__rrN)__name__ __module__ __qualname__rrr rr rr s2        rr) OrderedDict) InvalidHeader)six)iterkeys itervaluesRecentlyUsedContainerHTTPHeaderDictcHeZdZdZeZd dZdZdZdZ dZ d Z d Z d Z dS) 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 Ncz||_||_||_t |_dSr )_maxsize dispose_func ContainerCls _containerrlock)r maxsizer%s r __init__zRecentlyUsedContainer.__init__/s3 (++--GG rc|j5|j|}||j|<|cdddS#1swxYwYdSr )r(r'pop)r keyitems r __getitem__z!RecentlyUsedContainer.__getitem__6s Y  ?&&s++D#'DOC                   s &;??cnt}|j5|j|t}||j|<t |j|jkr|jd\}}dddn #1swxYwY|jr |tur||dSdSdS)NF)last)_Nullr(r'getlenr$popitemr%)r r-value evicted_value_keys r __setitem__z!RecentlyUsedContainer.__setitem__=s Y J J O//U;;M#(DOC 4?##dm33&*o&=&=5&=&I&I#m J J J J J J J J J J J J J J J   -e!;!;   m , , , , , - -!;!;sA&BBBc|j5|j|}dddn #1swxYwY|jr||dSdSr )r(r'r,r%)r r-r6s r __delitem__z!RecentlyUsedContainer.__delitem__Ls Y - -O'',,E - - - - - - - - - - - - - - -   %   e $ $ $ $ $ % %s /33cl|j5t|jcdddS#1swxYwYdSr )r(r4r'r s r __len__zRecentlyUsedContainer.__len__Ss{ Y ( (t'' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s )--c td)Nz7Iteration over this class is unlikely to be threadsafe.)NotImplementedErrorr s r __iter__zRecentlyUsedContainer.__iter__Ws! E   rc|j5tt|j}|jdddn #1swxYwY|jr|D]}||dSdSr )r(listrr'clearr%)r valuesr6s r rCzRecentlyUsedContainer.clear\s Y $ $*T_5566F O ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $   ) ) )!!%(((( ) ) ) )s;AAAc|j5tt|jcdddS#1swxYwYdSr )r(rBrr'r s r keyszRecentlyUsedContainer.keysfs Y 3 31122 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s !6::)r"N)rrr__doc__rr&r*r/r9r;r=r@rCrFr rr rrs  L - - -%%%(((   )))33333rceZdZdZdfd ZdZdZdZdZdZ d Z e j re jZe jZeZd Zd Zefd Zd ZdZdZefdZeZeZeZeZdZdZdZdZ dZ!dZ"e#dZ$xZ%S)r 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' Nc 2tt|t|_|@t |tr||n|||r||dSdSr )superr r*rr' isinstance _copy_fromextend)r headerskwargs __class__s r r*zHTTPHeaderDict.__init__s nd##,,...%--  '>22 %(((( G$$$  KK       rc|||g|j|<|j|Sr r'lowerr r-vals r r9zHTTPHeaderDict.__setitem__s/(+Sz $syy{{++rcz|j|}d|ddS)N, rr'rSjoinrTs r r/zHTTPHeaderDict.__getitem__s0ociikk*yyQRR!!!rc:|j|=dSr rRr r-s r r;zHTTPHeaderDict.__delitem__s OCIIKK ( ( (rc8||jvSr )rSr'r[s r __contains__zHTTPHeaderDict.__contains__syy{{do--rcjt|tst|dsdSt|t|st||}t d|Dt d|DkS)NrFFc3HK|]\}}||fVdSr rS.0kvs r z(HTTPHeaderDict.__eq__..s2AAtq!QWWYYNAAAAAArc3HK|]\}}||fVdSr r`ras r rez(HTTPHeaderDict.__eq__..sKJ J #q!QWWYYNJ J J J J J r)rKrhasattrtypedict itermergedr others r __eq__zHTTPHeaderDict.__eq__s%)) '%2H2H 5%d,, &DJJu%%EAAt/@/@AAAAATJ J ','7'7'9'9J J J F F   rc.|| Sr )rmrks r __ne__zHTTPHeaderDict.__ne__s;;u%%%%rc*t|jSr )r4r'r s r r=zHTTPHeaderDict.__len__s4?###rc#VK|jD] }|dV dS)Nr)r'rD)r valss r r@zHTTPHeaderDict.__iter__s<O**,,  Dq'MMMM  rcV ||}||=|S#t$r||jur|cYSwxYw)zD.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. )KeyError_HTTPHeaderDict__marker)r r-defaultr6s r r,zHTTPHeaderDict.popsT IE S L    $-''NNN s ((c0 ||=dS#t$rYdSwxYwr )rtr[s r discardzHTTPHeaderDict.discards4 S     DD s  c|}||g}|j||}||ur||dSdS)zAdds a (name, value) pair, doesn't overwrite the value if it already exists. >>> headers = HTTPHeaderDict(foo='bar') >>> headers.add('Foo', 'baz') >>> headers['foo'] 'bar, baz' N)rSr' setdefaultappend)r r-rU key_lowernew_valsrrs r addzHTTPHeaderDict.adds\IIKK :)))X>> 4   KK      rct|dkr/tdt|t|dkr|dnd}t|tr1|D]\}}|||nt|tr"|D]}||||nbt|dr4| D]}||||n|D]\}}|||| D]\}}|||dS)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__ rz9extend() takes at most 1 positional arguments ({0} given)rr rFN) r4 TypeErrorformatrKr iteritemsr~rrgrFitems)r argsrOrlr-rUr6s r rMzHTTPHeaderDict.extends t99q==((.s4yy(9(9 t99>>Qr e^ , , %!OO-- # #Sc"""" # w ' ' % * *eCj)))) * UF # # %zz|| * *eCj)))) *$ % % Ue$$$$ ,,.. ! !JC HHS%  ! !rc |j|}|ddS#t$r||jurgcYS|cYSwxYw)zmReturns a list of all the values for the named field. Returns an empty list if the key doesn't exist.rN)r'rSrtru)r r-rvrrs r getlistzHTTPHeaderDict.getlistsf ?399;;/D 8O    $-'' NNN s+AAActt|jdt|dS)N())rhrrirjr s r __repr__zHTTPHeaderDict.__repr__s4::...T__5F5F0G0G0G0GHHrc|D][}||}t|trt|}|g|z|j|<\dSr )rrKrBr'rS)r rlr-rUs r rLzHTTPHeaderDict._copy_fromsf 7 7C--$$C#t$$ 3ii,/53;DOCIIKK ( (  7 7rc^t|}|||Sr )rhrL)r clones r copyzHTTPHeaderDict.copy"s,T   rc#K|D]:}|j|}|ddD]}|d|fV;dS)z8Iterate over all header lines, including duplicate ones.rNrrR)r r-rrrUs r rzHTTPHeaderDict.iteritems'sf # #C?399;;/DABBx # #1gsl"""" # # #rc#K|D]H}|j|}|dd|ddfVIdS)z:Iterate over all headers, merging duplicate ones together.rrWrNrXrTs r rjzHTTPHeaderDict.itermerged.s_ - -C/#))++.Ca&$))CG,,, , , , , - -rcDt|Sr )rBrr s r rzHTTPHeaderDict.items4sDNN$$%%%rc`d}g}|jD]}||r?|std|z|d\}}||dz|zf|d<V|dd\}}|||f||S)z4Read headers from a Python 2 httplib message object.)  z/Header continuation with no previous header: %sr:r)rN startswithrstripsplitr{)clsmessageobs_fold_continued_leadersrNliner-r6s r from_httplibzHTTPHeaderDict.from_httplib7s &1"O 1 1D9::  (IDP")JC#& djjll(B"CGBKC++JC NNC/ 0 0 0 0s7||rr )&rrrrGr*r9r/r;r]rmrorPY2rrrobjectrur=r@r,rxr~rMr getheadersgetallmatchingheadersigetget_allrrLrrrjr classmethodr __classcell__)rPs@r r r ksB       ,,,""")))...   &&& w/!*#. vxxH$$$ ("  !!!8$,    J# DGIII777 ###--- &&&[rN) __future__rcollections.abcrr ImportError collections threadingrr exceptionsrpackagesr packages.sixrr__all__rr2rr r rr rs&&&&&&477777777744433333333334 $#####%%%%%%........ "$4 5 I3I3I3I3I3NI3I3I3Xfffff^fffffs !!,AA