a
    |Ä#d+¡  ã                   @   s¾  d dl mZ d dlZd dlZd dlZzd dlZW n eyF   dZY n0 ejd  dk �rdd dlmZ e	fZ
eZd dlmZ d dlZd dlZd dlmZmZmZmZmZ d dlmZmZmZmZmZm Z m!Z! dd	„ Zd dl"Z"d d
l"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ e�rd dl"m,Z, d dl-Z-d dl.Z.d dl/Z0d dl1m1Z1 d dl2Z2e3Z3d dl4m5Z6 d dl4m7Z8 �nd dl9mZ e:fZ
e:Zd dl9m;Z d dlZd dlZd dl<Z<d dl=mZmZmZmZmZmZmZm!Z! d dl>m$Z$mZm#Z#mZmZm'Z'm(Z(m)Z)m*Z*m+Z+ e�rd dl>m,Z, d dl?m&Z&m%Z%m Z  d dl@mAZ- d dl>mBZ" d dlCmAZ. d dl0Z0d dlDm1Z1 d dlEmFZ2 eGZ3d dl4m8Z8 e6Z6zd dlmHZHmIZI W n6 e�y¾   G dd„ deJƒZId`dd„ZKdd„ ZHY n0 zd dlmLZM W n$ e�yô   G dd„ deNƒZMY n0 zd dl<mOZO W n* e�y0   ejPejQB dfd d!„ZOY n0 d d"lRmSZT eUeTd#ƒ�rPeTZSn,d d$lRmVZW G d%d&„ d&eWƒZVG d'd(„ d(eTƒZSzd d)lXmYZY W n e�y¨   d*d+„ ZYY n0 d dl<Z<d dlZZZze[Z[W n( e\�yê   d d,l]m^Z^ d-d.„ Z[Y n0 zej_Z_ej`Z`W nF ea�yB   e b¡ �pd/Zcecd0k�r*d1Zdnd2Zdd3d4„ Z_d5d6„ Z`Y n0 zd d7lemfZf W nF e�yš   d d8lgmhZhmiZi d dlZe jd9¡Zkd:d;„ Zld<d=„ ZfY n0 zd d>lmmnZn W n  e�yÌ   d d>lomnZn Y n0 ejdd?… d@k �rìe1ƒ jpZpnd dAlmmpZp zd dBlqmrZr W n` e�yh   d dClqmsZs zd dDltmuZv W n e�yR   dadFdG„ZvY n0 G dHdI„ dIesƒZrY n0 zd dJlwmxZx W n e�y˜   dbdKdL„ZxY n0 zd dMlqmyZy W n„ e�y.   zd dNlzm{Z| W n  e�yê   d dNl}m{Z| Y n0 zd dOl~mZm€Z€m�Z� W n e�y   Y n0 G dPdQ„ dQe‚ƒZyY n0 zd dRlƒm„Z„m…Z… W nt e�y¸   e jdSej†¡Z‡dTdU„ Z…G dVdW„ dWe‚ƒZˆdcdXdY„Z‰G dZd[„ d[eŠƒZ‹G d\d]„ d]eŒƒZ�G d^d_„ d_eNƒZ„Y n0 dS )dé    )Úabsolute_importNé   )ÚStringIO)ÚFileType)ÚurlparseÚ
urlunparseÚurljoinÚurlsplitÚ
urlunsplit)ÚurlretrieveÚquoteÚunquoteÚurl2pathnameÚpathname2urlÚContentTooShortErrorÚ	splittypec                 C   s   t | tƒr|  d¡} t| ƒS )Núutf-8)Ú
isinstanceÚunicodeÚencodeÚ_quote)Ús© r   úQ/var/www/html/gsl.tools/lib/python3.9/site-packages/pip/_vendor/distlib/compat.pyr      s    

r   )	ÚRequestÚurlopenÚURLErrorÚ	HTTPErrorÚHTTPBasicAuthHandlerÚHTTPPasswordMgrÚHTTPHandlerÚHTTPRedirectHandlerÚbuild_opener)ÚHTTPSHandler)Ú
HTMLParser)Úifilter)Úifilterfalse)ÚTextIOWrapper)r   r   r   r   r   r	   r
   r   )
