o
    ~î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y'   dZY nw ejd  dk r³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 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 n e�y\   G dd„ deJƒZIdadd„ZKdd„ ZHY nw zd dlmLZM W n e�yw   G dd„ deNƒZMY nw zd dlmOZO W n e�y•   ejPejQB dfd d!„ZOY nw d d"lRmSZT eUeTd#ƒ�r¥eTZSn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w d dlZZZze[Z[W n e\�yî   d d,l]m^Z^ d-d.„ Z[Y nw zej_Z_ej`Z`W n# ea�y   e b¡ �pd/Zcecd0k�rd1Zdnd2Zdd3d4„ Z_d5d6„ Z`Y nw zd d7lemfZf W n e�yB   d d8lgmhZhmiZi e jd9¡Zkd:d;„ Zld<d=„ ZfY nw zd d>lmmnZn W n e�y[   d d>lomnZn Y nw ejdd?… d@k �rke2ƒ jpZpnd dAlmmpZp daqdBdC„ Zrzd dDlsmtZt W n3 e�y²   d dElsmuZu zd dFlvmwZx W n e�y§   erƒ aqdbdHdI„ZxY nw G dJdK„ dKeuƒZtY nw zd dLlymzZz W n e�yÊ   dcdMdN„ZzY nw zd dOlsm{Z{ W n, e�yÿ   erƒ aqzd dPl|m}Z}m~Z~mZ W n
 e�yô   Y nw G dQdR„ dRe€ƒZ{Y nw zd dSl�m‚Z‚mƒZƒ W dS  e�yF   e jdTej„¡Z…dUdV„ ZƒG dWdX„ dXe€ƒZ†dddYdZ„Z‡G d[d\„ d\eˆƒZ‰G d]d^„ d^eŠƒZ‹G d_d`„ d`eNƒZ‚Y dS w )eé    )Ú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   úd/raid/bulk_storage/M2HATS/real-image-venv/lib/python3.10/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*   Y   s    r*   é   c           
      C   sð   g }| sdS |   d¡}|d |dd… }}| d¡}||kr%td|  ƒ‚|s/|  ¡ | ¡ kS |dkr9| d¡ n| d	¡sC| d	¡rL| t |¡¡ n| t |¡ d
d¡¡ |D ]
}| t |¡¡ qZt 	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: %rz[^.]+zxn--z\*z[^.]*z\Az\.z\Z)ÚsplitÚcountr*   ÚlowerÚappendÚ
startswithÚreÚescapeÚreplaceÚcompileÚjoinÚ
IGNORECASEÚmatch)
ÚdnÚhostnameÚmax_wildcardsÚpatsÚpartsÚleftmostÚ	remainderÚ	wildcardsÚfragÚpatr   r   r   Ú_dnsname_match\   s&   


rG   c                 C   sä   | st dƒ‚g }|  dd¡}|D ]\}}|dkr%t||ƒr  dS | |¡ q|sJ|  dd¡D ]}|D ]\}}|dkrHt||ƒrC  dS | |¡ q2q.t|ƒdkr^td	|d
 tt|ƒ¡f ƒ‚t|ƒdkrntd||d f ƒ‚tdƒ‚)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ÚgetrG   r4   Úlenr*   r:   ÚmapÚrepr)Úcertr>   ÚdnsnamesÚsanÚkeyÚvalueÚsubr   r   r   r)   Œ   s8   

€

€úÿ
ÿr)   )ÚSimpleNamespacec                   @   ó   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__ra   r   r   r   r   rZ   ¹   s    rZ   )Úwhichc                    s"  dd„ }t j ˆ ¡r|ˆ |ƒrˆ S dS |du rt j dt j¡}|s#dS | t j¡}tj	dkr^t j
|vr:| dt j
¡ t j dd¡ t j¡}t‡ fd	d
„|D ƒƒrTˆ g}n‡ fdd„|D ƒ}nˆ g}tƒ }|D ](}t j |¡}||vrŽ| |¡ |D ]}	t j ||	¡}
||
|ƒr�|
    S qyqfd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 r[   )Ú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 r[   )r3   Úendswith©Ú.0Úext©Úcmdr   r   Ú	<genexpr>ð   s   €  zwhich.<locals>.<genexpr>c                    s   g | ]}ˆ | ‘qS r   r   rq   rt   r   r   Ú
