AlkantarClanX12

Your IP : 18.217.246.148


Current Path : /opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/compat.cpython-37.pyc

B

:��a+��@s�ddlmZddlZddlZddlZyddlZWnek
rHdZYnXejddk�rfddlmZe	fZ
eZddl
mZddlZddlZddlmZmZmZmZmZddlmZmZmZmZmZm Z m!Z!dd	�Zddl"Z"dd
l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+e�rddl"m,Z,ddl-Z-ddl.Z.ddl/Z0ddl1m1Z1ddl2Z2e3Z3dd
l4m5Z6ddl4m7Z8�nddl9mZe:fZ
e:Zddl9m;ZddlZddlZddl<Z<ddl=mZmZmZmZmZmZmZm!Z!ddl>m$Z$mZm#Z#mZmZm'Z'm(Z(m)Z)m*Z*m+Z+e�r
ddl>m,Z,ddl?m&Z&m%Z%m Z ddl@mAZ-ddl>mBZ"ddlCmAZ.ddl0Z0ddlDm1Z1ddlEmFZ2eGZ3ddl4m8Z8e6Z6yddlmHZHmIZIWn8ek
�r�Gdd�deJ�ZId`dd�ZKdd�ZHYnXyddl
mLZMWn&ek
�r�Gdd�deN�ZMYnXyddl<mOZOWn,ek
�r8ejPejQBdfd d!�ZOYnXdd"lRmSZTeUeTd#��rXeTZSn,dd$lRmVZWGd%d&�d&eW�ZVGd'd(�d(eT�ZSydd)lXmYZYWnek
�r�d*d+�ZYYnXddl<Z<ddlZZZye[Z[Wn*e\k
�r�dd,l]m^Z^d-d.�Z[YnXyej_Z_ej`Z`WnHeak
�rPe�b��p&d/Zcecd0k�r8d1Zdnd2Zdd3d4�Z_d5d6�Z`YnXydd7lemfZfWnHek
�r�dd8lgmhZhmiZiddlZe�jd9�Zkd:d;�Zld<d=�ZfYnXydd>lmmnZnWn"ek
�r�dd>lomnZnYnXejdd?�d@k�r�e1�jpZpnddAlmmpZpyddBlqmrZrWndek
�r~ddClqmsZsyddDltmuZvWn ek
�rhdadFdG�ZvYnXGdHdI�dIes�ZrYnXyddJlwmxZxWn ek
�r�dbdKdL�ZxYnXyddMlqmyZyWn�ek
�rLyddNlzm{Z|Wn"ek
�rddNl}m{Z|YnXyddOl~mZm�Z�m�Z�Wnek
�r6YnXGdPdQ�dQe��ZyYnXyddRl�m�Z�m�Z�Wnvek
�r�e�jdSej��Z�dTdU�Z�GdVdW�dWe��Z�dcdXdY�Z�GdZd[�d[e��Z�Gd\d]�d]e��Z�Gd^d_�d_eN�Z�YnXdS)d�)�absolute_importN�)�StringIO)�FileType)�urlparse�
urlunparse�urljoin�urlsplit�
urlunsplit)�urlretrieve�quote�unquote�url2pathname�pathname2url�ContentTooShortError�	splittypecCst|t�r|�d�}t|�S)Nzutf-8)�
isinstance�unicode�encode�_quote)�s�r�?/opt/alt/python37/lib/python3.7/site-packages/distlib/compat.pyrs