r   r   r   r   r   r   r   r    r!   r"   )r   r   r   )Úfilterfalse)Úmatch_hostnameÚCertificateErrorc                   @   s   e Zd ZdS )r*   N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r*   _   s   r*   é   c           
      C   sô   g }| sdS |   d¡}|d |dd…  }}| d¡}||krNtdt| ƒ ƒ‚|sb|  ¡ | ¡ kS |dkrv| d¡ n>| d	¡sŠ| d	¡rœ| t |¡¡ n| t |¡ 	d
d¡¡ |D ]}| t |¡¡ q¸t 
dd |¡ d tj¡}	|	 |¡S )zpMatching according to RFC 6125, section 6.4.3

        http://tools.ietf.org/html/rfc6125#section-6.4.3
        FÚ.r   r.   NÚ*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)ÚsplitÚcountr*   ÚreprÚlowerÚappendÚ
startswithÚreÚescapeÚreplaceÚcompileÚjoinÚ
IGNORECASEÚmatch)
ÚdnÚhostnameÚmax_wildcardsÚpatsÚpartsÚleftmostÚ	remainderÚ	wildcardsÚfragÚpatr   r   r   Ú_dnsname_matchc   s*    


ÿrH   c                 C   sì   | st dƒ‚g }|  dd¡}|D ]*\}}|dkr t||ƒr@ dS | |¡ q |s”|  dd¡D ]6}|D ],\}}|dkrdt||ƒr†  dS | |¡ qdq\t|ƒdkr¾td	|d
 tt|ƒ¡f ƒ‚n*t|ƒdkràtd||d f ƒ‚ntdƒ‚dS )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_REQUIREDÚsubjectAltNamer   ÚDNSNÚsubjectÚ
commonNamer.   z&hostname %r doesn't match either of %sú, zhostname %r doesn't match %rr   z=no appropriate commonName or subjectAltName fields were found)	Ú
ValueErrorÚgetrH   r5   Úlenr*   r;   Úmapr3   )Úcertr?   ÚdnsnamesÚsanÚkeyÚvalueÚsubr   r   r   r)   •   s2    

þ
þr)   )ÚSimpleNamespacec                   @   s   e Zd ZdZdd„ ZdS )Ú	ContainerzR
        A generic container for when multiple values need to be returned
        c                 K   s   | j  |¡ d S ©N©Ú__dict__Úupdate)ÚselfÚkwargsr   r   r   Ú__init__Ç   s    zContainer.__init__N)r+   r,   r-   Ú__doc__r`   r   r   r   r   rY   Ã   s   rY   )Úwhichc                    s"  dd„ }t j ˆ ¡r&|ˆ |ƒr"ˆ S dS |du r>t j dt j¡}|sFdS | t j¡}tj	dkr¼t j
|vrt| dt j
¡ t j dd¡ t j¡}t‡ fd	d
„|D ƒƒr¨ˆ g}qÂ‡ fdd„|D ƒ}nˆ g}tƒ }|D ]P}t j |¡}||vrÌ| |¡ |D ](}	t j ||	¡}
||
|ƒrò|
    S qòqÌdS )aK  Given 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.

        c                 S   s&   t j | ¡o$t  | |¡o$t j | ¡ S rZ   )ÚosÚpathÚexistsÚaccessÚisdir)ÚfnÚmoder   r   r   Ú_access_checkÜ   s    ÿzwhich.<locals>._access_checkNÚPATHÚwin32r   ÚPATHEXTÚ c                 3   s    | ]}ˆ   ¡  |  ¡ ¡V  qd S rZ   )r4   Úendswith©Ú.0Úext©Úcmdr   r   Ú	<genexpr>ù   ó    zwhich.<locals>.<genexpr>c                    s   g | ]}ˆ | ‘qS r   r   rp   rs   r   r   Ú
<listcomp>ü   rv   zwhich.<locals>.<listcomp>)rc   rd   ÚdirnameÚenvironrO   Údefpathr1   ÚpathsepÚsysÚplatformÚcurdirÚinsertÚanyÚsetÚnormcaseÚaddr;   )rt   ri   rd   rj   ÚpathextÚfilesÚseenÚdirÚnormdirÚthefileÚnamer   rs   r   rb   Ï   s8    




rb   )ÚZipFileÚ	__enter__)Ú
ZipExtFilec                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )r�   c                 C   s   | j  |j ¡ d S rZ   r[   )r^   Úbaser   r   r   r`     s    zZipExtFile.__init__c                 C   s   | S rZ   r   ©r^   r   r   r   rŒ     s    zZipExtFile.__enter__c                 G   s   |   ¡  d S rZ   ©Úclose©r^   Úexc_infor   r   r   Ú__exit__  s    zZipExtFile.__exit__N)r+   r,   r-   r`   rŒ   r”   r   r   r   r   r�     s   r�   c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )r‹   c                 C   s   | S rZ   r   r�   r   r   r   rŒ   #  s    zZipFile.__enter__c                 G   s   |   ¡  d S rZ   r�   r’   r   r   r   r”   &  s    zZipFile.__exit__c                 O   s    t j| g|¢R i |¤Ž}t|ƒS rZ   )ÚBaseZipFileÚopenr�   )r^   Úargsr_   rŽ   r   r   r   r–   *  s    zZipFile.openN)r+   r,   r-   rŒ   r”   r–   r   r   r   r   r‹   "  s   r‹   )Úpython_implementationc                   C   s0   dt jv rdS tjdkrdS t j d¡r,dS dS )z6Return a string identifying the Python implementation.ÚPyPyÚjavaÚJythonÚ
IronPythonÚCPython)r|   Úversionrc   rŠ   r6   r   r   r   r   r˜   1  s    

r˜   )ÚCallablec                 C   s
   t | tƒS rZ   )r   rŸ   )Úobjr   r   r   ÚcallableC  s    r¡   r   ÚmbcsÚstrictÚsurrogateescapec                 C   s:   t | tƒr| S t | tƒr$|  tt¡S tdt| ƒj ƒ‚d S ©Nzexpect bytes or str, not %s)	r   ÚbytesÚ	text_typer   Ú_fsencodingÚ	_fserrorsÚ	TypeErrorÚtyper+   ©Úfilenamer   r   r   ÚfsencodeW  s    

ÿr®   c                 C   s:   t | tƒr| S t | tƒr$|  tt¡S tdt| ƒj ƒ‚d S r¥   )	r   r§   r¦   Údecoder¨   r©   rª   r«   r+   r¬   r   r   r   Úfsdecode`  s    