<listcomp>ó   ó    zwhich.<locals>.<listcomp>)rd   re   ÚdirnameÚenvironrN   Údefpathr1   ÚpathsepÚsysÚplatformÚcurdirÚinsertÚanyÚsetÚnormcaseÚaddr:   )ru   rj   re   rk   ÚpathextÚfilesÚseenÚdirÚnormdirÚthefileÚnamer   rt   r   rc   Æ   s<   




ÿ€rc   )ÚZipFileÚ	__enter__)Ú
ZipExtFilec                   @   ó$   e Zd Zdd„ Zdd„ Zdd„ ZdS )rŽ   c                 C   s   | j  |j ¡ d S r[   r\   )r_   Úbaser   r   r   ra     ó   zZipExtFile.__init__c                 C   ó   | S r[   r   ©r_   r   r   r   r�     ó   zZipExtFile.__enter__c                 G   ó   |   ¡  d S r[   ©Úclose©r_   Úexc_infor   r   r   Ú__exit__  ó   zZipExtFile.__exit__N)r+   r,   r-   ra   r�   rš   r   r   r   r   rŽ     s    rŽ   c                   @   r�   )rŒ   c                 C   r’   r[   r   r“   r   r   r   r�     r”   zZipFile.__enter__c                 G   r•   r[   r–   r˜   r   r   r   rš     r›   zZipFile.__exit__c                 O   s    t j| g|¢R i |¤Ž}t|ƒS r[   )Ú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}   Úversionrd   r‹   r5   r   r   r   r   rŸ   ,  s   

rŸ   )ÚCallablec                 C   s
   t | tƒS r[   )r   r¦   )Úobjr   r   r   Úcallable>  ó   
r¨   r   ÚmbcsÚstrictÚsurrogateescapec                 C   ó6   t | tƒr| S t | tƒr|  tt¡S tdt| ƒj ƒ‚©Nzexpect bytes or str, not %s)	r   ÚbytesÚ	text_typer   Ú_fsencodingÚ	_fserrorsÚ	TypeErrorÚtyper+   ©Úfilenamer   r   r   ÚfsencodeR  ó
   

r·   c                 C   r­   r®   )	r   r°   r¯   Údecoder±   r²   r³   r´   r+   rµ   r   r   r   ÚfsdecodeZ  r¸   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¡r"d	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Á   )r3   r8   r5   )Úorig_encÚencr   r   r   Ú_get_normal_namej  s   ÿrÄ   c                    sÈ   zˆj j‰W n ty   d‰Y nw d‰ d}d}‡fdd„}‡ ‡fdd„}|ƒ }| t¡r7d‰ |d	d… }d
}|s=|g fS ||ƒ}|rH||gfS |ƒ }|sR||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 w )Nó    )ÚStopIterationr   )Úreadliner   r   Úread_or_stopŽ  s
   ÿz%detect_encoding.<locals>.read_or_stopc                    sâ   z|   d¡}W n ty   d}ˆd urd |ˆ¡}t|ƒ‚w t |¡}|s(d S t|d ƒ}zt|ƒ}W n tyQ   ˆd u rGd| }t|ƒ‚d ˆ|¡}t|ƒ‚w ˆ ro|j	dkrkˆd u rcd}t|ƒ‚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‹   ÚAttributeErrorr5   r¼   )rÇ   rÓ   ÚdefaultrÈ   rÖ   ÚfirstÚsecondr   )rÕ   r¶   rÇ   r   r»   u  s6   ÿ%