r)	�Request�urlopen�URLError�	HTTPError�HTTPBasicAuthHandler�HTTPPasswordMgr�HTTPHandler�HTTPRedirectHandler�build_opener)�HTTPSHandler)�
HTMLParser)�ifilter)�ifilterfalse)�
TextIOWrapper)rrrrr
r	r
r)
rrrrrrrrr r!)rrr)�filterfalse)�match_hostname�CertificateErrorc@seZdZdS)r)N)�__name__�
__module__�__qualname__rrrrr)_sr)�c
Cs�g}|sdS|�d�}|d|dd�}}|�d�}||krNtdt|���|sb|��|��kS|dkrv|�d�n>|�d	�s�|�d	�r�|�t�|��n|�t�|��	d
d��x|D]}|�t�|��q�Wt�
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)�split�countr)�repr�lower�append�
startswith�re�escape�replace�compile�join�
IGNORECASE�match)
Zdn�hostnameZ
max_wildcardsZpats�partsZleftmost�	remainderZ	wildcards�frag�patrrr�_dnsname_matchcs(


rBcCs�|std��g}|�dd�}x0|D](\}}|dkr"t||�r@dS|�|�q"W|s�xF|�dd�D]6}x0|D](\}}|dkrjt||�r�dS|�|�qjWq`Wt|�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
commonNamer-z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)	�
ValueError�getrBr4�lenr)r:�mapr2)Zcertr=ZdnsnamesZsan�key�value�subrrrr(�s.

r()�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)r*r+r,�__doc__rPrrrrrK�srK)�whichcs"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‡fdd�|D�}n�g}t
�}xT|D]L}tj�|�}||kr�|�|�x(|D] }	tj�||	�}
||
|�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.

        cSs&tj�|�o$t�||�o$tj�|�S)N)�os�path�exists�access�isdir)�fn�moderrr�
_access_check�szwhich.<locals>._access_checkN�PATH�win32r�PATHEXT�c3s |]}����|���VqdS)N)r3�endswith)�.0�ext)�cmdrr�	<genexpr>�szwhich.<locals>.<genexpr>csg|]}�|�qSrr)r`ra)rbrr�
<listcomp>�szwhich.<locals>.<listcomp>)rSrT�dirname�environrD�defpathr0�pathsep�sys�platform�curdir�insert�any�set�normcase�addr:)rbrYrTrZ�pathext�files�seen�dir�normdir�thefile�namer)rbrrR�s8







rR)�ZipFile�	__enter__)�
ZipExtFilec@s$eZdZdd�Zdd�Zdd�ZdS)rzcCs|j�|j�dS)N)rLrM)rN�baserrrrPszZipExtFile.__init__cCs|S)Nr)rNrrrryszZipExtFile.__enter__cGs|��dS)N)�close)rN�exc_inforrr�__exit__szZipExtFile.__exit__N)r*r+r,rPryr~rrrrrzsrzc@s$eZdZdd�Zdd�Zdd�ZdS)rxcCs|S)Nr)rNrrrry#szZipFile.__enter__cGs|��dS)N)r|)rNr}rrrr~&szZipFile.__exit__cOstj|f|�|�}t|�S)N)�BaseZipFile�openrz)rN�argsrOr{rrrr�*szZipFile.openN)r*r+r,ryr~r�rrrrrx"srx)�python_implementationcCs0dtjkrdStjdkrdStj�d�r,dSdS)z6Return a string identifying the Python implementation.ZPyPy�javaZJythonZ
IronPythonZCPython)ri�versionrSrwr5rrrrr�1s

r�)�CallablecCs
t|t�S)N)rr�)�objrrr�callableCsr�zutf-8�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�typer*)�filenamerrr�fsencodeWs