ÿr°   )Údetect_encoding)ÚBOM_UTF8Úlookupzcoding[:=]\s*([-\w.]+)c                 C   sH   | dd…   ¡  dd¡}|dks*| d¡r.dS |dv s@| d¡rDd	S | S )
z(Imitates get_normal_name in tokenizer.c.Né   Ú_ú-r   zutf-8-)zlatin-1ú
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-r·   )r4   r9   r6   )Úorig_encÚencr   r   r   Ú_get_normal_nameq  s    ÿrº   c                    sÈ   zˆj j‰W n ty"   d‰Y n0 d‰ d}d}‡fdd„}‡ ‡fdd„}|ƒ }| t¡rnd‰ |d	d… }d
}|sz|g fS ||ƒ}|r�||gfS |ƒ }|s¤||gfS ||ƒ}|r¼|||gfS |||gfS )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.
        NFr   c                      s"   zˆ ƒ W S  t y   Y dS 0 d S )Nrv   )ÚStopIterationr   )Úreadliner   r   Úread_or_stop”  s    z%detect_encoding.<locals>.read_or_stopc                    sà   z|   d¡}W n2 ty@   d}ˆd ur4d |ˆ¡}t|ƒ‚Y n0 t |¡}|sTd S t|d ƒ}zt|ƒ}W n8 ty¤   ˆd u rŒd| }nd ˆ|¡}t|ƒ‚Y n0 ˆ rÜ|j	dkrÔˆd u rÂd}n
d ˆ¡}t|ƒ‚|d	7 }|S )
Nr   z'invalid or missing encoding declarationz{} for {!r}r   zunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
r¯   ÚUnicodeDecodeErrorÚformatÚSyntaxErrorÚ	cookie_reÚfindallrº   r³   ÚLookupErrorrŠ   )ÚlineÚline_stringÚmsgÚmatchesÚencodingÚcodec)Ú	bom_foundr­   r   r   Úfind_cookieš  s8    

ÿ

z$detect_encoding.<locals>.find_cookieTr   z	utf-8-sig)Ú__self__rŠ   ÚAttributeErrorr6   r²   )r¼   rÈ   Údefaultr½   rË   ÚfirstÚsecondr   )rÊ   r­   r¼   r   r±   |  s4    
&