r»   )r7   é   )r   é   )Úunescapec                   C   s’   t d u rGz	ddlma  W t S  tyF   z
ddlma  W Y t S  tyE   zddlma  W n ty<   ddlma  Y nw Y Y t S Y Y t S w w t S )Nr   )Ú	get_ident)Ú
_get_identÚthreadrß   ÚImportErrorÚdummy_threadÚ_threadÚ_dummy_threadr   r   r   r   Ú_thread_get_identÝ  s*   
÷úÿÿÿúý	ræ   )Ú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              	      sJ   t | ƒtƒ f}|ˆv rˆ S ˆ |¡ zˆ| ƒ}W ˆ |¡ |S ˆ |¡ w r[   )Úidrà   r„   Údiscard)r_   rU   Úresult)Ú	fillvalueÚrepr_runningÚuser_functionr   r   Úwrapper  s   


ÿz=_recursive_repr.<locals>.decorating_function.<locals>.wrapperr,   rb   r+   Ú__annotations__)r‚   Úgetattrr,   rb   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   ra   &  s   zChainMap.__init__c                 C   s   t |ƒ‚r[   )ÚKeyError©r_   rU   r   r   r   Ú__missing__-  s   zChainMap.__missing__c              	   C   s6   | j D ]}z|| W   S  ty   Y qw |  |¡S r[   )rø   rù   rû   )r_   rU   Úmappingr   r   r   Ú__getitem__0  s   
ÿ
zChainMap.__getitem__Nc                 C   s   || v r| | S |S r[   r   ©r_   rU   rÙ   r   r   r   rN   8  s   zChainMap.getc                 C   ó   t tƒ j| jŽ ƒS r[   )rO   r‚   Úunionrø   r“   r   r   r   Ú__len__;  r‘   zChainMap.__len__c                 C   rÿ   r[   )Úiterr‚   r   rø   r“   r   r   r   Ú__iter__>  r‘   zChainMap.__iter__c                    s   t ‡ fdd„| jD ƒƒS )Nc                 3   s   � | ]}ˆ |v V  qd S r[   r   )rr   Úm©rU   r   r   rv   B  s   € z(ChainMap.__contains__.<locals>.<genexpr>©r�   rø   rú   r   r  r   Ú__contains__A  s   zChainMap.__contains__c                 C   s
   t | jƒS r[   r  r“   r   r   r   Ú__bool__D  r©   zChainMap.__bool__c                 C   s   d  | d tt| jƒ¡¡S )Nz{0.__class__.__name__}({1})rL   )rÊ   r:   rP   rQ   rø   r“   r   r   r   Ú__repr__G  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  K  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  P  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_childV  s   zChainMap.new_childc                 C   s   | j | jdd… Ž S )zNew ChainMap from maps[1:].r.   Nr  r“   r   r   r   ÚparentsZ  s   zChainMap.parentsc                 C   s   || j d |< d S )Nr   )rø   )r_   rU   rV   r   r   r   Ú__setitem___  r‘   zChainMap.__setitem__c                 C   s0   z	| j d |= W d S  ty   td |¡ƒ‚w )Nr   ú(Key not found in the first mapping: {!r})rø   rù   rÊ   rú   r   r   r   Ú__delitem__b  s
   ÿzChainMap.__delitem__c                 C   s(   z| j d  ¡ W S  ty   tdƒ‚w )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.)rø   Úpopitemrù   r“   r   r   r   r  h  s
   ÿzChainMap.popitemc                 G   s8   z| j d j|g|¢R Ž W S  ty   td |¡ƒ‚w )zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r   r  )rø   Úpoprù   rÊ   )r_   rU   rž   r   r   r   r  o  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  v  ó   zChainMap.clearr[   )r+   r,   r-   rb   ra   rû   rý   rN   r  r  r  r  rö   r	  Úclassmethodr  r  Ú__copy__r  Úpropertyr  r  r  r  r  r  r   r   r   r   rç     s0    



rç   )Úcache_from_sourcec                 C   s6   |   d¡sJ ‚|d u rd}|rd}| | S d}| | S )Nz.pyTÚcÚo)rp   )re   Údebug_overrideÚoptimizationÚsuffixr   r   r   r    s   ÿr  )ÚOrderedDict)Ú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d7d$d%„Zd&d'„ Zd(d)„ Zed7d*d+„ƒZd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Z d4d5„ Z!d!S )8r#  z)Dictionary that remembers insertion orderc                 O   sp   t |ƒdkrtdt |ƒ ƒ‚z| j W n ty-   g  | _}||dg|dd…< i | _Y nw | 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)rO   r³   Ú_OrderedDict__rootrØ   Ú_OrderedDict__mapÚ_OrderedDict__update)r_   rž   ÚkwdsÚrootr   r   r   ra   ¥  s   


