a [dg @sddlmZddlZddlZddlZz ddlZWneyFdZYn0ejddkr|ddlmZe fZ e Z ddl mZddlZddlZddlmZddlmZmZmZmZmZdd lmZmZmZm Z m!Z!m"Z"m#Z#d d Zddl$Z$dd l$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-er$dd l$m.Z.ddl/Z/ddl0Z0ddl1Z2ddl3m3Z3ddl4Z4e5Z5ddl6m7Z8ddl6m9Z:da;ddZ<nddl=mZe>fZ e>Z ddl=m?ZddlZddlZddlZddl@mZmZmZmd?Zod@dAZiYn0zddBlpmqZqWn eyddBlrmqZqYn0ejddCdDkr&e3jsZsn ddElpmsZszddFltmuZuWn`eyddGltmvZvzddHlwmxZyWneydedJdKZyYn0GdLdMdMevZuYn0zddNlzm{Z{WnDeyzddNl|m{Z{WneydfdOdPZ{Yn0Yn0zddQltm}Z}WneyzddRl~mZWn eyJddRlmZYn0zddSlmZmZmZWneyxYn0GdTdUdUeZ}Yn0zddVlmZmZWnteyemdWejZdXdYZGdZd[d[eZdgd\d]ZGd^d_d_eZGd`dadaeZGdbdcdceQZYn0dS)h)absolute_importN)StringIO)FileType)shutil)urlparse urlunparseurljoinurlsplit urlunsplit) urlretrievequoteunquote url2pathname pathname2urlContentTooShortError splittypecCst|tr|d}t|S)Nutf-8) isinstanceunicodeencode_quote)srD/usr/local/lib/python3.9/site-packages/pip/_vendor/distlib/compat.pyrs  r) RequesturlopenURLError HTTPErrorHTTPBasicAuthHandlerHTTPPasswordMgr HTTPHandlerHTTPRedirectHandler build_opener) HTTPSHandler) HTMLParser)ifilter) ifilterfalsecCs<tdurddl}|dat|}|r4|ddSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.Nrz ^(.*)@(.*)$r) _userprogrecompilematchgroup)hostr+r-rrr splituser4s   r0) TextIOWrapper) rr r r0rrr r r) rr rrrr r!r"r#r$)rrr) filterfalse)match_hostnameCertificateErrorc@s eZdZdS)r4N)__name__ __module__ __qualname__rrrrr4^sr4c Csg}|s dS|d}|d|dd}}|d}||krNtdt||sb||kS|dkrv|dn>|d s|d r|t|n|t| d d |D]}|t|qt d d |dtj } | |S)zpMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 F.rrN*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr4reprlowerappend startswithr+escapereplacer,join IGNORECASEr-) ZdnhostnameZ max_wildcardsZpatspartsZleftmost remainderZ wildcardsfragpatrrr_dnsname_matchbs*    rIcCs|s tdg}|dd}|D]*\}}|dkr t||r@dS||q |s|ddD]6}|D],\}}|dkrdt||rdS||qdq\t|dkrtd |d tt|fn*t|dkrtd ||d fntd dS)a=Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDZsubjectAltNamerZDNSNZsubjectZ commonNamerz&hostname %r doesn't match either of %s, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrIr>lenr4rBmapr<)ZcertrDZdnsnamesZsankeyvaluesubrrrr3s2         r3)SimpleNamespacec@seZdZdZddZdS) ContainerzR A generic container for when multiple values need to be returned cKs|j|dSN__dict__update)selfkwargsrrr__init__szContainer.__init__N)r5r6r7__doc__rZrrrrrSsrS)whichc s"dd}tjr&||r"SdS|dur>tjdtj}|sFdS|tj}tj dkrtj |vrt| dtj tjddtj}t fd d |Drg}q‡fd d |D}ng}t }|D]P}tj|}||vr|||D](} tj|| } || |r| SqqdS) aKGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tj|o$t||o$tj| SrT)ospathexistsaccessisdir)fnmoderrr _access_checks zwhich.._access_checkNPATHwin32rPATHEXTc3s |]}|VqdSrT)r=endswith.0extcmdrr zwhich..csg|] }|qSrrrjrmrr rpzwhich..)r]r^dirnameenvironrLdefpathr:pathsepsysplatformcurdirinsertanysetnormcaseaddrB) rnrcr^rdpathextfilesseendirnormdirthefilenamerrmrr\s8         r\)ZipFile __enter__) ZipExtFilec@s$eZdZddZddZddZdS)rcCs|j|jdSrTrU)rXbaserrrrZszZipExtFile.__init__cCs|SrTrrXrrrrszZipExtFile.__enter__cGs |dSrTcloserXexc_inforrr__exit__szZipExtFile.__exit__N)r5r6r7rZrrrrrrrsrc@s$eZdZddZddZddZdS)rcCs|SrTrrrrrr"szZipFile.__enter__cGs |dSrTrrrrrr%szZipFile.__exit__cOs tj|g|Ri|}t|SrT) BaseZipFileopenr)rXargsrYrrrrr)sz ZipFile.openN)r5r6r7rrrrrrrr!sr)python_implementationcCs0dtjvrdStjdkrdStjdr,dSdS)z6Return a string identifying the Python implementation.ZPyPyjavaZJythonZ IronPythonZCPython)rvversionr]rr?rrrrr0s   r) sysconfig)CallablecCs t|tSrT)rr)objrrrcallableDsrrmbcsstrictsurrogateescapecCs:t|tr|St|tr$|ttStdt|jdSNzexpect bytes or str, not %s) rbytes text_typer _fsencoding _fserrors TypeErrortyper5filenamerrrfsencodeXs   rcCs:t|tr|St|tr$|ttStdt|jdSr) rrrdecoderrrrr5rrrrfsdecodeas   r)detect_encoding)BOM_UTF8lookupzcoding[:=]\s*([-\w.]+)cCsH|dddd}|dks*|dr.dS|dvs@|drDd S|S) z(Imitates get_normal_name in tokenizer.c.N _-rzutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)r=rAr?)orig_encencrrr_get_normal_namersrcsz jjWnty"dYn0dd}d}fdd}fdd}|}|trnd|d d}d }|sz|gfS||}|r||gfS|}|s||gfS||}|r|||gfS|||gfS) a? The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. NFrcs"zWStyYdS0dS)Nrp) StopIterationr)readlinerr read_or_stops z%detect_encoding..read_or_stopcsz|d}Wn2ty@d}dur4d|}t|Yn0t|}|sTdSt|d}z t|}Wn8tydurd|}n d|}t|Yn0r|j dkrԈdurd}n d}t||d 7}|S) Nrz'invalid or missing encoding declarationz {} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig) rUnicodeDecodeErrorformat SyntaxError cookie_refindallrr LookupErrorr)line line_stringmsgmatchesencodingcodec) bom_foundrrr find_cookies8         z$detect_encoding..find_cookieTrz utf-8-sig)__self__rAttributeErrorr?r)rrdefaultrrfirstsecondr)rrrrr}s4    &     r)r@r))r)unescape)ChainMap)MutableMapping)recursive_repr...csfdd}|S)zm Decorator to make a repr function return fillvalue for a recursive call csLtfdd}td|_td|_td|_tdi|_|S)Nc sLt|tf}|vrS|z|}W|n |0|SrT)id get_identr}discard)rXrOresult) fillvalue repr_running user_functionrrwrappers  z=_recursive_repr..decorating_function..wrapperr6r[r5__annotations__)r{getattrr6r[r5r)rrr)rrrdecorating_functions   z,_recursive_repr..decorating_functionr)rrrrr_recursive_reprs rc@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS)(ra A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cGst|p ig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)listmaps)rXrrrrrZszChainMap.__init__cCs t|dSrT)KeyErrorrXrOrrr __missing__szChainMap.__missing__c Cs8|jD]&}z||WSty*Yq0q||SrT)rrr)rXrOmappingrrr __getitem__s   zChainMap.__getitem__NcCs||vr||S|SrTrrXrOrrrrrL%sz ChainMap.getcCsttj|jSrT)rMr{unionrrrrr__len__(szChainMap.__len__cCsttj|jSrT)iterr{rrrrrr__iter__+szChainMap.__iter__cstfdd|jDS)Nc3s|]}|vVqdSrTr)rkmrOrrro/rpz(ChainMap.__contains__..rzrrrrr __contains__.szChainMap.__contains__cCs t|jSrTrrrrr__bool__1szChainMap.__bool__cCsd|dtt|jS)Nz{0.__class__.__name__}({1})rJ)rrBrNr<rrrrr__repr__4szChainMap.__repr__cGs|tj|g|RS)z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterablerrrrr9szChainMap.fromkeyscCs&|j|jdg|jddRS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rrN) __class__rcopyrrrrr>sz ChainMap.copycCs|jig|jRS)z;New ChainMap with a new dict followed by all previous maps.rrrrrr new_childDszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rNrrrrrparentsHszChainMap.parentscCs||jd|<dS)Nr)r)rXrOrPrrr __setitem__MszChainMap.__setitem__cCs6z|jd|=Wn ty0td|Yn0dS)Nr(Key not found in the first mapping: {!r})rrrrrrr __delitem__Ps zChainMap.__delitem__cCs0z|jdWSty*tdYn0dS)zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.rz#No keys found in the first mapping.N)rpopitemrrrrrrVs zChainMap.popitemcGs@z|jdj|g|RWSty:td|Yn0dS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].rrN)rpoprr)rXrOrrrrr]s z ChainMap.popcCs|jddS)z'Clear maps[0], leaving maps[1:] intact.rN)rclearrrrrrdszChainMap.clear)N)r5r6r7r[rZrrrLrrrrrr classmethodrr__copy__rpropertyrrrrrrrrrrrs.     r)cache_from_sourcecCs"|dur d}|rd}nd}||S)NFcor)r^debug_overridesuffixrrrrns r) OrderedDict)r)KeysView ValuesView ItemsViewc@seZdZdZddZejfddZejfddZdd Zd d Z d d Z d6ddZ ddZ ddZ ddZddZddZddZddZeZeZefdd Zd7d"d#Zd8d$d%Zd&d'Zd(d)Zed9d*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d!S):rz)Dictionary that remembers insertion ordercOspt|dkrtdt|z |jWn4tyZg|_}||dg|dd<i|_Yn0|j|i|dS)zInitialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. rz$expected at most 1 arguments, got %dN)rMr_OrderedDict__rootr_OrderedDict__map_OrderedDict__update)rXrkwdsrootrrrrZs     zOrderedDict.__init__cCsF||vr6|j}|d}|||g|d<|d<|j|<||||dS)z!od.__setitem__(i, y) <==> od[i]=yrrN)rr )rXrOrPZ dict_setitemr lastrrrrs  zOrderedDict.__setitem__cCs0||||j|\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]rrN)r r)rXrOZ dict_delitem link_prev link_nextrrrrs zOrderedDict.__delitem__ccs.|j}|d}||ur*|dV|d}qdS)zod.__iter__() <==> iter(od)rr)NrrXr Zcurrrrrrs  zOrderedDict.__iter__ccs.|j}|d}||ur*|dV|d}qdS)z#od.__reversed__() <==> reversed(od)rr)Nrrrrr __reversed__s  zOrderedDict.__reversed__cCsbz@|jD]}|dd=q |j}||dg|dd<|jWntyRYn0t|dS)z.od.clear() -> None. Remove all items from od.N)r  itervaluesrrrr)rXZnoder rrrrs  zOrderedDict.clearTcCs||s td|j}|r8|d}|d}||d<||d<n |d}|d}||d<||d<|d}|j|=t||}||fS)zod.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. zdictionary is emptyrrr))rrr rr)rXr r linkrrrOrPrrrrs   zOrderedDict.popitemcCst|S)zod.keys() -> list of keys in od)rrrrrkeysszOrderedDict.keyscsfddDS)z#od.values() -> list of values in odcsg|] }|qSrrrkrOrrrrqrpz&OrderedDict.values..rrrrrvaluesszOrderedDict.valuescsfddDS)z.od.items() -> list of (key, value) pairs in odcsg|]}||fqSrrrrrrrqrpz%OrderedDict.items..rrrrritemsszOrderedDict.itemscCst|S)z0od.iterkeys() -> an iterator over the keys in od)rrrrriterkeysszOrderedDict.iterkeysccs|D]}||VqdS)z2od.itervalues -> an iterator over the values in odNrrXkrrrrszOrderedDict.itervaluesccs|D]}|||fVqdS)z=od.iteritems -> an iterator over the (key, value) items in odNrrrrr iteritemsszOrderedDict.iteritemscOst|dkr tdt|fn |s,td|d}d}t|dkrL|d}t|trn|D]}||||<qZn None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v r)z8update() takes at most 2 positional arguments (%d given)z,update() takes at least 1 argument (0 given)rrrrN)rMrrrhasattrrr)rr rXotherrOrPrrrrWs(       zOrderedDict.updatecCs0||vr||}||=|S||jur,t||S)zod.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. )_OrderedDict__markerr)rXrOrrrrrr*s zOrderedDict.popNcCs||vr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odrrrrr setdefault7szOrderedDict.setdefaultcCsn|si}t|tf}||vr"dSd||<z6|sFd|jjfW||=Sd|jj|fW||=S||=0dS)zod.__repr__() <==> repr(od)rrz%s()z%s(%r)N)r _get_identrr5r)rXZ _repr_runningZcall_keyrrrr>szOrderedDict.__repr__csXfddD}t}ttD]}||dq(|rLj|f|fSj|ffS)z%Return state information for picklingcsg|]}||gqSrrrkrrrrrqNrpz*OrderedDict.__reduce__..N)varsrrrr)rXr inst_dictrrrr __reduce__Ls zOrderedDict.__reduce__cCs ||S)z!od.copy() -> a shallow copy of od)rrrrrrVszOrderedDict.copycCs|}|D] }|||<q |S)zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). r)rrrPdrOrrrrZs zOrderedDict.fromkeyscCs6t|tr*t|t|ko(||kSt||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )rrrMrr__eq__rXrrrrr'es  zOrderedDict.__eq__cCs ||k SrTrr(rrr__ne__nszOrderedDict.__ne__cCst|S)z@od.viewkeys() -> a set-like object providing a view on od's keys)rrrrrviewkeyssszOrderedDict.viewkeyscCst|S)z an object providing a view on od's values)rrrrr viewvalueswszOrderedDict.viewvaluescCst|S)zBod.viewitems() -> a set-like object providing a view on od's items)rrrrr viewitems{szOrderedDict.viewitems)T)N)N)N)"r5r6r7r[rZrrrrrrrrrrrrrrWr objectrrr rr%rrrr'r)r*r+r,rrrrrs:         r)BaseConfigurator valid_identz^[a-z_][a-z0-9_]*$cCst|}|std|dS)Nz!Not a valid Python identifier: %rT) IDENTIFIERr-rK)rrrrrr/s  r/c@s"eZdZdZddZdddZdS)ConvertingDictz A converting dictionary wrapper.cCsJt||}|j|}||urF|||<t|tttfvrF||_||_ |SrT) rr configuratorconvertrr1ConvertingListConvertingTupleparentrOrXrOrPrrrrrs   zConvertingDict.__getitem__NcCsLt|||}|j|}||urH|||<t|tttfvrH||_||_ |SrT) rrLr2r3rr1r4r5r6rOrXrOrrPrrrrrLs  zConvertingDict.get)N)r5r6r7r[rrLrrrrr1s r1cCsDt|||}|j|}||ur@t|tttfvr@||_||_ |SrT) rrr2r3rr1r4r5r6rOr8rrrrs  rc@s"eZdZdZddZdddZdS) r4zA converting list wrapper.cCsJt||}|j|}||urF|||<t|tttfvrF||_||_ |SrT) rrr2r3rr1r4r5r6rOr7rrrrs   zConvertingList.__getitem__cCs<t||}|j|}||ur8t|tttfvr8||_|SrT) rrr2r3rr1r4r5r6)rXidxrPrrrrrs   zConvertingList.popN)r9)r5r6r7r[rrrrrrr4s r4c@seZdZdZddZdS)r5zA converting tuple wrapper.cCsBt||}|j|}||ur>t|tttfvr>||_||_ |SrT) tuplerr2r3rr1r4r5r6rOr7rrrrs   zConvertingTuple.__getitem__N)r5r6r7r[rrrrrr5sr5c@seZdZdZedZedZedZedZ edZ ddd Z e e Zd d Zd d ZddZddZddZddZddZdS)r.zQ The configurator base class which defines some useful defaults. z%^(?P[a-z]+)://(?P.*)$z ^\s*(\w+)\s*z^\.\s*(\w+)\s*z^\[\s*(\w+)\s*\]\s*z^\d+$ ext_convert cfg_convert)rlZcfgcCst||_||j_dSrT)r1configr2)rXr>rrrrZs zBaseConfigurator.__init__c Cs|d}|d}z\||}|D]F}|d|7}zt||}Wq$tyh||t||}Yq$0q$|WStytdd\}}td||f}|||_ |_ |Yn0dS)zl Resolve strings to objects using standard import and attribute syntax. r8rrNzCannot resolve %r: %s) r:rimporterrr ImportErrorrvrrK __cause__ __traceback__) rXrrusedfoundrGetbvrrrresolves"       zBaseConfigurator.resolvecCs ||S)z*Default converter for the ext:// protocol.)rHrXrPrrrr< szBaseConfigurator.ext_convertcCs|}|j|}|dur&td|n||d}|j|d}|r|j|}|rn||d}nb|j|}|r|d}|j|s||}n0zt |}||}Wnt y||}Yn0|r||d}qHtd||fqH|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r) WORD_PATTERNr-rKendr>groups DOT_PATTERN INDEX_PATTERN DIGIT_PATTERNintr)rXrPrestrr&r:nrrrr=s4        zBaseConfigurator.cfg_convertcCst|ts$t|tr$t|}||_nt|tsHt|trHt|}||_nzt|tslt|trlt|}||_nVt|tr|j |}|r| }|d}|j |d}|r|d}t||}||}|S)z Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. prefixNr)rr1rr2r4rr5r; string_typesCONVERT_PATTERNr- groupdictvalue_convertersrLr)rXrPrr&rS converterrrrrr32s,    zBaseConfigurator.convertcsrd}t|s||}dd}tfddD}|fi|}|rn|D]\}}t|||qX|S)z1Configure an object with a user-supplied factory.z()r8Ncs g|]}t|r||fqSr)r/r"r>rrrqUrpz5BaseConfigurator.configure_custom..)rrrHrrsetattr)rXr>rZpropsrYrrrPrrYrconfigure_customNs   z!BaseConfigurator.configure_customcCst|trt|}|S)z0Utility function which converts lists to tuples.)rrr;rIrrras_tuple\s zBaseConfigurator.as_tupleN)r5r6r7r[r+r,rUrJrMrNrOrW staticmethod __import__r?rZrHr<r=r3r[r\rrrrr.s"     "r.)r)r)N)N)Z __future__rr]r+rvZsslr@ version_infor basestringrTrrtypesrZ file_type __builtin__builtins ConfigParser configparserZ _backportrrr r r r urllibr rrrrrrrurllib2rrrrr r!r"r#r$r%httplib xmlrpclibQueuequeuer&htmlentitydefsZ raw_input itertoolsr'filterr(r2r*r0iostrr1 urllib.parseZurllib.requestZ urllib.errorZ http.clientclientZrequest xmlrpc.clientZ html.parserZ html.entitiesZentitiesinputr3r4rKrIrRrSr-r\F_OKX_OKzipfilerrrrZBaseZipExtFilerwrrr NameErrorcollections.abcrrrrgetfilesystemencodingrrtokenizercodecsrrr,rrZhtmlr@Zcgir collectionsrrreprlibrrimportlib.utilrZimprthreadrr! dummy_thread_abcollrrrrZlogging.configr.r/Ir0r1rrr4r;r5rrrrs,       $,      ,0        2+A              [   b w