r±   )r8   é   )r   é   )Úunescape)ÚChainMap)ÚMutableMapping)Úrecursive_reprú...c                    s   ‡ fdd„}|S )zm
            Decorator to make a repr function return fillvalue for a recursive
            call
            c                    sL   t ƒ ‰ ‡‡ ‡fdd„}tˆdƒ|_tˆdƒ|_tˆdƒ|_tˆdi ƒ|_|S )Nc              	      sL   t | ƒtƒ f}|ˆv rˆ S ˆ |¡ zˆ| ƒ}W ˆ |¡ nˆ |¡ 0 |S rZ   )ÚidÚ	get_identrƒ   Údiscard)r^   rU   Úresult)Ú	fillvalueÚrepr_runningÚuser_functionr   r   Úwrapperñ  s    

z=_recursive_repr.<locals>.decorating_function.<locals>.wrapperr,   ra   r+   Ú__annotations__)r�   Úgetattrr,   ra   r+   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´   e Zd ZdZdd„ Zdd„ Zdd„ Zd'd	d
„Zdd„ Zdd„ Z	dd„ Z
dd„ Zeƒ dd„ ƒZedd„ ƒZdd„ ZeZdd„ Zedd„ ƒZdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ ZdS )(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.

        c                 G   s   t |ƒpi g| _dS )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)r^   ræ   r   r   r   r`     s    zChainMap.__init__c                 C   s   t |ƒ‚d S rZ   )ÚKeyError©r^   rU   r   r   r   Ú__missing__  s    zChainMap.__missing__c              	   C   s8   | j D ]&}z|| W   S  ty*   Y q0 q|  |¡S rZ   )ræ   rç   ré   )r^   rU   Úmappingr   r   r   Ú__getitem__  s    
zChainMap.__getitem__Nc                 C   s   || v r| | S |S rZ   r   ©r^   rU   rÎ   r   r   r   rO   $  s    zChainMap.getc                 C   s   t tƒ j| jŽ ƒS rZ   )rP   r�   Úunionræ   r�   r   r   r   Ú__len__'  s    zChainMap.__len__c                 C   s   t tƒ j| jŽ ƒS rZ   )Úiterr�   rí   ræ   r�   r   r   r   Ú__iter__*  s    zChainMap.__iter__c                    s   t ‡ fdd„| jD ƒƒS )Nc                 3   s   | ]}ˆ |v V  qd S rZ   r   )rq   Úm©rU   r   r   ru   .  rv   z(ChainMap.__contains__.<locals>.<genexpr>©r€   ræ   rè   r   rò   r   Ú__contains__-  s    zChainMap.__contains__c                 C   s
   t | jƒS rZ   ró   r�   r   r   r   Ú__bool__0  s    zChainMap.__bool__c                 C   s   d  | d tt| jƒ¡¡S )Nz{0.__class__.__name__}({1})rM   )r¿   r;   rQ   r3   ræ   r�   r   r   r   Ú__repr__3  s    ÿzChainMap.__repr__c                 G   s   | t j|g|¢R Ž ƒS )z?Create a ChainMap with a single dict created from the iterable.)ÚdictÚfromkeys)ÚclsÚiterabler—   r   r   r   rø   8  s    zChainMap.fromkeysc                 C   s&   | j | jd  ¡ g| jdd… ¢R Ž S )zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r   r.   N)Ú	__class__ræ   Úcopyr�   r   r   r   rü   =  s    zChainMap.copyc                 C   s   | j i g| j¢R Ž S )z;New ChainMap with a new dict followed by all previous maps.©rû   ræ   r�   r   r   r   Ú	new_childC  s    zChainMap.new_childc                 C   s   | j | jdd… Ž S )zNew ChainMap from maps[1:].r.   Nrý   r�   r   r   r   ÚparentsG  s    zChainMap.parentsc                 C   s   || j d |< d S )Nr   )ræ   )r^   rU   rV   r   r   r   Ú__setitem__L  s    zChainMap.__setitem__c                 C   s6   z| j d |= W n  ty0   td |¡ƒ‚Y n0 d S )Nr   ú(Key not found in the first mapping: {!r})ræ   rç   r¿   rè   r   r   r   Ú__delitem__O  s    zChainMap.__delitem__c                 C   s0   z| j d  ¡ W S  ty*   tdƒ‚Y n0 dS )zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.r   z#No keys found in the first mapping.N)ræ   Úpopitemrç   r�   r   r   r   r  U  s    zChainMap.popitemc                 G   s@   z| j d j|g|¢R Ž W S  ty:   td |¡ƒ‚Y n0 dS )zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r   r  N)ræ   Úpoprç   r¿   )r^   rU   r—   r   r   r   r  \  s    zChainMap.popc                 C   s   | j d  ¡  dS )z'Clear maps[0], leaving maps[1:] intact.r   N)ræ   Úclearr�   r   r   r   r  c  s    zChainMap.clear)N)r+   r,   r-   ra   r`   ré   rë   rO   rî   rð   rô   rõ   rä   rö   Úclassmethodrø   rü   Ú__copy__rþ   Úpropertyrÿ   r   r  r  r  r  r   r   r   r   rÔ     s.   