ýzOrderedDict.__init__c                 C   sF   || vr| j }|d }|||g |d<  |d< | j|< || ||ƒ dS )z!od.__setitem__(i, y) <==> od[i]=yr   r.   N)r'  r(  )r_   rU   rV   Ú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   Údict_delitemÚ	link_prevÚ	link_nextr   r   r   r  ¿  s   
zOrderedDict.__delitem__c                 c   ó:   � | j }|d }||ur|d V  |d }||usdS dS )zod.__iter__() <==> iter(od)r.   rÜ   N©r'  ©r_   r+  Úcurrr   r   r   r  È  ó   €
þzOrderedDict.__iter__c                 c   r1  )z#od.__reversed__() <==> reversed(od)r   rÜ   Nr2  r3  r   r   r   Ú__reversed__Ð  r5  zOrderedDict.__reversed__c                 C   sb   z | j  ¡ D ]}|dd…= q| j}||dg|dd…< | j  ¡  W n	 ty)   Y nw 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}|r|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/  r0  rU   rV   r   r   r   r  ä  s    
zOrderedDict.popitemc                 C   ó   t | ƒS )zod.keys() -> list of keys in od)r÷   r“   r   r   r   Úkeysý  ó   zOrderedDict.keysc                    ó   ‡ fdd„ˆ D ƒS )z#od.values() -> list of values in odc                    s   g | ]}ˆ | ‘qS r   r   ©rr   rU   r“   r   r   rw     rx   z&OrderedDict.values.<locals>.<listcomp>r   r“   r   r“   r   Úvalues  r  zOrderedDict.valuesc                    r=  )z.od.items() -> list of (key, value) pairs in odc                    s   g | ]}|ˆ | f‘qS r   r   r>  r“   r   r   rw     ó    z%OrderedDict.items.<locals>.<listcomp>r   r“   r   r“   r   Úitems  r  zOrderedDict.itemsc                 C   r:  )z0od.iterkeys() -> an iterator over the keys in od)r  r“   r   r   r   Úiterkeys	  r<  zOrderedDict.iterkeysc                 c   s   � | D ]}| | V  qdS )z2od.itervalues -> an iterator over the values in odNr   ©r_   Úkr   r   r   r7    s   €ÿzOrderedDict.itervaluesc                 c   s   � | D ]	}|| | fV  qdS )z=od.iteritems -> an iterator over the (key, value) items in odNr   rC  r   r   r   Ú	iteritems  s   €ÿzOrderedDict.iteritemsc                  O   sÆ   t | ƒdkrtdt | ƒf ƒ‚| stdƒ‚| d }d}t | ƒdkr%| d }t|tƒr6|D ]}|| ||< q,nt|dƒrI| ¡ D ]}|| ||< q?n|D ]\}}|||< qK| ¡ D ]\}}|||< qXd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)rO   r³   r   r
  Úhasattrr;  rA  )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   Ú