r�cCs:t|t�r|St|t�r$|�tt�Stdt|�j��dS)Nzexpect bytes or str, not %s)	rr�r��decoder�r�r�r�r*)r�rrr�fsdecode`s

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��_�-zutf-8zutf-8-)zlatin-1z
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-z
iso-8859-1)r3r8r5)�orig_enc�encrrr�_get_normal_nameqs
r�cs�y�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.
        NFzutf-8cs y��Stk
rdSXdS)N�)�
StopIterationr)�readlinerr�read_or_stop�sz%detect_encoding.<locals>.read_or_stopcs�y|�d�}Wn4tk
rBd}�dk	r6d�|��}t|��YnXt�|�}|sVdSt|d�}yt|�}Wn:tk
r��dkr�d|}nd��|�}t|��YnX�r�|j	dkr؈dkr�d}n
d���}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)
r��UnicodeDecodeError�format�SyntaxError�	cookie_re�findallr�r��LookupErrorrw)�line�line_string�msgZmatches�encoding�codec)�	bom_foundr�rr�find_cookie�s6



z$detect_encoding.<locals>.find_cookieTrz	utf-8-sig)�__self__rw�AttributeErrorr5r�)r�r��defaultr�r��first�secondr)r�r�r�rr�|s4
&


r�)r7�)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�|�}Wd��|�X|S)N)�id�	get_identrp�discard)rNrG�result)�	fillvalue�repr_running�
user_functionrr�wrapper�s
z=_recursive_repr.<locals>.decorating_function.<locals>.wrapperr+rQr*�__annotations__)rn�getattrr+rQr*r�)r�r�)r�)r�r�r�decorating_function�sz,_recursive_repr.<locals>.decorating_functionr)r�r�r)r�r�_recursive_repr�sr�c@s�eZdZdZdd�Zdd�Zdd�Zd'd	d
�Zdd�Zd
d�Z	dd�Z
dd�Ze�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)rNr�rrrrPszChainMap.__init__cCst|��dS)N)�KeyError)rNrGrrr�__missing__szChainMap.__missing__c	Cs8x,|jD]"}y||Stk
r(YqXqW|�|�S)N)r�r�r�)rNrG�mappingrrr�__getitem__s
zChainMap.__getitem__NcCs||kr||S|S)Nr)rNrGr�rrrrD$szChainMap.getcCstt�j|j��S)N)rErn�unionr�)rNrrr�__len__'szChainMap.__len__cCstt�j|j��S)N)�iterrnr�r�)rNrrr�__iter__*szChainMap.__iter__cst�fdd�|jD��S)Nc3s|]}�|kVqdS)Nr)r`�m)rGrrrc.sz(ChainMap.__contains__.<locals>.<genexpr>)rmr�)rNrGr)rGr�__contains__-szChainMap.__contains__cCs
t|j�S)N)rmr�)rNrrr�__bool__0szChainMap.__bool__cCsd�|d�tt|j���S)Nz{0.__class__.__name__}({1})z, )r�r:rFr2r�)rNrrr�__repr__3szChainMap.__repr__cGs|tj|f|���S)z?Create a ChainMap with a single dict created from the iterable.)�dict�fromkeys)�cls�iterabler�rrrr�8szChainMap.fromkeyscCs$|j|jd��f|jdd���S)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]rr-N)�	__class__r��copy)rNrrrr�=sz
ChainMap.copycCs|jif|j��S)z;New ChainMap with a new dict followed by all previous maps.)r�r�)rNrrr�	new_childCszChainMap.new_childcCs|j|jdd��S)zNew ChainMap from maps[1:].r-N)r�r�)rNrrr�parentsGszChainMap.parentscCs||jd|<dS)Nr)r�)rNrGrHrrr�__setitem__LszChainMap.__setitem__cCs8y|jd|=Wn"tk
r2td�|���YnXdS)Nrz(Key not found in the first mapping: {!r})r�r�r�)rNrGrrr�__delitem__OszChainMap.__delitem__cCs0y|jd��Stk
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�)rNrrrr�UszChainMap.popitemcGs>y|jdj|f|��Stk
r8td�|���YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].rz(Key not found in the first mapping: {!r}N)r��popr�r�)rNrGr�rrrr�\szChainMap.popcCs|jd��dS)z'Clear maps[0], leaving maps[1:] intact.rN)r��clear)rNrrrr�cszChainMap.clear)N)r*r+r,rQrPr�r�rDr�r�r�r�r�r��classmethodr�r��__copy__r��propertyr�r�r�r�r�r�rrrrr�s(
r�)�cache_from_sourcecCs0|�d�st�|dkrd}|r$d}nd}||S)Nz.pyT�c�o)r_�AssertionError)rT�debug_override�suffixrrrr�jsr�)�OrderedDict)r�)�KeysView�
ValuesView�	ItemsViewc@s�eZdZdZdd�Zejfdd�Zejfdd�Zdd	�Zd
d�Z	dd
�Z
d6dd�Zdd�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|���y
|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.

            r-z$expected at most 1 arguments, got %dN)rEr��_OrderedDict__rootr��_OrderedDict__map�_OrderedDict__update)rNr��kwds�rootrrrrP�s

zOrderedDict.__init__cCsF||kr6|j}|d}|||g|d<|d<|j|<||||�dS)z!od.__setitem__(i, y) <==> od[i]=yrr-N)r�r�)rNrGrHZdict_setitemr��lastrrrr��s
 zOrderedDict.__setitem__cCs0|||�|j�|�\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]r-rN)r�r�)rNrGZdict_delitem�	link_prev�	link_nextrrrr��s
zOrderedDict.__delitem__ccs2|j}|d}x||k	r,|dV|d}qWdS)zod.__iter__() <==> iter(od)r-r�N)r�)rNr��currrrrr��s


zOrderedDict.__iter__ccs2|j}|d}x||k	r,|dV|d}qWdS)z#od.__reversed__() <==> reversed(od)rr�N)r�)rNr�r�rrr�__reversed__�s