rÔ   )Úcache_from_sourcec                 C   s0   |   d¡sJ ‚|d u rd}|r$d}nd}| | S )Nz.pyTÚcÚo)ro   )rd   Údebug_overrideÚsuffixr   r   r   r	  j  s    r	  )ÚOrderedDict)rÙ   )ÚKeysViewÚ
ValuesViewÚ	ItemsViewc                   @   sþ   e Zd ZdZdd„ Zejfdd„Zejfdd„Zdd	„ Zd
d„ Z	dd„ Z
d6dd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZeZeƒ Zefdd „Zd7d"d#„Zd8d$d%„Zd&d'„ Zd(d)„ Zed9d*d+„ƒZd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Z d4d5„ Z!d!S ):r  z)Dictionary that remembers insertion orderc                 O   sp   t |ƒdkrtdt |ƒ ƒ‚z
| j W n4 tyZ   g  | _}||dg|dd…< i | _Y n0 | j|i |¤Ž dS )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)rP   rª   Ú_OrderedDict__rootrÍ   Ú_OrderedDict__mapÚ_OrderedDict__update)r^   r—   ÚkwdsÚrootr   r   r   r`   ‘  s    

zOrderedDict.__init__c                 C   sF   || vr6| j }|d }|||g |d<  |d< | j|< || ||ƒ dS )z!od.__setitem__(i, y) <==> od[i]=yr   r.   N)r  r  )r^   rU   rV   Zdict_setitemr  Úlastr   r   r   r   ¡  s
     zOrderedDict.__setitem__c                 C   s0   || |ƒ | j  |¡\}}}||d< ||d< dS )z od.__delitem__(y) <==> del od[y]r.   r   N)r  r  )r^   rU   Zdict_delitemÚ	link_prevÚ	link_nextr   r   r   r  «  s    
zOrderedDict.__delitem__c                 c   s.   | j }|d }||ur*|d V  |d }qdS )zod.__iter__() <==> iter(od)r.   rÑ   N©r  ©r^   r  Úcurrr   r   r   rð   ´  s
    
zOrderedDict.__iter__c                 c   s.   | j }|d }||ur*|d V  |d }qdS )z#od.__reversed__() <==> reversed(od)r   rÑ   Nr  r  r   r   r   Ú__reversed__¼  s
    
zOrderedDict.__reversed__c                 C   sb   z@| j  ¡ D ]}|dd…= q| j}||dg|dd…< | j  ¡  W n tyR   Y n0 t | ¡ dS )z.od.clear() -> None.  Remove all items from od.N)r  Ú
itervaluesr  r  rÍ   r÷   )r^   Únoder  r   r   r   r  Ä  s    zOrderedDict.clearTc                 C   s|   | st dƒ‚| j}|r8|d }|d }||d< ||d< n |d }|d }||d< ||d< |d }| j|= t | |¡}||fS )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.

            zdictionary is emptyr   r.   rÑ   )rç   r  r  r÷   r  )r^   r  r  Úlinkr  r  rU   rV   r   r   r   r  Ð  s     
zOrderedDict.popitemc                 C   s   t | ƒS )zod.keys() -> list of keys in od)rå   r�   r   r   r   Úkeysé  s    zOrderedDict.keysc                    s   ‡ fdd„ˆ D ƒS )z#od.values() -> list of values in odc                    s   g | ]}ˆ | ‘qS r   r   ©rq   rU   r�   r   r   rw   ï  rv   z&OrderedDict.values.<locals>.<listcomp>r   r�   r   r�   r   Úvaluesí  s    zOrderedDict.valuesc                    s   ‡ fdd„ˆ D ƒS )z.od.items() -> list of (key, value) pairs in odc                    s   g | ]}|ˆ | f‘qS r   r   r"  r�   r   r   rw   ó  rv   z%OrderedDict.items.<locals>.<listcomp>r   r�   r   r�   r   Úitemsñ  s    zOrderedDict.itemsc                 C   s   t | ƒS )z0od.iterkeys() -> an iterator over the keys in od)rï   r�   r   r   r   Úiterkeysõ  s    zOrderedDict.iterkeysc                 c   s   | D ]}| | V  qdS )z2od.itervalues -> an iterator over the values in odNr   ©r^   Úkr   r   r   r  ù  s    zOrderedDict.itervaluesc                 c   s   | D ]}|| | fV  qdS )z=od.iteritems -> an iterator over the (key, value) items in odNr   r&  r   r   r   Ú	iteritemsþ  s    zOrderedDict.iteritemsc                  O   sÈ   t | ƒdkr tdt | ƒf ƒ‚n| s,tdƒ‚| d }d}t | ƒdkrL| d }t|tƒrn|D ]}|| ||< qZn<t|dƒr”| ¡ D ]}|| ||< q€n|D ]\}}|||< q˜| ¡ D ]\}}|||< q²dS )	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)r   r   r.   r!  N)rP   rª   r   r÷   Úhasattrr!  r$  )r—   r  r^   ÚotherrU   rV   r   r   r   r]     s(    	ÿ


zOrderedDict.updatec                 C   s0   || v r| | }| |= |S || j u r,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ç   )r^   rU   rÎ   rÛ   r   r   r   r  &  s    
zOrderedDict.popNc                 C   s   || v r| | S || |< |S )zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr   rì   r   r   r   Ú
setdefault3  s    zOrderedDict.setdefaultc                 C   sn   |si }t | ƒtƒ f}||v r"dS d||< z6| sFd| jjf W ||= S d| jj|  ¡ f W ||= S ||= 0 dS )zod.__repr__() <==> repr(od)r×   r.   z%s()z%s(%r)N)rØ   Ú
_get_identrû   r+   r$  )r^   Ú_repr_runningZcall_keyr   r   r   rö   :  s    ýþzOrderedDict.__repr__c                    sX   ‡ fdd„ˆ D ƒ}t ˆ ƒ ¡ }t tƒ ƒD ]}| |d¡ q(|rLˆ j|f|fS ˆ j|ffS )z%Return state information for picklingc                    s   g | ]}|ˆ | g‘qS r   r   ©rq   r'  r�   r   r   rw   J  rv   z*OrderedDict.__reduce__.<locals>.<listcomp>N)Úvarsrü   r  r  rû   )r^   r$  Ú	inst_dictr'  r   r�   r   Ú
__reduce__H  s    zOrderedDict.__reduce__c                 C   s
   |   | ¡S )z!od.copy() -> a shallow copy of od)rû   r�   r   r   r   rü   R  s    zOrderedDict.copyc                 C   s   | ƒ }|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ú   rV   ÚdrU   r   r   r   rø   V  s    
zOrderedDict.fromkeysc                 C   s6   t |tƒr*t| ƒt|ƒko(|  ¡ | ¡ kS t | |¡S )z›od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
            while comparison to a regular mapping is order-insensitive.

            )r   r  rP   r$  r÷   Ú__eq__©r^   r*  r   r   r   r4  a  s    
 zOrderedDict.__eq__c                 C   s
   | |k S rZ   r   r5  r   r   r   Ú__ne__j  s    zOrderedDict.__ne__c                 C   s   t | ƒS )z@od.viewkeys() -> a set-like object providing a view on od's keys)r  r�   r   r   r   Úviewkeyso  s    zOrderedDict.viewkeysc                 C   s   t | ƒS )z<od.viewvalues() -> an object providing a view on od's values)r  r�   r   r   r   Ú
viewvaluess  s    zOrderedDict.viewvaluesc                 C   s   t | ƒS )zBod.viewitems() -> a set-like object providing a view on od's items)r  r�   r   r   r   Ú	viewitemsw  s    zOrderedDict.viewitems)T)N)N)N)"r+   r,   r-   ra   r`   r÷   r   r  rð   r  r  r  r!  r#  r$  r%  r  r(  r]   r  Úobjectr+  r  r,  rö   r2  rü   r  rø   r4  r6  r7  r8  r9  r   r   r   r   r  …  s:   
	




	r  )ÚBaseConfiguratorÚvalid_identz^[a-z_][a-z0-9_]*$c                 C   s   t  | ¡}|std|  ƒ‚dS )Nz!Not a valid Python identifier: %rT)Ú