setdefaultG  s   zOrderedDict.setdefaultc                 C   sj   |si }t | ƒtƒ f}||v rdS d||< z| s#d| jjf W ||= S d| jj|  ¡ f W ||= S ||= w )zod.__repr__() <==> repr(od)rê   r.   z%s()z%s(%r))rë   rà   r  r+   rA  )r_   Ú_repr_runningÚcall_keyr   r   r   r	  N  s   þzOrderedDict.__repr__c                    sX   ‡ fdd„ˆ D ƒ}t ˆ ƒ ¡ }t tƒ ƒD ]}| |d¡ q|r&ˆ j|f|fS ˆ j|ffS )z%Return state information for picklingc                    s   g | ]}|ˆ | g‘qS r   r   ©rr   rD  r“   r   r   rw   _  r@  z*OrderedDict.__reduce__.<locals>.<listcomp>N)Úvarsr  r#  r  r  )r_   rA  Ú	inst_dictrD  r   r“   r   Ú
__reduce__]  s   zOrderedDict.__reduce__c                 C   s
   |   | ¡S )z!od.copy() -> a shallow copy of od)r  r“   r   r   r   r  g  ó   
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  k  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#  rO   rA  r
  Ú__eq__©r_   rG  r   r   r   rR  v  s   
 zOrderedDict.__eq__c                 C   s
   | |k S r[   r   rS  r   r   r   Ú__ne__  r©   zOrderedDict.__ne__c                 C   r:  )z@od.viewkeys() -> a set-like object providing a view on od's keys)r$  r“   r   r   r   Úviewkeys„  r<  zOrderedDict.viewkeysc                 C   r:  )z<od.viewvalues() -> an object providing a view on od's values)r%  r“   r   r   r   Ú
viewvaluesˆ  r<  zOrderedDict.viewvaluesc                 C   r:  )zBod.viewitems() -> a set-like object providing a view on od's items)r&  r“   r   r   r   Ú	viewitemsŒ  r<  zOrderedDict.viewitems)Tr[   )"r+   r,   r-   rb   ra   r
  r  r  r  r6  r  r  r;  r?  rA  rB  r7  rE  r^   r)  ÚobjectrH  r  rI  r	  rO  r  r  r  rR  rT  rU  rV  rW  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<   rM   )r   r  r   r   r   rZ  –  s   
rZ  c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )ÚConvertingDictz A converting dictionary wrapper.c                 C   óJ   t  | |¡}| j |¡}||ur#|| |< t|ƒtttfv r#| |_||_	|S r[   )
r
  rý   ÚconfiguratorÚconvertr´   r\  ÚConvertingListÚConvertingTupleÚparentrU   ©r_   rU   rV   rí   r   r   r   rý   ¨  ó   zConvertingDict.__getitem__Nc                 C   sL   t  | ||¡}| j |¡}||ur$|| |< t|ƒtttfv r$| |_||_	|S r[   )
r
  rN   r^  r_  r´   r\  r`  ra  rb  rU   ©r_   rU   rÙ   rV   rí   r   r   r   rN   ³  s   zConvertingDict.getr[   )r+   r,   r-   rb   rý   rN   r   r   r   r   r\  ¥  ó    r\  c                 C   sD   t  | ||¡}| j |¡}||ur t|ƒtttfv r | |_||_	|S r[   )
r
  r  r^  r_  r´   r\  r`  ra  rb  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 )	r`  zA converting list wrapper.c                 C   r]  r[   )
r÷   rý   r^  r_  r´   r\  r`  ra  rb  rU   rc  r   r   r   rý   Ê  rd  zConvertingList.__getitem__éÿÿÿÿc                 C   s<   t  | |¡}| j |¡}||urt|ƒtttfv r| |_|S r[   )	r÷   r  r^  r_  r´   r\  r`  ra  rb  )r_   ÚidxrV   rí   r   r   r   r  Õ  s   zConvertingList.popN)rg  )r+   r,   r-   rb   rý   r  r   r   r   r   r`  Ç  rf  r`  c                   @   rY   )ra  zA converting tuple wrapper.c                 C   sB   t  | |¡}| j |¡}||urt|ƒtttfv r| |_||_	|S r[   )
Útuplerý   r^  r_  r´   r\  r`  ra  rb  rU   rc  r   r   r   rý   à  s   zConvertingTuple.__getitem__N)r+   r,   r-   rb   rý   r   r   r   r   ra  Ý  s    ra  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 )rY  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)rs   Úcfgc                 C   s   t |ƒ| _| | j_d S r[   )r\  Úconfigr^  )r_   rm  r   r   r   ra   ý  s   
zBaseConfigurator.__init__c           	   	   C   s´   |  d¡}| d¡}z-|  |¡}|D ]"}|d| 7 }zt||ƒ}W q ty4   |  |¡ t||ƒ}Y qw |W S  tyY   t ¡ dd… \}}td||f ƒ}|||_	|_
|‚w )zl
            Resolve strings to objects using standard import and attribute
            syntax.
            r/   r   r.   NzCannot resolve %r: %s)r1   r  Úimporterró   rØ   râ   r}   r™   rM   Ú	__cause__Ú__traceback__)	r_   r   r‹   ÚusedÚfoundrE   Ú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   rj    rP  zBaseConfigurator.ext_convertc                 C   sü   |}| j  |¡}|du rtd| ƒ‚|| ¡ d… }| j| ¡ d  }|r|| j |¡}|r6|| ¡ d  }n1| j |¡}|rg| ¡ d }| j |¡sO|| }nz