zOrderedDict.__reversed__cCshyDx|j��D]}|dd�=qW|j}||dg|dd�<|j��Wntk
rXYnXt�|�dS)z.od.clear() -> None.  Remove all items from od.N)r��
itervaluesr�r�r�r�)rNZnoder�rrrr��szOrderedDict.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 emptyrr-r�)r�r�r�r�r�)rNr�r��linkr�r�rGrHrrrr��s 
zOrderedDict.popitemcCst|�S)zod.keys() -> list of keys in od)r�)rNrrr�keys�szOrderedDict.keyscs�fdd��D�S)z#od.values() -> list of values in odcsg|]}�|�qSrr)r`rG)rNrrrd�sz&OrderedDict.values.<locals>.<listcomp>r)rNr)rNr�values�szOrderedDict.valuescs�fdd��D�S)z.od.items() -> list of (key, value) pairs in odcsg|]}|�|f�qSrr)r`rG)rNrrrd�sz%OrderedDict.items.<locals>.<listcomp>r)rNr)rNr�items�szOrderedDict.itemscCst|�S)z0od.iterkeys() -> an iterator over the keys in od)r�)rNrrr�iterkeys�szOrderedDict.iterkeysccsx|D]}||VqWdS)z2od.itervalues -> an iterator over the values in odNr)rN�krrrr��s
zOrderedDict.itervaluesccs x|D]}|||fVqWdS)z=od.iteritems -> an iterator over the (key, value) items in odNr)rNr�rrr�	iteritems�s
zOrderedDict.iteritemscOs�t|�dkr tdt|�f��n|s,td��|d}d}t|�dkrL|d}t|t�rrx^|D]}||||<q\WnDt|d�r�x8|��D]}||||<q�Wnx|D]\}}|||<q�Wx|��D]\}}|||<q�WdS)	a�od.update(E, **F) -> 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)rrr-r�N)rEr�rr��hasattrr�r�)r�r�rN�otherrGrHrrrrMs&	


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�)rNrGr�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 odr)rNrGr�rrr�
setdefault3szOrderedDict.setdefaultcCs^|si}t|�t�f}||kr"dSd||<z&|s>d|jjfSd|jj|��fS||=XdS)zod.__repr__() <==> repr(od)z...r-z%s()z%s(%r)N)r��
_get_identr�r*r�)rNZ
_repr_runningZcall_keyrrrr�:szOrderedDict.__repr__cs\�fdd��D�}t����}xtt��D]}|�|d�q*W|rP�j|f|fS�j|ffS)z%Return state information for picklingcsg|]}|�|g�qSrr)r`r�)rNrrrdJsz*OrderedDict.__reduce__.<locals>.<listcomp>N)�varsr�r�r�r�)rNr�Z	inst_dictr�r)rNr�
__reduce__HszOrderedDict.__reduce__cCs
|�|�S)z!od.copy() -> a shallow copy of od)r�)rNrrrr�RszOrderedDict.copycCs |�}x|D]}|||<qW|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�rH�drGrrrr�Vs
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�rEr�r��__eq__)rNrrrrr	as
 zOrderedDict.__eq__cCs
||kS)Nr)rNrrrr�__ne__jszOrderedDict.__ne__cCst|�S)z@od.viewkeys() -> a set-like object providing a view on od's keys)r�)rNrrr�viewkeysoszOrderedDict.viewkeyscCst|�S)z<od.viewvalues() -> an object providing a view on od's values)r�)rNrrr�
viewvaluessszOrderedDict.viewvaluescCst|�S)zBod.viewitems() -> a set-like object providing a view on od's items)r�)rNrrr�	viewitemswszOrderedDict.viewitems)T)N)N)N)"r*r+r,rQrPr�r�r�r�r�r�r�r�r�r�r�r�rrMr��objectrr�rr�rr�r�r�r	r
rrr
rrrrr��s:
	




	r�)�BaseConfigurator�valid_identz^[a-z_][a-z0-9_]*$cCst�|�}|std|��dS)Nz!Not a valid Python identifier: %rT)�
IDENTIFIERr<rC)rr�rrrr�s
rc@s"eZdZdZdd�Zddd�ZdS)�ConvertingDictz A converting dictionary wrapper.cCsJt�||�}|j�|�}||k	rF|||<t|�tttfkrF||_||_	|S)N)
r�r��configurator�convertr�r�ConvertingList�ConvertingTuple�parentrG)rNrGrHr�rrrr��s
zConvertingDict.__getitem__NcCsLt�|||�}|j�|�}||k	rH|||<t|�tttfkrH||_||_	|S)N)
r�rDrrr�rrrrrG)rNrGr�rHr�rrrrD�s
zConvertingDict.get)N)r*r+r,rQr�rDrrrrr�srcCsDt�|||�}|j�|�}||k	r@t|�tttfkr@||_||_	|S)N)
r�r�rrr�rrrrrG)rNrGr�rHr�rrrr��s
r�c@s"eZdZdZdd�Zddd�ZdS)	rzA converting list wrapper.cCsJt�||�}|j�|�}||k	rF|||<t|�tttfkrF||_||_	|S)N)
r�r�rrr�rrrrrG)rNrGrHr�rrrr��s
zConvertingList.__getitem__���cCs<t�||�}|j�|�}||k	r8t|�tttfkr8||_|S)N)	r�r�rrr�rrrr)rN�idxrHr�rrrr��s
zConvertingList.popN)r)r*r+r,rQr�r�rrrrr�src@seZdZdZdd�ZdS)rzA converting tuple wrapper.cCsBt�||�}|j�|�}||k	r>t|�tttfkr>||_||_	|S)N)
�tupler�rrr�rrrrrG)rNrGrHr�rrrr��s
zConvertingTuple.__getitem__N)r*r+r,rQr�rrrrr�src@s�eZdZdZe�d�Ze�d�Ze�d�Ze�d�Z	e�d�Z
ddd	�Zee
�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)rzQ
        The configurator base class which defines some useful defaults.
        z%^(?P<prefix>[a-z]+)://(?P<suffix>.*)$z^\s*(\w+)\s*z^\.\s*(\w+)\s*z^\[\s*(\w+)\s*\]\s*z^\d+$�ext_convert�cfg_convert)raZcfgcCst|�|_||j_dS)N)r�configr)rNrrrrrP�s
zBaseConfigurator.__init__c		Cs�|�d�}|�d�}y`|�|�}xP|D]H}|d|7}yt||�}Wq&tk
rl|�|�t||�}Yq&Xq&W|Stk
r�t��dd�\}}td||f�}|||_	|_
|�YnXdS)zl
            Resolve strings to objects using standard import and attribute
            syntax.
            r.rr-NzCannot resolve %r: %s)r0r��importerr�r��ImportErrorrir}rC�	__cause__�
__traceback__)	rNrrw�used�foundr@�e�tb�vrrr�resolve�s"




zBaseConfigurator.resolvecCs
|�|�S)z*Default converter for the ext:// protocol.)r')rNrHrrrrszBaseConfigurator.ext_convertcCs|}|j�|�}|dkr&td|��n�||��d�}|j|��d}x�|r�|j�|�}|rp||��d}nd|j�|�}|r�|��d}|j�|�s�||}n2yt	|�}||}Wnt
k
r�||}YnX|r�||��d�}qJtd||f��qJW|S)z*Default converter for the cfg:// protocol.NzUnable to convert %rrzUnable to convert %r at %r)�WORD_PATTERNr<rC�endr�groups�DOT_PATTERN�
INDEX_PATTERN�
DIGIT_PATTERN�intr�)rNrH�restr�rr�nrrrrs2
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�)rrr�rrr�rr�string_types�CONVERT_PATTERNr<�	groupdict�value_convertersrDr�)rNrHr�rr1�	converterr�rrrr.s*



zBaseConfigurator.convertcsr��d�}t|�s|�|�}��dd�}t�fdd��D��}|f|�}|rnx |��D]\}}t|||�qVW|S)z1Configure an object with a user-supplied factory.z()r.Ncs g|]}t|�r|�|f�qSr)r)r`r�)rrrrdQsz5BaseConfigurator.configure_custom.<locals>.<listcomp>)r�r�r'r�r��setattr)rNrr��propsrOr�rwrHr)rr�configure_customJs


z!BaseConfigurator.configure_customcCst|t�rt|�}|S)z0Utility function which converts lists to tuples.)rr�r)rNrHrrr�as_tupleXs
zBaseConfigurator.as_tupleN)r*r+r,rQr6r9r3r(r+r,r-r5�staticmethod�
__import__rrPr'rrrr9r:rrrrr�s 




"r)r-)r�)N)N)�Z
__future__rrSr6riZsslr�version_inforZ
basestringr2rr��typesrZ	file_typeZ__builtin__�builtins�ConfigParser�configparserrrrr	r
Zurllibrrrr
rrrrZurllib2rrrrrrrr r!r"ZhttplibZ	xmlrpclibZQueueZqueuer#ZhtmlentitydefsZ	raw_input�	itertoolsr$�filterr%r'�io�strr&�shutilZurllib.parseZurllib.requestZurllib.errorZhttp.clientZclientZrequestZ
xmlrpc.clientZhtml.parserZ
html.entitiesZentities�inputr(r)rCrBrJrKrrR�F_OK�X_OK�zipfilerxrrrzZBaseZipExtFilerjr��	sysconfigr��	NameError�collections.abcr�r�r�r��getfilesystemencodingr�r��tokenizer��codecsr�r�r9r�r�Zhtmlr7�cgir��collectionsr�r��reprlibr�r��importlib.utilr�r��threadr�rZdummy_threadZ_abcollr�r�r�r�Zlogging.configrr�Irrr�r�rrrrrrr�<module>s
$,(0
2+A


		
[
b
w