IDENTIFIERr=   rN   )r   rñ   r   r   r   r<  �  s    
r<  c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )ÚConvertingDictz A converting dictionary wrapper.c                 C   sJ   t  | |¡}| j |¡}||urF|| |< t|ƒtttfv rF| |_||_	|S rZ   )
r÷   rë   ÚconfiguratorÚconvertr«   r>  ÚConvertingListÚConvertingTupleÚparentrU   ©r^   rU   rV   rÛ   r   r   r   rë   ”  s    
ÿzConvertingDict.__getitem__Nc                 C   sL   t  | ||¡}| j |¡}||urH|| |< t|ƒtttfv rH| |_||_	|S rZ   )
r÷   rO   r?  r@  r«   r>  rA  rB  rC  rU   ©r^   rU   rÎ   rV   rÛ   r   r   r   rO      s    
ÿzConvertingDict.get)N)r+   r,   r-   ra   rë   rO   r   r   r   r   r>  ‘  s   r>  c                 C   sD   t  | ||¡}| j |¡}||ur@t|ƒtttfv r@| |_||_	|S rZ   )
r÷   r  r?  r@  r«   r>  rA  rB  rC  rU   rE  r   r   r   r  ¬  s    
ÿr  c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )	rA  zA converting list wrapper.c                 C   sJ   t  | |¡}| j |¡}||urF|| |< t|ƒtttfv rF| |_||_	|S rZ   )
rå   rë   r?  r@  r«   r>  rA  rB  rC  rU   rD  r   r   r   rë   ¸  s    
ÿzConvertingList.__getitem__éÿÿÿÿc                 C   s<   t  | |¡}| j |¡}||ur8t|ƒtttfv r8| |_|S rZ   )	rå   r  r?  r@  r«   r>  rA  rB  rC  )r^   ÚidxrV   rÛ   r   r   r   r  Ä  s    
ÿzConvertingList.popN)rF  )r+   r,   r-   ra   rë   r  r   r   r   r   rA  ¶  s   rA  c                   @   s   e Zd ZdZdd„ ZdS )rB  zA converting tuple wrapper.c                 C   sB   t  | |¡}| j |¡}||ur>t|ƒtttfv r>| |_||_	|S rZ   )
Útuplerë   r?  r@  r«   r>  rA  rB  rC  rU   rD  r   r   r   rë   Ï  s    
ÿzConvertingTuple.__getitem__N)r+   r,   r-   ra   rë   r   r   r   r   rB  Í  s   rB  c                   @   sŒ   e Zd ZdZe d¡Ze d¡Ze d¡Ze d¡Z	e d¡Z
ddd	œZeeƒZd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )r;  zQ
        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)rr   Úcfgc                 C   s   t |ƒ| _| | j_d S rZ   )r>  Úconfigr?  )r^   rL  r   r   r   r`   í  s    
zBaseConfigurator.__init__c           	   	   C   s¾   |  d¡}| d¡}z\|  |¡}|D ]F}|d| 7 }zt||ƒ}W q$ tyh   |  |¡ t||ƒ}Y q$0 q$|W S  ty¸   t ¡ dd… \}}td||f ƒ}|| |_	|_
|‚Y n0 dS )zl
            Resolve strings to objects using standard import and attribute
            syntax.
            r/   r   r.   NzCannot resolve %r: %s)r1   r  Úimporterrá   rÍ   ÚImportErrorr|   r“   rN   Ú	__cause__Ú__traceback__)	r^   r   rŠ   ÚusedÚfoundrF   ÚeÚtbÚvr   r   r   Úresolveñ  s"    



zBaseConfigurator.resolvec                 C   s
   |   |¡S )z*Default converter for the ext:// protocol.)rV  ©r^   rV   r   r   r   rI    s    zBaseConfigurator.ext_convertc                 C   sü   |}| j  |¡}|du r&td| ƒ‚nÒ|| ¡ d… }| j| ¡ d  }|rø| j |¡}|rn|| ¡ d  }nb| j |¡}|rÐ| ¡ d }| j |¡s || }n0zt	|ƒ}|| }W n t
yÎ   || }Y n0 |ræ|| ¡ d… }qHtd||f ƒ‚qH|S )z*Default converter for the cfg:// protocol.NzUnable to convert %rr   zUnable to convert %r at %r)ÚWORD_PATTERNr=   rN   ÚendrL  ÚgroupsÚDOT_PATTERNÚINDEX_PATTERNÚDIGIT_PATTERNÚintrª   )r^   rV   Úrestrñ   r3  rG  Únr   r   r   rJ    s4    
ÿzBaseConfigurator.cfg_convertc                 C   sÆ   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  )r   r>  r÷   r?  rA  rå   rB  rH  Ústring_typesÚCONVERT_PATTERNr=   Ú	groupdictÚvalue_convertersrO   rá   )r^   rV   rñ   r3  ra  Ú	converterr  r   r   r   r@  .  s,    
ÿ

zBaseConfigurator.convertc                    sr   ˆ   d¡}t|ƒs|  |¡}ˆ   dd¡}t‡ fdd„ˆ D ƒƒ}|f i |¤Ž}|rn| ¡ D ]\}}t|||ƒ qX|S )z1Configure an object with a user-supplied factory.z()r/   Nc                    s    g | ]}t |ƒr|ˆ | f‘qS r   )r<  r/  ©rL  r   r   rw   Q  rv   z5BaseConfigurator.configure_custom.<locals>.<listcomp>)r  r¡   rV  r÷   r$  Úsetattr)r^   rL  r
  Úpropsr_   rÛ   rŠ   rV   r   rg  r   Úconfigure_customJ  s    

z!BaseConfigurator.configure_customc                 C   s   t |tƒrt|ƒ}|S )z0Utility function which converts lists to tuples.)r   rå   rH  rW  r   r   r   Úas_tupleX  s    
zBaseConfigurator.as_tupleN)r+   r,   r-   ra   r7   r:   rc  rX  r[  r\  r]  re  ÚstaticmethodÚ
__import__rM  r`   rV  rI  rJ  r@  rj  rk  r   r   r   r   r;  Ù  s"   




