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Zd[d[eZdd\d]ZGd^d_d_eZGd`dadaeZGdbdcdceQZYnXdS)e)absolute_importN)StringIO)FileType)shutil)urlparse urlunparseurljoinurlsplit urlunsplit) urlretrievequoteunquote url2pathname pathname2urlContentTooShortError splittypecCs(t|tr|jd}t|S)Nzutf-8) isinstanceunicodeencode_quote)sr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/compat.pyrsr) RequesturlopenURLError HTTPErrorHTTPBasicAuthHandlerHTTPPasswordMgr HTTPHandlerHTTPRedirectHandler build_opener) HTTPSHandler) HTMLParser)ifilter) ifilterfalsecCsVtdkr'ddl}|jdatj|}|rL|jddSd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.Nrz ^(.*)@(.*)$r) _userprogrecompilematchgroup)hostr*r,rrr splituser4s  r/) TextIOWrapper) rr r r/rrr r r) rr rrrrr r!r"r#)rrr) filterfalse)match_hostnameCertificateErrorc@seZdZdS)r3N)__name__ __module__ __qualname__rrrrr3^s r3c CsVg}|sdS|jd}|d|dd}}|jd}||krktdt||s|j|jkS|dkr|jdnY|jd s|jd r|jtj|n"|jtj|j d d x$|D]}|jtj|qWtj d d j |dtj } | j |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)splitcountr3reprlowerappend startswithr*escapereplacer+join IGNORECASEr,) dnhostname max_wildcardspatspartsleftmost remainder wildcardsfragpatrrr_dnsname_matchbs(  " &rMcCsO|stdg}|jdf}x@|D]8\}}|dkr1t||r\dS|j|q1W|sx]|jdfD]I}x@|D]8\}}|dkrt||rdS|j|qWqWt|dkrtd|d jtt|fn;t|dkr?td ||d fn td 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_REQUIREDsubjectAltNameDNSNsubject commonNamerz&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrMr=lenr3rAmapr;)certrDdnsnamessankeyvaluesubrrrr2s.   %r2)SimpleNamespacec@s"eZdZdZddZdS) ContainerzR A generic container for when multiple values need to be returned cKs|jj|dS)N)__dict__update)selfkwargsrrr__init__szContainer.__init__N)r4r5r6__doc__rbrrrrr]s r])whichc sdd}tjjr5||r1SdS|dkrYtjjdtj}|scdS|jtj}tj dkrtj |kr|j dtj tjjddjtj}t fd d |Drg}qfd d |D}n g}t }xr|D]j}tjj|}||kr'|j|x6|D].} tjj|| } || |r_| Sq_Wq'WdS) 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. cSs5tjj|o4tj||o4tjj| S)N)ospathexistsaccessisdir)fnmoderrr _access_checks$zwhich.._access_checkNPATHwin32rPATHEXTc3s*|] }jj|jVqdS)N)r<endswith).0ext)cmdrr szwhich..csg|]}|qSrr)rrrs)rtrr s zwhich..)rerfdirnameenvironrSdefpathr9pathsepsysplatformcurdirinsertanysetnormcaseaddrA) rtrkrfrlpathextfilesseendirnormdirthefilenamer)rtrrds8  !        rd)ZipFile __enter__) ZipExtFilec@s4eZdZddZddZddZdS)rcCs|jj|jdS)N)r^r_)r`baserrrrbszZipExtFile.__init__cCs|S)Nr)r`rrrrszZipExtFile.__enter__cGs|jdS)N)close)r`exc_inforrr__exit__szZipExtFile.__exit__N)r4r5r6rbrrrrrrrs   rc@s4eZdZddZddZddZdS)rcCs|S)Nr)r`rrrr"szZipFile.__enter__cGs|jdS)N)r)r`rrrrr%szZipFile.__exit__cOstj|||}t|S)N) BaseZipFileopenr)r`argsrarrrrr)sz ZipFile.openN)r4r5r6rrrrrrrr!s   r)python_implementationcCs@dtjkrdStjdkr&dStjjdr<dSdS)z6Return a string identifying the Python implementation.PyPyjavaJython IronPythonCPython)r{versionrerr>rrrrr0sr) sysconfig)CallablecCs t|tS)N)rr)objrrrcallableDsrzutf-8mbcsstrictsurrogateescapecCsOt|tr|St|tr2|jttStdt|jdS)Nzexpect bytes or str, not %s) rbytes text_typer _fsencoding _fserrors TypeErrortyper4)filenamerrrfsencodeXs rcCsOt|tr|St|tr2|jttStdt|jdS)Nzexpect bytes or str, not %s) rrrdecoderrrrr4)rrrrfsdecodeas r)detect_encoding)BOM_UTF8lookupzcoding[:=]\s*([-\w.]+)cCsd|ddjjdd}|dks=|jdrAdS|d ks\|jdr`dS|S)z(Imitates get_normal_name in tokenizer.c.N _-zutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)r<r@r>)orig_encencrrr_get_normal_namers" rc syjjWntk r*dYnXdd}d}fdd}fdd}|}|jtrd|d d}d }|s|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. NFzutf-8c s(y SWntk r#dSYnXdS)N) StopIterationr)readlinerr read_or_stops  z%detect_encoding..read_or_stopcs0y|jd}WnBtk rWd}dk rGdj|}t|YnXtj|}|sqdSt|d}yt|}WnItk rdkrd|}ndj|}t|YnXr,|j dkr"dkrd}ndj}t||d 7}|S) Nzutf-8z'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_cookies6           z$detect_encoding..find_cookieTrz utf-8-sig)__self__rAttributeErrorr>r)rrdefaultrrfirstsecondr)rrrrr}s4  &       r)r?r()unescape)ChainMap)MutableMapping)recursive_reprz...csfdd}|S)zm Decorator to make a repr function return fillvalue for a recursive call csptfdd}td|_td|_td|_tdi|_|S)Nc sWt|tf}|kr%Sj|z|}Wdj|X|S)N)id get_identrdiscard)r`rYresult) fillvalue repr_running user_functionrrwrappers  z=_recursive_repr..decorating_function..wrapperr5rcr4__annotations__)rgetattrr5rcr4r)rr)r)rrrdecorating_functions  z,_recursive_repr..decorating_functionr)rrr)rr_recursive_reprsrc@s eZdZdZddZddZddZdd 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|pig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)listmaps)r`rrrrrbszChainMap.__init__cCst|dS)N)KeyError)r`rYrrr __missing__szChainMap.__missing__c CsBx2|jD]'}y ||SWq tk r0Yq Xq W|j|S)N)rrr)r`rYmappingrrr __getitem__s    zChainMap.__getitem__NcCs||kr||S|S)Nr)r`rYrrrrrS%sz ChainMap.getcCsttj|jS)N)rTrunionr)r`rrr__len__(szChainMap.__len__cCsttj|jS)N)iterrrr)r`rrr__iter__+szChainMap.__iter__cs tfdd|jDS)Nc3s|]}|kVqdS)Nr)rrm)rYrrru/sz(ChainMap.__contains__..)rr)r`rYr)rYr __contains__.szChainMap.__contains__cCs t|jS)N)rr)r`rrr__bool__1szChainMap.__bool__cCs%dj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rrArUr;r)r`rrr__repr__4szChainMap.__repr__cGs|tj||S)z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterablerrrrr9szChainMap.fromkeyscCs*|j|jdj|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rrN) __class__rcopy)r`rrrr>sz ChainMap.copycCs|ji|jS)z;New ChainMap with a new dict followed by all previous maps.)rr)r`rrr new_childDszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rN)rr)r`rrrparentsHszChainMap.parentscCs||jd| od[i]=yrrN)r r )r`rYrZZ dict_setitemrlastrrrrs    &zOrderedDict.__setitem__cCs@||||jj|\}}}||d<||d del od[y]rrN)r r)r`rYZ dict_delitem link_prev link_nextrrrrs  zOrderedDict.__delitem__ccs=|j}|d}x#||k r8|dV|d}qWdS)zod.__iter__() <==> iter(od)rr(N)r )r`rcurrrrrrs    zOrderedDict.__iter__ccs=|j}|d}x#||k r8|dV|d}qWdS)z#od.__reversed__() <==> reversed(od)rr(N)r )r`rrrrr __reversed__s    zOrderedDict.__reversed__c CsyZx$|jjD]}|dd=qW|j}||dg|dd<|jjWntk rnYnXtj|dS)z.od.clear() -> None. Remove all items from od.N)r  itervaluesr rrr)r`noderrrrrs  zOrderedDict.clearTcCs|std|j}|rL|d}|d}||d<||d (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()rr r rr)r`rrlinkrrrYrZrrrrs             zOrderedDict.popitemcCs t|S)zod.keys() -> list of keys in od)r)r`rrrkeysszOrderedDict.keyscsfddDS)z#od.values() -> list of values in odcsg|]}|qSrr)rrrY)r`rrrvs z&OrderedDict.values..r)r`r)r`rvaluesszOrderedDict.valuescsfddDS)z.od.items() -> list of (key, value) pairs in odcs g|]}||fqSrr)rrrY)r`rrrvs z%OrderedDict.items..r)r`r)r`ritemsszOrderedDict.itemscCs t|S)z0od.iterkeys() -> an iterator over the keys in od)r)r`rrriterkeysszOrderedDict.iterkeysccsx|D]}||VqWdS)z2od.itervalues -> an iterator over the values in odNr)r`krrrrs zOrderedDict.itervaluesccs$x|D]}|||fVqWdS)z=od.iteritems -> an iterator over the (key, value) items in odNr)r`rrrr iteritemss zOrderedDict.iteritemscOs t|dkr.tdt|fn|s@td|d}f}t|dkrl|d}t|trxw|D]}|||| 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)rrrN)rTrrrhasattrrr)rrr`otherrYrZrrrr_s&     zOrderedDict.updatecCs@||kr!||}||=|S||jkr<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)r`rYrrrrrr*s   zOrderedDict.popNcCs"||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)r`rYrrrr setdefault7s  zOrderedDict.setdefaultc Cs|s i}t|tf}||kr1dSd|| repr(od)z...rz%s()z%s(%r)N)r _get_identrr4r)r`Z _repr_runningZcall_keyrrrr>s  zOrderedDict.__repr__cs~fddD}tj}x'ttD]}|j|dq;W|rnj|f|fSj|ffS)z%Return state information for picklingcs g|]}||gqSrr)rrr)r`rrrvNs z*OrderedDict.__reduce__..N)varsrrrr)r`r inst_dictrr)r`r __reduce__LszOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)r)r`rrrrVszOrderedDict.copycCs(|}x|D]}||| New ordered dictionary with keys from S and values equal to v (which defaults to None). r)rrrZdrYrrrrZs  zOrderedDict.fromkeyscCsMt|tr=t|t|ko<|j|jkStj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )rrrTrr__eq__)r`r rrrr(es.zOrderedDict.__eq__cCs ||k S)Nr)r`r rrr__ne__nszOrderedDict.__ne__cCs t|S)z@od.viewkeys() -> a set-like object providing a view on od's keys)r )r`rrrviewkeyssszOrderedDict.viewkeyscCs t|S)z an object providing a view on od's values)r )r`rrr viewvalueswszOrderedDict.viewvaluescCs t|S)zBod.viewitems() -> a set-like object providing a view on od's items)r )r`rrr viewitems{szOrderedDict.viewitems)"r4r5r6rcrbrrrrrrrrrrrrrr_robjectr!rr"rr&rrrr(r)r*r+r,rrrrrs:                   r)BaseConfigurator valid_identz^[a-z_][a-z0-9_]*$cCs)tj|}|s%td|dS)Nz!Not a valid Python identifier: %rT) IDENTIFIERr,rR)rrrrrr/sr/c@s1eZdZdZddZdddZdS)ConvertingDictz A converting dictionary wrapper.cCsktj||}|jj|}||k rg|||[a-z]+)://(?P.*)$z ^\s*(\w+)\s*z^\.\s*(\w+)\s*z^\[\s*(\w+)\s*\]\s*z^\d+$rs ext_convertcfg cfg_convertcCst||_||j_dS)N)r1configr2)r`r=rrrrbszBaseConfigurator.__init__c Cs|jd}|jd}yz|j|}x`|D]X}|d|7}yt||}Wq7tk r|j|t||}Yq7Xq7W|SWn]tk rtjdd\}}td||f}|||_ |_ |YnXdS)zl Resolve strings to objects using standard import and attribute syntax. r7rrNzCannot resolve %r: %s) r9rimporterrr ImportErrorr{rrR __cause__ __traceback__) r`rrusedfoundrKetbvrrrresolves"    zBaseConfigurator.resolvecCs |j|S)z*Default converter for the ext:// protocol.)rG)r`rZrrrr: szBaseConfigurator.ext_convertc CsY|}|jj|}|dkr7td|n||jd}|j|jd}x|rT|jj|}|r||jd}n|jj|}|r|jd}|jj|s||}n9yt |}||}Wnt k r||}YnX|r;||jd}qgtd||fqgW|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r) WORD_PATTERNr,rRendr=groups DOT_PATTERN INDEX_PATTERN DIGIT_PATTERNintr)r`rZrestrr'r7nrrrr<s2     zBaseConfigurator.cfg_convertcCs&t|t r7t|tr7t|}||_nt|t rnt|trnt|}||_nt|t rt|trt|}||_n}t|tr"|j j |}|r"|j }|d}|j 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)rr1rr2r4rr5r9 string_typesCONVERT_PATTERNr, groupdictvalue_convertersrSr)r`rZrr'rQ converterrrrrr32s*          zBaseConfigurator.convertcsjd}t|s*|j|}jdd}tfddD}||}|rx*|jD]\}}t|||qzW|S)z1Configure an object with a user-supplied factory.z()r7Ncs,g|]"}t|r||fqSr)r/)rrr)r=rrrvUs z5BaseConfigurator.configure_custom..)rrrGrrsetattr)r`r=rpropsrarrrZr)r=rconfigure_customNs  z!BaseConfigurator.configure_customcCst|trt|}|S)z0Utility function which converts lists to tuples.)rrr9)r`rZrrras_tuple\s zBaseConfigurator.as_tupleN)r4r5r6rcr*r+rSrHrKrLrMrU staticmethod __import__r>rbrGr:r<r3rYrZrrrrr.s       "  r.)rr) __future__rrer*r{sslr? version_infor basestringrRrrtypesr file_type __builtin__builtins ConfigParser configparserZ _backportrrr r r r urllibr rrrrrrrurllib2rrrrrr r!r"r#r$httplib xmlrpclibQueuequeuer%htmlentitydefs raw_input itertoolsr&filterr'r1r)r/iostrr0 urllib.parseurllib.request urllib.error http.clientclientrequest xmlrpc.client html.parser html.entitiesentitiesinputr2r3rRrMr\r]r-rdF_OKX_OKzipfilerrrrZBaseZipExtFiler|rrr NameErrorcollections.abcrrrrgetfilesystemencodingrrtokenizercodecsrrr+rrhtmlr?cgir collectionsrrreprlibrrimportlib.utilrimprthreadrr# dummy_thread_abcollr r r rlogging.configr.r/Ir0r1rrr4r9r5rrrrs*        (4  @         @F  2+  !A                  [   b