U ��.e��� @sBddlmZddlZddlZddlZz ddlZWnek rHdZYnXejddk�r~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-e�r&dd l$m.Z.ddl/Z/ddl0Z0ddl1Z2ddl3m3Z3ddl4Z4e5Z5ddl6m7Z8ddl6m9Z:da;dd�Z<�nddl=mZe>fZ e>Z ddl=m?ZddlZddlZddlZddl@mZmZmZmd?�Zod@dA�ZiYnXzddBlpmqZqWn"ek �rddBlrmqZqYnXejddC�dDk�r:e3�jsZsn ddElpmsZszddFl`mtZtWndek �r�ddGl`muZuzddHlvmwZxWn ek �r�dedJdK�ZxYnXGdLdM�dMeu�ZtYnXzddNlymzZzWnHek �rzddNl{mzZzWn ek �rdfdOdP�ZzYnXYnXzddQl`m|Z|Wn�ek �r�zddRl}m~ZWn"ek �rjddRl�m~ZYnXzddSl�m�Z�m�Z�m�Z�Wnek �r�YnXGdTdU�dUe��Z|YnXzddVl�m�Z�m�Z�Wnvek �r<e�mdWej��Z�dXdY�Z�GdZd[�d[e��Z�dgd\d]�Z�Gd^d_�d_e��Z�Gd`da�dae��Z�Gdbdc�dceQ�Z�YnXdS)h�)�absolute_importN�)�StringIO)�FileType�)�shutil)�urlparse� urlunparse�urljoin�urlsplit� urlunsplit)� urlretrieve�quote�unquote� url2pathname� pathname2url�ContentTooShortError� splittypecCst|t�r|�d�}t|�S)N�utf-8)� isinstance�unicode�encode�_quote)�s�r�>/usr/lib/python3.8/site-packages/pip/_vendor/distlib/compat.pyrs  r) �Request�urlopen�URLError� HTTPError�HTTPBasicAuthHandler�HTTPPasswordMgr� HTTPHandler�HTTPRedirectHandler� build_opener)� HTTPSHandler)� HTMLParser)�ifilter)� ifilterfalsecCs<tdkrddl}|�d�at�|�}|r4|�dd�Sd|fS)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.Nrz ^(.*)@(.*)$r�)� _userprog�re�compile�match�group)Zhostr+r-rrr� splituser4s   r/)� TextIOWrapper) rr r r/rrr r r) rr rrrr r!r"r#r$)rrr)� filterfalse)�match_hostname�CertificateErrorc@s eZdZdS)r3N)�__name__� __module__� __qualname__rrrrr3^sr3c Cs�g}|s dS|�d�}|d|dd�}}|�d�}||krNtdt|���|sb|��|��kS|dkrv|�d�n>|�d �s�|�d �r�|�t�|��n|�t�|�� d d ��|D]}|�t�|��q�t� 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)�split�countr3�repr�lower�append� startswithr+�escape�replacer,�join� IGNORECASEr-) Zdn�hostnameZ max_wildcardsZpats�partsZleftmostZ remainderZ wildcards�fragZpatrrr�_dnsname_matchbs*   � rFcCs�|s td��g}|�dd�}|D]*\}}|dkr t||�r@dS|�|�q |s�|�dd�D]6}|D],\}}|dkrdt||�r�dS|�|�qdq\t|�dkr�td |d �tt|��f��n*t|�dkr�td ||d f��ntd ��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) � ValueError�getrFr=�lenr3rA�mapr;)ZcertrCZdnsnamesZsan�key�value�subrrrr2�s2       �  �r2)�SimpleNamespacec@seZdZdZdd�ZdS)� ContainerzR A generic container for when multiple values need to be returned cKs|j�|�dS�N��__dict__�update)�self�kwargsrrr�__init__�szContainer.__init__N)r4r5r6�__doc__rWrrrrrP�srP)�whichc s"dd�}tj���r&|�|�r"�SdS|dkr>tj�dtj�}|sFdS|�tj�}tj dkr�tj |krt|� dtj �tj�dd��tj�}t �fd d �|D��r��g}q‡fd d �|D�}n�g}t �}|D]P}tj�|�}||kr�|�|�|D](} tj�|| �} || |�r�| Sq�q�dS) 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�|� SrQ)�os�path�exists�access�isdir)�fn�moderrr� _access_check�s �zwhich.._access_checkN�PATHZwin32rZPATHEXT�c3s |]}����|���VqdSrQ)r<�endswith��.0�ext��cmdrr� �szwhich..csg|] }�|�qSrrrerhrr� �szwhich..)rZr[�dirname�environrI�defpathr9�pathsep�sys�platform�curdir�insert�any�set�normcase�addrA) rir`r[raZpathext�files�seen�dirZnormdirZthefile�namerrhrrY�s8         rY)�ZipFile� __enter__)� ZipExtFilec@s$eZdZdd�Zdd�Zdd�ZdS)r~cCs|j�|j�dSrQrR)rU�baserrrrWszZipExtFile.__init__cCs|SrQr�rUrrrr}szZipExtFile.__enter__cGs |��dSrQ��close�rU�exc_inforrr�__exit__szZipExtFile.__exit__N)r4r5r6rWr}r�rrrrr~sr~c@s$eZdZdd�Zdd�Zdd�ZdS)r|cCs|SrQrr�rrrr}"szZipFile.__enter__cGs |��dSrQr�r�rrrr�%szZipFile.__exit__cOstj|f|�|�}t|�SrQ)� BaseZipFile�openr~)rU�argsrVrrrrr�)sz ZipFile.openN)r4r5r6r}r�r�rrrrr|!sr|)�python_implementationcCs0dtjkrdStjdkrdStj�d�r,dSdS)z6Return a string identifying the Python implementation.ZPyPy�javaZJythonZ IronPythonZCPython)rp�versionrZr{r>rrrrr�0s   r�)� sysconfig)�CallablecCs t|t�SrQ)rr�)�objrrr�callableDsr�r�mbcs�strict�surrogateescapecCs:t|t�r|St|t�r$|�tt�Stdt|�j��dS�Nzexpect bytes or str, not %s) r�bytes� text_typer� _fsencoding� _fserrors� TypeError�typer4��filenamerrr�fsencodeXs   �r�cCs:t|t�r|St|t�r$|�tt�Stdt|�j��dSr�) rr�r��decoder�r�r�r�r4r�rrr�fsdecodeas   �r�)�detect_encoding)�BOM_UTF8�lookupzcoding[:=]\s*([-\w.]+)cCsH|dd����dd�}|dks*|�d�r.dS|dks@|�d�rDd 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<r@r>)�orig_enc�encrrr�_get_normal_namers�r�cs�z �jj�Wntk r$d�YnXd�d}d}�fdd�}��fdd�}|�}|�t�rpd�|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$z��WStk rYdSXdS)N�)� StopIterationr)�readlinerr� read_or_stop�sz%detect_encoding..read_or_stopcs�z|�d�}Wn4tk rBd}�dk r6d�|��}t|��YnXt�|�}|sVdSt|d�}z t|�}Wn:tk r��dkr�d|}n d��|�}t|��YnX�r�|j dkr؈dkr�d}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) r��UnicodeDecodeError�format� SyntaxError� cookie_re�findallr�r�� LookupErrorr{)�line� line_string�msgZmatches�encoding�codec)� bom_foundr�rr� find_cookie�s8     �  z$detect_encoding..find_cookieTrz utf-8-sig)�__self__r{�AttributeErrorr>r�)r�r��defaultr�r��first�secondr)r�r�r�rr�}s4   &     r�)r?r))r�)�unescape)�ChainMap)�MutableMapping)�recursive_repr�...cs�fdd�}|S)zm Decorator to make a repr function return fillvalue for a recursive call csLt�����fdd�}t�d�|_t�d�|_t�d�|_t�di�|_|S)Nc sBt|�t�f}|�kr�S��|�z �|�}W5��|�X|SrQ)�id� get_identrw�discard)rUrL�result)� fillvalue� repr_running� user_functionrr�wrapper�s   z=_recursive_repr..decorating_function..wrapperr5rXr4�__annotations__)ru�getattrr5rXr4r�)r�r��r�)r�r�r�decorating_function�s   z,_recursive_repr..decorating_functionr)r�r�rr�r�_recursive_repr�s r�c@s�eZdZdZdd�Zdd�Zdd�Zd'd d �Zd d �Zd d�Z dd�Z dd�Z e �dd��Z edd��Zdd�ZeZdd�Zedd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdS)(r�a� 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)z�Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)�list�maps)rUr�rrrrWszChainMap.__init__cCs t|��dSrQ)�KeyError�rUrLrrr� __missing__szChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq|�|�SrQ)r�r�r�)rUrL�mappingrrr� __getitem__s  zChainMap.__getitem__NcCs||kr||S|SrQr�rUrLr�rrrrI%sz ChainMap.getcCstt�j|j��SrQ)rJru�unionr�r�rrr�__len__(szChainMap.__len__cCstt�j|j��SrQ)�iterrur�r�r�rrr�__iter__+szChainMap.__iter__cst�fdd�|jD��S)Nc3s|]}�|kVqdSrQr)rf�m�rLrrrj/sz(ChainMap.__contains__..�rtr�r�rr�r� __contains__.szChainMap.__contains__cCs t|j�SrQr�r�rrr�__bool__1szChainMap.__bool__cCsd�|d�tt|j���S)Nz{0.__class__.__name__}({1})rG)r�rArKr;r�r�rrr�__repr__4s�zChainMap.__repr__cGs|tj|f|���S)z?Create a ChainMap with a single dict created from the iterable.)�dict�fromkeys)�cls�iterabler�rrrr�9szChainMap.fromkeyscCs$|j|jd��f|jdd���S)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rrN)� __class__r��copyr�rrrr�>sz ChainMap.copycCs|jif|j��S)z;New ChainMap with a new dict followed by all previous maps.�r�r�r�rrr� new_childDszChainMap.new_childcCs|j|jdd��S)zNew ChainMap from maps[1:].rNr�r�rrr�parentsHszChainMap.parentscCs||jd|<dS)Nr)r�)rUrLrMrrr� __setitem__MszChainMap.__setitem__cCs8z|jd|=Wn"tk r2td�|���YnXdS)Nr�(Key not found in the first mapping: {!r})r�r�r�r�rrr� __delitem__PszChainMap.__delitem__cCs2z|jd��WStk r,td��YnXdS)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)r��popitemr�r�rrrr�VszChainMap.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].rr�N)r��popr�r�)rUrLr�rrrr�]sz ChainMap.popcCs|jd��dS)z'Clear maps[0], leaving maps[1:] intact.rN)r��clearr�rrrr�dszChainMap.clear)N)r4r5r6rXrWr�r�rIr�r�r�r�r�r�� classmethodr�r��__copy__r��propertyr�r�r�r�r�r�rrrrr�s.     r�)�cache_from_sourcecCs"|dkr d}|rd}nd}||S)NF�c�or)r[�debug_override�suffixrrrr�ns r�)� OrderedDict)r�)�KeysView� ValuesView� ItemsViewc@s�eZdZdZdd�Zejfdd�Zejfdd�Zdd �Zd d �Z d d �Z d6dd�Z dd�Z dd�Z dd�Zdd�Zdd�Zdd�Zdd�ZeZe�Zefdd �Zd7d"d#�Zd8d$d%�Zd&d'�Zd(d)�Zed9d*d+��Zd,d-�Zd.d/�Zd0d1�Zd2d3�Z d4d5�Z!d!S):r�z)Dictionary that remembers insertion ordercOsnt|�dkrtdt|���z |jWn6tk r\g|_}||dg|dd�<i|_YnX|j||�dS)z�Initialize 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)rJr��_OrderedDict__rootr��_OrderedDict__map�_OrderedDict__update)rUr��kwds�rootrrrrW�s    zOrderedDict.__init__cCsF||kr6|j}|d}|||g|d<|d<|j|<||||�dS)z!od.__setitem__(i, y) <==> od[i]=yrrN)r�r)rUrLrMZ dict_setitemr�lastrrrr��s  zOrderedDict.__setitem__cCs0|||�|j�|�\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]rrN)rr�)rUrLZ dict_delitem� link_prev� link_nextrrrr��s zOrderedDict.__delitem__ccs.|j}|d}||k r*|dV|d}qdS)zod.__iter__() <==> iter(od)rr)N�r��rUrZcurrrrrr��s  zOrderedDict.__iter__ccs.|j}|d}||k r*|dV|d}qdS)z#od.__reversed__() <==> reversed(od)rr)Nrrrrr� __reversed__�s  zOrderedDict.__reversed__cCsdz@|j��D]}|dd�=q |j}||dg|dd�<|j��Wntk rTYnXt�|�dS)z.od.clear() -> None. Remove all items from od.N)r� itervaluesr�r�r�r�)rUZnoderrrrr��s zOrderedDict.clearTcCs||s td��|j}|r8|d}|d}||d<||d<n |d}|d}||d<||d<|d}|j|=t�||�}||fS)z�od.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))r�r�rr�r�)rUrr�linkrrrLrMrrrr��s   zOrderedDict.popitemcCst|�S)zod.keys() -> list of keys in od)r�r�rrr�keys�szOrderedDict.keyscs�fdd��D�S)z#od.values() -> list of values in odcsg|] }�|�qSrr�rfrLr�rrrk�sz&OrderedDict.values..rr�rr�r�values�szOrderedDict.valuescs�fdd��D�S)z.od.items() -> list of (key, value) pairs in odcsg|]}|�|f�qSrrr r�rrrk�sz%OrderedDict.items..rr�rr�r�items�szOrderedDict.itemscCst|�S)z0od.iterkeys() -> an iterator over the keys in od)r�r�rrr�iterkeys�szOrderedDict.iterkeysccs|D]}||VqdS)z2od.itervalues -> an iterator over the values in odNr�rU�krrrr �szOrderedDict.itervaluesccs|D]}|||fVqdS)z=od.iteritems -> an iterator over the (key, value) items in odNrrrrr� iteritemsszOrderedDict.iteritemscOs�t|�dkr tdt|�f��n |s,td��|d}d}t|�dkrL|d}t|t�rn|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)rJr�rr��hasattrr r)r�rrU�otherrLrMrrrrTs( �      zOrderedDict.updatecCs0||kr||}||=|S||jkr,t|��|S)z�od.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�)rUrLr�r�rrrr�*s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odrr�rrr� setdefault7szOrderedDict.setdefaultcCsf|si}t|�t�f}||kr"dSd||<z.|sBd|jjfW�Sd|jj|��fW�S||=XdS)zod.__repr__() <==> repr(od)r�rz%s()z%s(%r)N)r�� _get_identr�r4r)rUZ _repr_runningZcall_keyrrrr�>szOrderedDict.__repr__csX�fdd��D�}t����}tt��D]}|�|d�q(|rL�j|f|fS�j|ffS)z%Return state information for picklingcsg|]}|�|g�qSrr�rfrr�rrrkNsz*OrderedDict.__reduce__..N)�varsr�r�r�r�)rUrZ inst_dictrrr�r� __reduce__Ls zOrderedDict.__reduce__cCs |�|�S)z!od.copy() -> a shallow copy of od)r�r�rrrr�VszOrderedDict.copycCs|�}|D] }|||<q |S)z�OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). r)r�r�rM�drLrrrr�Zs zOrderedDict.fromkeyscCs6t|t�r*t|�t|�ko(|��|��kSt�||�S)z�od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )rr�rJrr��__eq__�rUrrrrres  zOrderedDict.__eq__cCs ||k SrQrrrrr�__ne__nszOrderedDict.__ne__cCst|�S)[email protected]() -> a set-like object providing a view on od's keys)r�r�rrr�viewkeyssszOrderedDict.viewkeyscCst|�S)z an object providing a view on od's values)r�r�rrr� viewvalueswszOrderedDict.viewvaluescCst|�S)zBod.viewitems() -> a set-like object providing a view on od's items)r�r�rrr� viewitems{szOrderedDict.viewitems)T)N)N)N)"r4r5r6rXrWr�r�r�r�r r�r�r rrrr rrTr�objectrr�rr�rr�r�r�rrr r!r"rrrrr��s:         r�)�BaseConfigurator� valid_identz^[a-z_][a-z0-9_]*$cCst�|�}|std|��dS)Nz!Not a valid Python identifier: %rT)� IDENTIFIERr-rH)rr�rrrr%�s  r%c@s"eZdZdZdd�Zddd�ZdS)�ConvertingDictz A converting dictionary wrapper.cCsJt�||�}|j�|�}||k rF|||<t|�tttfkrF||_||_ |SrQ) r�r�� configurator�convertr�r'�ConvertingList�ConvertingTuple�parentrL�rUrLrMr�rrrr��s   �zConvertingDict.__getitem__NcCsLt�|||�}|j�|�}||k rH|||<t|�tttfkrH||_||_ |SrQ) r�rIr(r)r�r'r*r+r,rL�rUrLr�rMr�rrrrI�s  �zConvertingDict.get)N)r4r5r6rXr�rIrrrrr'�s r'cCsDt�|||�}|j�|�}||k r@t|�tttfkr@||_||_ |SrQ) r�r�r(r)r�r'r*r+r,rLr.rrrr��s  �r�c@s"eZdZdZdd�Zddd�ZdS) r*zA converting list wrapper.cCsJt�||�}|j�|�}||k rF|||<t|�tttfkrF||_||_ |SrQ) r�r�r(r)r�r'r*r+r,rLr-rrrr��s   �zConvertingList.__getitem__�����cCs<t�||�}|j�|�}||k r8t|�tttfkr8||_|SrQ) r�r�r(r)r�r'r*r+r,)rU�idxrMr�rrrr��s   �zConvertingList.popN)r/)r4r5r6rXr�r�rrrrr*�s r*c@seZdZdZdd�ZdS)r+zA converting tuple wrapper.cCsBt�||�}|j�|�}||k r>t|�tttfkr>||_||_ |SrQ) �tupler�r(r)r�r'r*r+r,rLr-rrrr��s   �zConvertingTuple.__getitem__N)r4r5r6rXr�rrrrr+�sr+c@s�eZdZdZe�d�Ze�d�Ze�d�Ze�d�Z e�d�Z ddd �Z e e �Zd d �Zd d �Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)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)rgZcfgcCst|�|_||j_dSrQ)r'�configr()rUr4rrrrW�s zBaseConfigurator.__init__c Cs�|�d�}|�d�}z^|�|�}|D]H}|d|7}zt||�}Wq$tk rj|�|�t||�}Yq$Xq$|WStk r�t��dd�\}}td||f�}|||_ |_ |�YnXdS)zl Resolve strings to objects using standard import and attribute syntax. r7rrNzCannot resolve %r: %s) r9r��importerr�r�� ImportErrorrpr�rH� __cause__� __traceback__) rUrr{Zused�foundrE�e�tb�vrrr�resolve�s"     zBaseConfigurator.resolvecCs |�|�S)z*Default converter for the ext:// protocol.)r=�rUrMrrrr2 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||f��qH|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r) � WORD_PATTERNr-rH�endr4�groups� DOT_PATTERN� INDEX_PATTERN� DIGIT_PATTERN�intr�)rUrM�restr�rr0�nrrrr3s4       �zBaseConfigurator.cfg_convertcCs�t|t�s$t|t�r$t|�}||_n�t|t�sHt|t�rHt|�}||_nzt|t�slt|t�rlt|�}||_nVt|t�r�|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'r�r(r*r�r+r1� string_types�CONVERT_PATTERNr-� groupdict�value_convertersrIr�)rUrMr�rrHZ converterr�rrrr)2s, �   zBaseConfigurator.convertcsn��d�}t|�s|�|�}��dd�}t�fdd��D��}|f|�}|rj|��D]\}}t|||�qT|S)z1Configure an object with a user-supplied factory.z()r7Ncs g|]}t|�r|�|f�qSr)r%r�r4rrrkUsz5BaseConfigurator.configure_custom..)r�r�r=r�r�setattr)rUr4r�ZpropsrVr�r{rMrrMr�configure_customNs    z!BaseConfigurator.configure_customcCst|t�rt|�}|S)z0Utility function which converts lists to tuples.)rr�r1r>rrr�as_tuple\s zBaseConfigurator.as_tupleN)r4r5r6rXr+r,rJr?rBrCrDrL� staticmethod� __import__r5rWr=r2r3r)rOrPrrrrr$�s"     �"r$)r)r�)N)N)�Z __future__rrZr+rpZsslr6� version_inforZ basestringrIrr��typesrZ file_typeZ __builtin__�builtinsZ ConfigParserZ configparserZ _backportrrr r r r Zurllibr rrrrrrrZurllib2rrrrr r!r"r#r$r%ZhttplibZ xmlrpclibZQueueZqueuer&ZhtmlentitydefsZ raw_input� itertoolsr'�filterr(r1r*r/�io�strr0Z urllib.parseZurllib.requestZ urllib.errorZ http.clientZclientZrequestZ xmlrpc.clientZ html.parserZ html.entitiesZentities�inputr2r3rHrFrOrPr#rY�F_OK�X_OKZzipfiler|r�rr~ZBaseZipExtFilerqr�r�r�� NameError� collectionsr�r�r�r��getfilesystemencodingr�r��tokenizer��codecsr�r�r,r�r�Zhtmlr?Zcgir�r�r��reprlibr�r��importlib.utilr�Zimpr��threadr�rZ dummy_threadZ_abcollr�r�r�r�Zlogging.configr$r%�Ir&r'r�r�r*r1r+rrrr�s,      $,      ,0        2+A              [   b w