U o a @sBddlmZddlZddlZddlZz ddlZWnek rHdZYnXejddkr~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@dAZiYnXzddBlpmqZqWn"ek rddBlrmqZqYnXejddCdDkr:e3jsZsn ddElpmsZszddFl`mtZtWndek rddGl`muZuzddHlvmwZxWn ek rdedJdKZxYnXGdLdMdMeuZtYnXzddNlymzZzWnHek rzddNl{mzZzWn ek rdfdOdPZzYnXYnXzddQl`m|Z|Wnek rzddRl}m~ZWn"ek rjddRlm~ZYnXzddSlmZmZmZWnek rYnXGdTdUdUeZ|YnXzddVlmZmZWnvek r<emdWejZdXdYZGdZd[d[eZdgd\d]ZGd^d_d_eZGd`dadaeZGdbdcdceQZYnXdS)h)absolute_importN)StringIO)FileType)shutil)urlparse urlunparseurljoinurlsplit urlunsplit) urlretrievequoteunquote url2pathname pathname2urlContentTooShortError splittypecCst|tr|d}t|S)Nutf-8) isinstanceunicodeencode_quote)sr[C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_vendor\distlib\compat.pyrs  r) RequesturlopenURLError HTTPErrorHTTPBasicAuthHandlerHTTPPasswordMgr HTTPHandlerHTTPRedirectHandler build_opener) HTTPSHandler) HTMLParser)ifilter) ifilterfalsecCs<tdkrddl}|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-) dnhostnameZ max_wildcardsZpatspartsZleftmost remainder wildcardsfragpatrrr_dnsname_matchbs*    rKcCs|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 commonNamerz&hostname %r doesn't match either of %s, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrKr>lenr4rBmapr<)certrEdnsnamessankeyvaluesubrrrr3s2         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__rcrrrrr\sr\)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| Sr])ospathexistsaccessisdir)fnmoderrr _access_checks zwhich.._access_checkNPATHwin32rPATHEXTc3s |]}|VqdSr])r=endswith.0extcmdrr szwhich..csg|] }|qSrrrsrvrr szwhich..)rfrgdirnameenvironrRdefpathr:pathsepsysplatformcurdirinsertanysetnormcaseaddrB) rwrlrgrmpathextfilesseendirnormdirthefilenamerrvrres8         re)ZipFile __enter__) ZipExtFilec@s$eZdZddZddZddZdS)rcCs|j|jdSr]r^)rabaserrrrcszZipExtFile.__init__cCs|Sr]rrarrrrszZipExtFile.__enter__cGs |dSr]closeraexc_inforrr__exit__szZipExtFile.__exit__N)r5r6r7rcrrrrrrrsrc@s$eZdZddZddZddZdS)rcCs|Sr]rrrrrr"szZipFile.__enter__cGs |dSr]rrrrrr%szZipFile.__exit__cOstj|f||}t|Sr]) BaseZipFileopenr)raargsrbrrrrr)sz ZipFile.openN)r5r6r7rrrrrrrr!sr)python_implementationcCs0dtjkrdStjdkrdStjdr,dSdS)z6Return a string identifying the Python implementation.PyPyjavaJython IronPythonCPython)r~versionrfrr?rrrrr0s   r) sysconfig)CallablecCs t|tSr])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|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)r=rAr?)orig_encencrrr_get_normal_namersrcsz 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_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 sBt|tf}|krS|z |}W5|X|Sr])id get_identrdiscard)rarXresult) fillvalue repr_running user_functionrrwrappers   z=_recursive_repr..decorating_function..wrapperr6rdr5__annotations__)rgetattrr6rdr5r)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)rarrrrrcszChainMap.__init__cCs t|dSr])KeyErrorrarXrrr __missing__szChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq||Sr])rrr)rarXmappingrrr __getitem__s  zChainMap.__getitem__NcCs||kr||S|Sr]rrarXrrrrrR%sz ChainMap.getcCsttj|jSr])rSrunionrrrrr__len__(szChainMap.__len__cCsttj|jSr])iterrrrrrrr__iter__+szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdSr]r)rtmrXrrrx/sz(ChainMap.__contains__..rrrrrr __contains__.szChainMap.__contains__cCs t|jSr]rrrrr__bool__1szChainMap.__bool__cCsd|dtt|jS)Nz{0.__class__.__name__}({1})rP)rrBrTr<rrrrr__repr__4szChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterablerrrrr9szChainMap.fromkeyscCs$|j|jdf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rrN) __class__rcopyrrrrr>sz ChainMap.copycCs|jif|jS)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)rarXrYrrr __setitem__MszChainMap.__setitem__cCs8z|jd|=Wn"tk r2td|YnXdS)Nr(Key not found in the first mapping: {!r})rrrrrrr __delitem__PszChainMap.__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)rpopitemrrrrrrVszChainMap.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)rarXrrrrr]sz ChainMap.popcCs|jddS)z'Clear maps[0], leaving maps[1:] intact.rN)rclearrrrrrdszChainMap.clear)N)r5r6r7rdrcrrrRrrrrrr classmethodrr__copy__rpropertyrrrrrrrrrrrs.     r)cache_from_sourcecCs0|dst|dkrd}|r$d}nd}||S)Nz.pyTco)rrAssertionError)rgdebug_overridesuffixrrrr nsr ) 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. rz$expected at most 1 arguments, got %dN)rSr_OrderedDict__rootr_OrderedDict__map_OrderedDict__update)rarkwdsrootrrrrcs    zOrderedDict.__init__cCsF||kr6|j}|d}|||g|d<|d<|j|<||||dS)z!od.__setitem__(i, y) <==> od[i]=yrrN)rr)rarXrYZ dict_setitemrlastrrrrs  zOrderedDict.__setitem__cCs0||||j|\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]rrN)rr)rarXZ dict_delitem link_prev link_nextrrrrs zOrderedDict.__delitem__ccs.|j}|d}||k r*|dV|d}qdS)zod.__iter__() <==> iter(od)rr)Nrrarcurrrrrrs  zOrderedDict.__iter__ccs.|j}|d}||k r*|dV|d}qdS)z#od.__reversed__() <==> reversed(od)rr)Nrrrrr __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)ranoderrrrrs 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))rrrrr)rarrlinkrrrXrYrrrrs   zOrderedDict.popitemcCst|S)zod.keys() -> list of keys in od)rrrrrkeysszOrderedDict.keyscsfddDS)z#od.values() -> list of values in odcsg|] }|qSrrrtrXrrrrysz&OrderedDict.values..rrrrrvaluesszOrderedDict.valuescsfddDS)z.od.items() -> list of (key, value) pairs in odcsg|]}||fqSrrr&rrrrysz%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 odNrrakrrrr"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 r)z8update() takes at most 2 positional arguments (%d given)z,update() takes at least 1 argument (0 given)rrrr%N)rSrrrhasattrr%r()rrraotherrXrYrrrr`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)rarXrrrrrr*s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odrrrrr setdefault7szOrderedDict.setdefaultcCsf|si}t|tf}||kr"dSd||<z.|sBd|jjfWSd|jj|fWS||=XdS)zod.__repr__() <==> repr(od)rrz%s()z%s(%r)N)r _get_identrr5r()raZ _repr_runningZcall_keyrrrr>szOrderedDict.__repr__csXfddD}t}ttD]}||dq(|rLj|f|fSj|ffS)z%Return state information for picklingcsg|]}||gqSrrrtr+rrrryNsz*OrderedDict.__reduce__..N)varsrrrr)rar( inst_dictr+rrr __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)rrrYdrXrrrrZs 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. )rrrSr(r__eq__rar.rrrr7es  zOrderedDict.__eq__cCs ||k Sr]rr8rrr__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)"r5r6r7rdrcrrrrr!rrr%r'r(r)r"r,r`robjectr/rr0rr5rr rr7r9r:r;r<rrrrrs:         r)BaseConfigurator valid_identz^[a-z_][a-z0-9_]*$cCst|}|std|dS)Nz!Not a valid Python identifier: %rT) IDENTIFIERr-rQ)rrrrrr?s  r?c@s"eZdZdZddZdddZdS)ConvertingDictz A converting dictionary wrapper.cCsJt||}|j|}||k rF|||<t|tttfkrF||_||_ |Sr]) rr configuratorconvertrrAConvertingListConvertingTupleparentrXrarXrYrrrrrs   zConvertingDict.__getitem__NcCsLt|||}|j|}||k rH|||<t|tttfkrH||_||_ |Sr]) rrRrBrCrrArDrErFrXrarXrrYrrrrrRs  zConvertingDict.get)N)r5r6r7rdrrRrrrrrAs rAcCsDt|||}|j|}||k r@t|tttfkr@||_||_ |Sr]) rrrBrCrrArDrErFrXrHrrrrs  rc@s"eZdZdZddZdddZdS) rDzA converting list wrapper.cCsJt||}|j|}||k rF|||<t|tttfkrF||_||_ |Sr]) rrrBrCrrArDrErFrXrGrrrrs   zConvertingList.__getitem__cCs<t||}|j|}||k r8t|tttfkr8||_|Sr]) rrrBrCrrArDrErF)raidxrYrrrrrs   zConvertingList.popN)rI)r5r6r7rdrrrrrrrDs rDc@seZdZdZddZdS)rEzA converting tuple wrapper.cCsBt||}|j|}||k r>t|tttfkr>||_||_ |Sr]) tuplerrBrCrrArDrErFrXrGrrrrs   zConvertingTuple.__getitem__N)r5r6r7rdrrrrrrEsrEc@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)rucfgcCst||_||j_dSr])rAconfigrB)rarOrrrrcs 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. r8rrNzCannot resolve %r: %s) r:rimporterrr ImportErrorr~rrQ __cause__ __traceback__) rarrusedfoundrIetbvrrrresolves"     zBaseConfigurator.resolvecCs ||S)z*Default converter for the ext:// protocol.)rYrarYrrrrL szBaseConfigurator.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-rQendrOgroups DOT_PATTERN INDEX_PATTERN DIGIT_PATTERNintr)rarYrestrr6rJnrrrrMs4       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)rrArrBrDrrErK string_typesCONVERT_PATTERNr- groupdictvalue_convertersrRr)rarYrr6rd converterrrrrrC2s,    zBaseConfigurator.convertcsnd}t|s||}dd}tfddD}|f|}|rj|D]\}}t|||qT|S)z1Configure an object with a user-supplied factory.z()r8Ncs g|]}t|r||fqSr)r?r2rOrrryUsz5BaseConfigurator.configure_custom..)rrrYrr(setattr)rarOr propsrbrrrYrrjrconfigure_customNs    z!BaseConfigurator.configure_customcCst|trt|}|S)z0Utility function which converts lists to tuples.)rrrKrZrrras_tuple\s zBaseConfigurator.as_tupleN)r5r6r7rdr+r,rfr[r^r_r`rh staticmethod __import__rPrcrYrLrMrCrmrnrrrrr>s"     "r>)r)r)N)N) __future__rrfr+r~sslrQ version_infor basestringrerrtypesr file_type __builtin__builtins ConfigParser configparserZ _backportrrr r r r urllibr rrrrrrrurllib2rrrrr r!r"r#r$r%httplib xmlrpclibQueuequeuer&htmlentitydefs raw_input itertoolsr'filterr(r2r*r0iostrr1 urllib.parseurllib.request urllib.error http.clientclientrequest xmlrpc.client html.parser html.entitiesentitiesinputr3r4rQrKr[r\r=reF_OKX_OKzipfilerrr-rZBaseZipExtFilerrrr NameError collectionsrrrrgetfilesystemencodingrrtokenizercodecsrrr,rrhtmlr@cgirrrreprlibrrimportlib.utilr imprthreadrr1 dummy_thread_abcollrrrrlogging.configr>r?Ir@rArrrDrKrErrrrs,      $,      ,0        2+A              [   b w