t	|ƒ}|| }W n t
yf   || }Y nw |rr|| ¡ d… }ntd||f ƒ‚|s%|S )z*Default converter for the cfg:// protocol.NzUnable to convert %rr   zUnable to convert %r at %r)ÚWORD_PATTERNr<   rM   Úendrm  ÚgroupsÚDOT_PATTERNÚINDEX_PATTERNÚDIGIT_PATTERNÚintr³   )r_   rV   Úrestr  rQ  rh  Únr   r   r   rk    s8   
ÿÿízBaseConfigurator.cfg_convertc                 C   sÌ   t |tƒst |tƒrt|ƒ}| |_|S t |tƒs&t |tƒr&t|ƒ}| |_|S t |tƒs9t |tƒr9t|ƒ}| |_|S t |tƒrd| j	 
|¡}|rd| ¡ }|d }| j |d¡}|rd|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÷   ra  ri  Ústring_typesÚCONVERT_PATTERNr<   Ú	groupdictÚvalue_convertersrN   ró   )r_   rV   r  rQ  r�  Ú	converterr"  r   r   r   r_  =  s.   ðó
ö
zBaseConfigurator.convertc                    sr   ˆ   d¡}t|ƒs|  |¡}ˆ   dd¡}t‡ fdd„ˆ D ƒƒ}|di |¤Ž}|r7| ¡ D ]
\}}t|||ƒ q,|S )z1Configure an object with a user-supplied factory.z()r/   Nc                    s    g | ]}t |ƒr|ˆ | f‘qS r   )rZ  rL  ©rm  r   r   rw   _  s     z5BaseConfigurator.configure_custom.<locals>.<listcomp>r   )r  r¨   rv  r
  rA  Úsetattr)r_   rm  r  Úpropsr`   rí   r‹   rV   r   r‡  r   Úconfigure_customX  s   

z!BaseConfigurator.configure_customc                 C   s   t |tƒr	t|ƒ}|S )z0Utility function which converts lists to tuples.)r   r÷   ri  rw  r   r   r   Úas_tuplef  s   
zBaseConfigurator.as_tupleN)r+   r,   r-   rb   r6   r9   rƒ  rx  r{  r|  r}  r…  ÚstaticmethodÚ
__import__rn  ra   rv  rj  rk  r_  rŠ  r‹  r   r   r   r   rY  é  s$    




þ!rY  )r.   )rê   )NNr[   )ŒÚ
__future__r   rd   r6   Úshutilr}   Ússlrâ   Ú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*   rM   rG   rX   rZ   rX  rc   ÚF_OKÚX_OKÚzipfilerŒ   rœ   rF  rŽ   ÚBaseZipExtFiler~   rŸ   Ú	sysconfigr¨   Ú	NameErrorÚcollections.abcr¦   r·   rº   rØ   Úgetfilesystemencodingr±   r²   Útokenizer»   Úcodecsr¼   r½   r9   rÌ   rÄ   Úhtmlr7   ÚcgirÞ   rà   ræ   Úcollectionsrç   rè   Úreprlibré   rö   Úimportlib.utilr  r#  Ú_abcollr$  r%  r&  r
  Úlogging.configrY  rZ  ÚIr[  r\  r  r÷   r`  ri  ra  r   r   r   r   Ú<module>   s<  ÿ$,(0
0Ë^þþCþý

ë
ðlÿ
ü!Ù 
þÿõ  
	ª