þ"r;  )r.   )r×   )N)N)ŽÚ
__future__r   rc   r7   r|   ÚsslrN  Úversion_infor   Ú
basestringrb  r   r§   Útypesr   Ú	file_typeÚ__builtin__ÚbuiltinsÚConfigParserÚconfigparserr   r   r   r	   r
   Úurllibr   r   r   r   r   r   r   r   Úurllib2r   r   r   r   r   r   r    r!   r"   r#   ÚhttplibÚ	xmlrpclibÚQueueÚqueuer$   ÚhtmlentitydefsÚ	raw_inputÚ	itertoolsr%   Úfilterr&   r(   ÚioÚstrr'   ÚshutilÚurllib.parseÚurllib.requestÚurllib.errorÚhttp.clientÚclientÚrequestÚxmlrpc.clientÚhtml.parserÚhtml.entitiesÚentitiesÚinputr)   r*   rN   rH   rX   rY   r:  rb   ÚF_OKÚX_OKÚzipfiler‹   r•   r)  r�   ZBaseZipExtFiler}   r˜   Ú	sysconfigr¡   Ú	NameErrorÚcollections.abcrŸ   r®   r°   rÍ   Úgetfilesystemencodingr¨   r©   Útokenizer±   Úcodecsr²   r³   r:   rÁ   rº   Úhtmlr8   ÚcgirÓ   ÚcollectionsrÔ   rÕ   ÚreprlibrÖ   rä   Úimportlib.utilr	  r  ÚthreadrÙ   r-  Údummy_threadÚ_abcollr  r  r  r÷   Úlogging.configr;  r<  ÚIr=  r>  r  rå   rA  rH  rB  r   r   r   r   Ú<module>   s  
$,(0
2+A


		
[
b
 w

