a
    <Bìjû¡  ã                   @   s®  d dl mZ d dlZd dlZd dlZd dlZzd dlZW n eyN   dZY n0 ejd  dk �rld 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l0Z1d dl2m2Z2 d dl3Z3e4Z4d dl5m6Z7 d dl5m8Z9 �nd 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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l1Z1d dlDm2Z2 d dlEmFZ3 eGZ4d dl5m9Z9 e7Z7z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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�y:   e b¡ �pd/Zcecd0k�r"d1Zdnd2Zdd3d4„ Z_d5d6„ Z`Y n0 zd d7lemfZf W n> e�yŠ   d d8lgmhZhmiZi 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Üe2ƒ jpZpnd dAlmmpZp zd dBlqmrZr W n` e�yX   d dClqmsZs zd dDltmuZv W n e�yB   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   úY/mnt/bigstor/www/usecases/.venv/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ÚhostnameZmax_wildcardsZpatsÚpartsZleftmostÚ	remainderÚ	wildcardsÚfragÚpatr   r   r   Ú_dnsname_match`   s*    


ÿrE   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ÚgetrE   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   rV   À   s   rV   )Ú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 rW   )Ú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 rW   )r4   Úendswith©Ú.0Úext©Úcmdr   r   Ú	<genexpr>÷   ó    zwhich.<locals>.<genexpr>c                    s   g | ]}ˆ | ‘qS r   r   rm   rp   r   r   Ú
<listcomp>ú   rs   zwhich.<locals>.<listcomp>)r`   ra   ÚdirnameÚenvironrL   Údefpathr1   ÚpathsepÚsysÚplatformÚcurdirÚinsertÚanyÚsetÚnormcaseÚaddr;   )rq   rf   ra   rg   ÚpathextÚfilesÚseenÚdirÚnormdirÚthefileÚnamer   rp   r   r_   Í   s8    




r_   )Ú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 rW   rX   )r[   Úbaser   r   r   r]     s    zZipExtFile.__init__c                 C   s   | S rW   r   ©r[   r   r   r   r‰     s    zZipExtFile.__enter__c                 G   s   |   ¡  d S rW   ©Ú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 rW   r   rŒ   r   r   r   r‰   #  s    zZipFile.__enter__c                 G   s   |   ¡  d S rW   r�   r�   r   r   r   r‘   &  s    zZipFile.__exit__c                 O   s    t j| g|¢R i |¤Ž}t|ƒS rW   )Ú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)ry   Úversionr`   r‡   r6   r   r   r   r   r•   3  s    

r•   )ÚCallablec                 C   s
   t | tƒS rW   )r   rœ   )Úobjr   r   r   ÚcallableE  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   ÚfsencodeY  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   Úfsdecodeb  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_names  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 )Nrs   )Ú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�  s<    

ÿ
ÿ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 rW   )ÚidÚ	get_identr€   Údiscard)r[   rR   Úresult)Ú	fillvalueÚrepr_runningÚuser_functionr   r   Úwrapper÷  s    

