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teunquote url2pathname pathname2urlContentTooShortError splittypecCst|tr|d}t|S)Nutf-8) isinstanceunicodeencode_quote)srH/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/distlib/compat.pyr s  r ) RequesturlopenURLError HTTPErrorHTTPBasicAuthHandlerHTTPPasswordMgr HTTPHandlerHTTPRedirectHandler build_opener) HTTPSHandler) HTMLParser)ifilter) ifilterfalse) TextIOWrapper)rrrr r r r r) rr rrrrrr r!r")rrr) filterfalse)match_hostnameCertificateErrorc@s eZdZdS)r*N)__name__ __module__ __qualname__rrrrr*]sr*c 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.rr.N*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr*reprlowerappend startswithreescapereplacecompilejoin IGNORECASEmatch) dnhostname max_wildcardspatspartsleftmost remainder wildcardsfragpatrrr_dnsname_match`s*    rHcCs|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_REQUIREDsubjectAltNamerDNSNsubject commonNamer.z&hostname %r doesn't match either of %s, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrHr5lenr*r;mapr3)certr?dnsnamessankeyvaluesubrrrr)s2         r))SimpleNamespacec@seZdZdZddZdS) ContainerzR A generic container for when multiple values need to be returned cKs|j|dSN__dict__update)selfkwargsrrr__init__szContainer.__init__N)r+r,r-__doc__r`rrrrrYsrY)whichc s"dd}tjr&||r"SdS|dkr>tjdtj}|sFdS|tj}tj dkrtj |krt| dtj tjddtj}t fd d |Drg}q‡fd d |D}ng}t }|D]P}tj|}||kr|||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| SrZ)ospathexistsaccessisdir)fnmoderrr _access_checks zwhich.._access_checkNPATHwin32rPATHEXTc3s |]}|VqdSrZ)r4endswith.0extcmdrr szwhich..csg|] }|qSrrrprsrr szwhich..)rcrddirnameenvironrOdefpathr1pathsepsysplatformcurdirinsertanysetnormcaseaddr;) rtrirdrjpathextfilesseendirnormdirthefilenamerrsrrbs8        rb)ZipFile __enter__) ZipExtFilec@s$eZdZddZddZddZdS)rcCs|j|jdSrZr[)r^baserrrr`szZipExtFile.__init__cCs|SrZrr^rrrrszZipExtFile.__enter__cGs |dSrZcloser^exc_inforrr__exit__szZipExtFile.__exit__N)r+r,r-r`rrrrrrrsrc@s$eZdZddZddZddZdS)rcCs|SrZrrrrrr$szZipFile.__enter__cGs |dSrZrrrrrr'szZipFile.__exit__cOstj|f||}t|SrZ) BaseZipFileopenr)r^argsr_rrrrr+sz ZipFile.openN)r+r,r-rrrrrrrr"sr)python_implementationcCs0dtjkrdStjdkrdStjdr,dSdS)z6Return a string identifying the Python implementation.PyPyjavaJython IronPythonCPython)r{versionrcrr6rrrrr4s   r)CallablecCs t|tSrZ)rr)objrrrcallableFsrrmbcsstrictsurrogateescapecCs:t|tr|St|tr$|ttStdt|jdSNzexpect bytes or str, not %s) rbytes text_typer _fsencoding _fserrors TypeErrortyper+filenamerrrfsencodeZs   rcCs:t|tr|St|tr$|ttStdt|jdSr) rrrdecoderrrrr+rrrrfsdecodecs   r)detect_encoding)BOM_UTF8lookupzcoding[:=]\s*([-\w.]+)cCsH|dddd}|dks*|dr.dS|dks@|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)r4r9r6)orig_encencrrr_get_normal_nametsrcsz jjWntk r$dYnXdd}d}fdd}fdd}|}|trpd|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. NFrcs$zWStk rYdSXdS)N) StopIterationr)readlinerr read_or_stopsz%detect_encoding..read_or_stopcsz|d}Wn4tk rBd}dk r6d|}t|YnXt|}|sVdSt|d}z t|}Wn:tk rdkrd|}n d|}t|YnXr|j dkr؈dkrd}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_cookies>      z$detect_encoding..find_cookieTrz utf-8-sig)__self__rAttributeErrorr6r)rrdefaultrrfirstsecondr)rrrrrs4   '     r)r8)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 sBt|tf}|krS|z |}W5|X|SrZ)id get_identrdiscard)r^rUresult) fillvalue repr_running user_functionrrwrappers   z=_recursive_repr..decorating_function..wrapperr,rar+__annotations__)rgetattrr,rar+r)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)r^rrrrr`szChainMap.__init__cCs t|dSrZ)KeyErrorr^rUrrr __missing__!szChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq||SrZ)rrr)r^rUmappingrrr __getitem__$s  zChainMap.__getitem__NcCs||kr||S|SrZrr^rUrrrrrO.sz ChainMap.getcCsttj|jSrZ)rPrunionrrrrr__len__1szChainMap.__len__cCsttj|jSrZ)iterrrrrrrr__iter__5szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdSrZr)rqmrUrrru9sz(ChainMap.__contains__..rrrrrr __contains__8szChainMap.__contains__cCs t|jSrZrrrrr__bool__;szChainMap.__bool__cCsd|dtt|jS)Nz{0.__class__.__name__}({1})rM)rr;rQr3rrrrr__repr__>szChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterablerrrrrCszChainMap.fromkeyscCs$|j|jdf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rr.N) __class__rcopyrrrrrHsz ChainMap.copycCs|jif|jS)z;New ChainMap with a new dict followed by all previous maps.rrrrrr new_childNszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].r.NrrrrrparentsRszChainMap.parentscCs||jd|<dS)Nr)r)r^rUrVrrr __setitem__WszChainMap.__setitem__cCs8z|jd|=Wn"tk r2td|YnXdS)Nr(Key not found in the first mapping: {!r})rrrrrrr __delitem__Zs zChainMap.__delitem__cCs2z|jdWStk r,tdYnXdS)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)rpopitemrrrrrraszChainMap.popitemcGs@z|jdj|f|WStk r:td|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].rrN)rpoprr)r^rUrrrrrhs z ChainMap.popcCs|jddS)z'Clear maps[0], leaving maps[1:] intact.rN)rclearrrrrrpszChainMap.clear)N)r+r,r-rar`rrrOrrrrrr classmethodrr__copy__rpropertyrrrrrrrrrrr s.     r)cache_from_sourcecCs0|dst|dkrd}|r$d}nd}||S)Nz.pyTco)roAssertionError)rddebug_overridesuffixrrrr ysr ) 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 ordercOsnt|dkrtdt|z |jWn6tk r\g|_}||dg|dd<i|_YnX|j||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. r.z$expected at most 1 arguments, got %dN)rPr_OrderedDict__rootr_OrderedDict__map_OrderedDict__update)r^rkwdsrootrrrr`s    zOrderedDict.__init__cCsF||kr6|j}|d}|||g|d<|d<|j|<||||dS)z!od.__setitem__(i, y) <==> od[i]=yrr.N)rr)r^rUrVZ dict_setitemrlastrrrrs  zOrderedDict.__setitem__cCs0||||j|\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]r.rN)rr)r^rUZ dict_delitem link_prev link_nextrrrrs zOrderedDict.__delitem__ccs.|j}|d}||k r*|dV|d}qdS)zod.__iter__() <==> iter(od)r.rNrr^rcurrrrrrs  zOrderedDict.__iter__ccs.|j}|d}||k r*|dV|d}qdS)z#od.__reversed__() <==> reversed(od)rrNrrrrr __reversed__s  zOrderedDict.__reversed__cCsdz@|jD]}|dd=q |j}||dg|dd<|jWntk rTYnXt|dS)z.od.clear() -> None. Remove all items from od.N)r itervaluesrrrr)r^noderrrrrs 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 emptyrr.r)rrrrr)r^rrlinkrrrUrVrrrrs   zOrderedDict.popitemcCst|S)zod.keys() -> list of keys in od)rrrrrkeysszOrderedDict.keyscsfddDS)z#od.values() -> list of values in odcsg|] }|qSrrrqrUrrrrvsz&OrderedDict.values..rrrrrvaluesszOrderedDict.valuescsfddDS)z.od.items() -> list of (key, value) pairs in odcsg|]}||fqSrrr#rrrrvsz%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 odNrr^krrrr szOrderedDict.itervaluesccs|D]}|||fVqdS)z=od.iteritems -> an iterator over the (key, value) items in odNrr'rrr 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 rz8update() takes at most 2 positional arguments (%d given)z,update() takes at least 1 argument (0 given)rrr.r"N)rPrrrhasattrr"r%)rrr^otherrUrVrrrr]s(       zOrderedDict.updatecCs0||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^rUrrrrrr7s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odrrrrr setdefaultDszOrderedDict.setdefaultcCsf|si}t|tf}||kr"dSd||<z.|sBd|jjfWSd|jj|fWS||=XdS)zod.__repr__() <==> repr(od)rr.z%s()z%s(%r)N)r _get_identrr+r%)r^ _repr_runningZcall_keyrrrrKszOrderedDict.__repr__csXfddD}t}ttD]}||dq(|rLj|f|fSj|ffS)z%Return state information for picklingcsg|]}||gqSrrrqr(rrrrv\sz*OrderedDict.__reduce__..N)varsrrrr)r^r% inst_dictr(rrr __reduce__Zs zOrderedDict.__reduce__cCs ||S)z!od.copy() -> a shallow copy of od)rrrrrrdszOrderedDict.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)rrrVdrUrrrrhs 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. )rrrPr%r__eq__r^r+rrrr5ss zOrderedDict.__eq__cCs ||k SrZrr6rrr__ne__}szOrderedDict.__ne__cCst|S)z@od.viewkeys() -> a set-like object providing a view on od's keys)rrrrrviewkeysszOrderedDict.viewkeyscCst|S)z an object providing a view on od's values)rrrrr viewvaluesszOrderedDict.viewvaluescCst|S)zBod.viewitems() -> a set-like object providing a view on od's items)rrrrr viewitemsszOrderedDict.viewitems)T)N)N)N)"r+r,r-rar`rrrrrrrr"r$r%r&rr)r]robjectr,rr-rr3rrrr5r7r8r9r:rrrrrs:         r)BaseConfigurator valid_identz^[a-z_][a-z0-9_]*$cCst|}|std|dS)Nz!Not a valid Python identifier: %rT) IDENTIFIERr=rN)rrrrrr=s  r=c@s"eZdZdZddZdddZdS)ConvertingDictz A converting dictionary wrapper.cCsJt||}|j|}||k rF|||<t|tttfkrF||_||_ |SrZ) rr configuratorconvertrr?ConvertingListConvertingTupleparentrUr^rUrVrrrrrs   zConvertingDict.__getitem__NcCsLt|||}|j|}||k rH|||<t|tttfkrH||_||_ |SrZ) rrOr@rArr?rBrCrDrUr^rUrrVrrrrrOs  zConvertingDict.get)N)r+r,r-rarrOrrrrr?s r?cCsDt|||}|j|}||k r@t|tttfkr@||_||_ |SrZ) rrr@rArr?rBrCrDrUrFrrrrs  rc@s"eZdZdZddZdddZdS) rBzA converting list wrapper.cCsJt||}|j|}||k rF|||<t|tttfkrF||_||_ |SrZ) rrr@rArr?rBrCrDrUrErrrrs   zConvertingList.__getitem__cCs<t||}|j|}||k r8t|tttfkr8||_|SrZ) rrr@rArr?rBrCrD)r^idxrVrrrrrs   zConvertingList.popN)rG)r+r,r-rarrrrrrrBs rBc@seZdZdZddZdS)rCzA converting tuple wrapper.cCsBt||}|j|}||k r>t|tttfkr>||_||_ |SrZ) tuplerr@rArr?rBrCrDrUrErrrrs   zConvertingTuple.__getitem__N)r+r,r-rarrrrrrCsrCc@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)rrcfgcCst||_||j_dSrZ)r?configr@)r^rMrrrr`s zBaseConfigurator.__init__c Cs|d}|d}z^||}|D]H}|d|7}zt||}Wq$tk rj||t||}Yq$Xq$|WStk rtdd\}}td||f}|||_ |_ |YnXdS)zl Resolve strings to objects using standard import and attribute syntax. r/rr.NzCannot resolve %r: %s) r1rimporterrr ImportErrorr{rrN __cause__ __traceback__) r^rrusedfoundrFetbvrrrresolves"     zBaseConfigurator.resolvecCs ||S)z*Default converter for the ext:// protocol.)rWr^rVrrrrJszBaseConfigurator.ext_convertcCs|}|j|}|dkr&td|n||d}|j|d}|r|j|}|rn||d}nd|j|}|r|d}|j|s||}n2zt |}||}Wnt k r||}YnX|r||d}qHtd||fqH|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r) WORD_PATTERNr=rNendrMgroups DOT_PATTERN INDEX_PATTERN DIGIT_PATTERNintr)r^rVrestrr4rHnrrrrK s8       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)rr?rr@rBrrCrI string_typesCONVERT_PATTERNr= groupdictvalue_convertersrOr)r^rVrr4rb converterrrrrrACs4     zBaseConfigurator.convertcsnd}t|s||}dd}tfddD}|f|}|rj|D]\}}t|||qT|S)z1Configure an object with a user-supplied factory.z()r/Ncs g|]}t|r||fqSr)r=r0rMrrrvgsz5BaseConfigurator.configure_custom..)rrrWrr%setattr)r^rMr propsr_rrrVrrhrconfigure_custom`s    z!BaseConfigurator.configure_customcCst|trt|}|S)z0Utility function which converts lists to tuples.)rrrIrXrrras_tuplens zBaseConfigurator.as_tupleN)r+r,r-rar7r:rdrYr\r]r^rf staticmethod __import__rNr`rWrJrKrArkrlrrrrr<s"     #r<)r.)r)N)N) __future__rrcr7shutilr{sslrO version_infor basestringrcrrtypesr file_type __builtin__builtins ConfigParser configparserrrrr r urllibr r rr rrrrurllib2rrrrrrr r!r"r#httplib xmlrpclibQueuequeuer$htmlentitydefs raw_input itertoolsr%filterr&r(iostrr' urllib.parseurllib.request urllib.error http.clientclientrequest xmlrpc.client html.parser html.entitiesentitiesinputr)r*rNrHrXrYr;rbF_OKX_OKzipfilerrr*rZBaseZipExtFiler|r sysconfigr NameErrorcollections.abcrrrrgetfilesystemencodingrrtokenizercodecsrrr:rrhtmlr8cgir collectionsrrreprlibrrimportlib.utilr rthreadrr. dummy_thread_abcollrrrrlogging.configr<r=Ir>r?rrrBrIrCrrrrs     $,     (0        1+ B            ^   h |