z=_recursive_repr.<locals>.decorating_function.<locals>.wrapperr,   r^   r+   Ú__annotations__)r~   Úgetattrr,   r^   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 rW   )ÚKeyError©r[   rR   r   r   r   Ú__missing__   s    zChainMap.__missing__c              	   C   s8   | j D ]&}z|| W   S  ty*   Y q0 q|  |¡S rW   )rã   rä   ræ   )r[   rR   Úmappingr   r   r   Ú__getitem__#  s    
ÿ
ÿzChainMap.__getitem__Nc                 C   s   || v r| | S |S rW   r   ©r[   rR   rË   r   r   r   rL   -  s    zChainMap.getc                 C   s   t tƒ j| jŽ ƒS rW   )rM   r~   Úunionrã   rŒ   r   r   r   Ú__len__0  s    ÿzChainMap.__len__c                 C   s   t tƒ j| jŽ ƒS rW   )Úiterr~   rê   rã   rŒ   r   r   r   Ú__iter__4  s    zChainMap.__iter__c                    s   t ‡ fdd„| jD ƒƒS )Nc                 3   s   | ]}ˆ |v V  qd S rW   r   )rn   Úm©rR   r   r   rr   8  rs   z(ChainMap.__contains__.<locals>.<genexpr>©r}   rã   rå   r   rï   r   Ú__contains__7  s    zChainMap.__contains__c                 C   s
   t | jƒS rW   rð   rŒ   r   r   r   Ú__bool__:  s    zChainMap.__bool__c                 C   s   d  | d tt| jƒ¡¡S )Nz{0.__class__.__name__}({1})rJ   )r¼   r;   rN   r3   rã   rŒ   r   r   r   Ú__repr__=  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õ   B  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ù   G  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_childM  s    zChainMap.new_childc                 C   s   | j | jdd… Ž S )zNew ChainMap from maps[1:].r.   Nrú   rŒ   r   r   r   ÚparentsQ  s    zChainMap.parentsc                 C   s   || j d |< d S )Nr   )rã   )r[   rR   rS   r   r   r   Ú__setitem__V  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__Y  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   `  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[   rR   r”   r   r   r   r  g  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  o  s    zChainMap.clear)N)r+   r,   r-   r^   r]   ræ   rè   rL   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)rl   )ra   Údebug_overrideÚsuffixr   r   r   r  x  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)rM   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[   rR   rS   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[   rR   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  rR   rS   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   ©rn   rR   rŒ   r   r   rt   ÿ  rs   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   rt     rs   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)rM   r§   r   rô   Úhasattrr  r!  )r”   r  r[   ÚotherrR   rS   r   r   r   rZ     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[   rR   rË   rØ   r   r   r   r  6  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   Ú
setdefaultC  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[   Z_repr_runningZcall_keyr   r   r   ró   J  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   ©rn   r$  rŒ   r   r   rt   [  rs   z*OrderedDict.__reduce__.<locals>.<listcomp>N)Úvarsrù   r  r  rø   )r[   r!  Ú	inst_dictr$  r   rŒ   r   Ú
__reduce__Y  s    zOrderedDict.__reduce__c                 C   s
   |   | ¡S )z!od.copy() -> a shallow copy of od)rø   rŒ   r   r   r   rù   c  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÷   rS   ÚdrR   r   r   r   rõ   g  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  rM   r!  rô   Ú__eq__©r[   r'  r   r   r   r0  r  s    
ÿÿzOrderedDict.__eq__c                 C   s
   | |k S rW   r   r1  r   r   r   Ú__ne__|  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   Úviewkeys�  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   Ú
viewvalues…  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   Ú	viewitems‰  s    zOrderedDict.viewitems)T)N)N)N)"r+   r,   r-   r^   r]   rô   rý   rÿ   rí   r  r  r   r  r   r!  r"  r  r%  rZ   r  Úobjectr(  r  r)  ró   r.  rù   r  rõ   r0  r2  r3  r4  r5  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=   rK   )r   rî   r   r   r   r8  “  s    
r8  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 rW   )
rô   rè   ÚconfiguratorÚconvertr¨   r:  ÚConvertingListÚConvertingTupleÚparentrR   ©r[   rR   rS   rØ   r   r   r   rè   ¥  s    
ÿzConvertingDict.__getitem__Nc                 C   sL   t  | ||¡}| j |¡}||urH|| |< t|ƒtttfv rH| |_||_	|S rW   )
rô   rL   r;  r<  r¨   r:  r=  r>  r?  rR   ©r[   rR   rË   rS   rØ   r   r   r   rL   ±  s    
ÿzConvertingDict.get)N)r+   r,   r-   r^   rè   rL   r   r   r   r   r:  ¢  s   r:  c                 C   sD   t  | ||¡}| j |¡}||ur@t|ƒtttfv r@| |_||_	|S rW   )
rô   r  r;  r<  r¨   r:  r=  r>  r?  rR   rA  r   r   r   r  ½  s    
ÿr  c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )	r=  zA converting list wrapper.c                 C   sJ   t  | |¡}| j |¡}||urF|| |< t|ƒtttfv rF| |_||_	|S rW   )
râ   rè   r;  r<  r¨   r:  r=  r>  r?  rR   r@  r   r   r   rè   Ê  s    
ÿzConvertingList.__getitem__éÿÿÿÿc                 C   s<   t  | |¡}| j |¡}||ur8t|ƒtttfv r8| |_|S rW   )	râ   r  r;  r<  r¨   r:  r=  r>  r?  )r[   ÚidxrS   rØ   r   r   r   r  Ö  s    
ÿzConvertingList.popN)rB  )r+   r,   r-   r^   rè   r  r   r   r   r   r=  Ç  s   r=  c                   @   s   e Zd ZdZdd„ ZdS )r>  zA converting tuple wrapper.c                 C   sB   t  | |¡}| j |¡}||ur>t|ƒtttfv r>| |_||_	|S rW   )
Útuplerè   r;  r<  r¨   r:  r=  r>  r?  rR   r@  r   r   r   rè   â  s    
ÿzConvertingTuple.__getitem__N)r+   r,   r-   r^   rè   r   r   r   r   r>  ß  s   r>  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 )r7  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)ro   Úcfgc                 C   s   t |ƒ| _| | j_d S rW   )r:  Úconfigr;  )r[   rH  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Ê   ÚImportErrorry   r�   rK   Ú	__cause__Ú__traceback__)	r[   r   r‡   ÚusedÚfoundrC   ÚeÚtbÚvr   r   r   Úresolve  s"    



zBaseConfigurator.resolvec                 C   s
   |   |¡S )z*Default converter for the ext:// protocol.)rR  ©r[   rS   r   r   r   rE    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=   rK   ÚendrH  ÚgroupsÚDOT_PATTERNÚINDEX_PATTERNÚDIGIT_PATTERNÚintr§   )r[   rS   Úrestrî   r/  rC  Únr   r   r   rF    s8    
ÿÿ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;  r=  râ   r>  rD  Ústring_typesÚCONVERT_PATTERNr=   Ú	groupdictÚvalue_convertersrL   rÞ   )r[   rS   rî   r/  r]  Ú	converterr
  r   r   r   r<  B  s0    ÿÿ

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   )r8  r+  ©rH  r   r   rt   f  rs   z5BaseConfigurator.configure_custom.<locals>.<listcomp>)r  rž   rR  rô   r!  Úsetattr)r[   rH  r  Úpropsr\   rØ   r‡   rS   r   rc  r   Úconfigure_custom_  s    

z!BaseConfigurator.configure_customc                 C   s   t |tƒrt|ƒ}|S )z0Utility function which converts lists to tuples.)r   râ   rD  rS  r   r   r   Úas_tuplem  s    
zBaseConfigurator.as_tupleN)r+   r,   r-   r^   r7   r:   r_  rT  rW  rX  rY  ra  ÚstaticmethodÚ
__import__rI  r]   rR  rE  rF  r<  rf  rg  r   r   r   r   r7  ì  s"   




þ#r7  )r.   )rÔ   )N)N)ŽÚ
__future__r   r`   r7   Úshutilry   ÚsslrJ  Úversion_infor   Ú
basestringr^  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'   Úurllib.parseÚurllib.requestÚurllib.errorÚhttp.clientÚclientÚrequestÚxmlrpc.clientÚhtml.parserÚhtml.entitiesÚentitiesÚinputr)   r*   rK   rE   rU   rV   r6  r_   ÚF_OKÚX_OKÚzipfilerˆ   r’   r&  rŠ   ZBaseZipExtFilerz   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.configr7  r8  ÚIr9  r:  r  râ   r=  rD  r>  r   r   r   r   Ú<module>   s  
$,(0
1+	A

	

^
h |

