a
    hbòf¢  ã                   @   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 �rpd 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 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l0Z0d dl1Z2d dl3m3Z3 d dl4Z4e5Z5d dl6m7Z8 d dl6m9Z: �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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lAmBZ/ d dl?mCZ$ d dlDmBZ0 d dl2Z2d dlEm3Z3 d dlFmGZ4 eHZ5d dl6m:Z: e8Z8zd dlmIZImJZJ W n6 e�yÊ   G dd„ deKƒZJdbdd„ZLdd„ ZIY n0 zd dlmMZN W n$ e�y    G dd„ deOƒZNY n0 zd d lmPZP W n* e�y<   ejQejRB dfd!d"„ZPY n0 d d#lSmTZU eVeUd$ƒ�r\eUZTn,d d%lSmWZX G d&d'„ d'eXƒZWG d(d)„ d)eUƒZTzd d*lYmZZZ W n e�y´   d+d,„ ZZY n0 zd dl[Z[W n  e�yâ   dd-lm[Z[ Y n0 ze\Z\W n( e]�y   d d.l^m_Z_ d/d0„ Z\Y n0 zej`Z`ejaZaW nF eb�yl   e c¡ �pBd1Zdedd2k�rTd3Zend4Zed5d6„ Z`d7d8„ ZaY n0 zd d9lfmgZg W nF e�yÄ   d d:lhmiZimjZj d dlZe kd;¡Zld<d=„ Zmd>d?„ ZgY n0 zd d@lnmoZo W n  e�yö   d d@lpmoZo Y n0 ejddA… dBk �re3ƒ jqZqnd dClnmqZq zd dDlrmsZs W n` e�y’   d dElrmtZt zd dFlumvZw W n e�y|   dcdHdI„ZwY n0 G dJdK„ dKetƒZsY n0 zd dLlxmyZy W nD e�yè   zd dLlzmyZy W n e�yâ   dddMdN„ZyY n0 Y n0 zd dOlrm{Z{ W n„ e�y~   zd dPl|m}Z~ W n  e�y:   d dPlm}Z~ Y n0 zd dQl€m�Z�m‚Z‚mƒZƒ W n e�yh   Y n0 G dRdS„ dSe„ƒZ{Y n0 zd dTl…m†Z†m‡Z‡ W nt e�y   e kdUejˆ¡Z‰dVdW„ Z‡G dXdY„ dYe„ƒZŠdedZd[„Z‹G d\d]„ d]eŒƒZ�G d^d_„ d_eŽƒZ�G d`da„ daeOƒZ†Y n0 dS )fé    )Úabsolute_importNé   )ÚStringIO)ÚFileTypeé   )Úshutil)Ú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   úW/home/httpd/docs/test/DocsMgr/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_matchd   s*    


ÿrI   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ÚgetrI   r6   Úlenr,   r<   Úmapr4   )Ú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__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¡}|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 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[   )r5   Úendswith©Ú.0Úext©Úcmdr   r   Ú	<genexpr>ú   ó    zwhich.<locals>.<genexpr>c                    s   g | ]}ˆ | ‘qS r   r   rq   rt   r   r   Ú
<listcomp>ý   rw   zwhich.<locals>.<listcomp>)rd   re   ÚdirnameÚenvironrP   Údefpathr2   ÚpathsepÚsysÚplatformÚcurdirÚinsertÚanyÚsetÚnormcaseÚaddr<   )ru   rj   re   rk   ÚpathextÚfilesÚseenÚdirÚnormdirÚthefileÚnamer   rt   r   rc   Ð   s8    




rc   )Ú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 r[   r\   )r_   Úbaser   r   r   ra     s    zZipExtFile.__init__c                 C   s   | S r[   r   ©r_   r   r   r   r�     s    zZipExtFile.__enter__c                 G   s   |   ¡  d S r[   ©Úclose©r_   Úexc_infor   r   r   Ú__exit__  s    zZipExtFile.__exit__N)r-   r.   r/   ra   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 r[   r   r�   r   r   r   r�   $  s    zZipFile.__enter__c                 G   s   |   ¡  d S r[   r‘   r“   r   r   r   r•   '  s    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‹   r7   r   r   r   r   r™   2  s    

r™   )Ú	sysconfig)ÚCallablec                 C   s
   t | tƒS r[   )r   r¡   )Úobjr   r   r   ÚcallableF  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   ÚfsencodeZ  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   Úfsdecodec  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¹   )r5   r:   r7   )Úorig_encÚencr   r   r   Ú_get_normal_namet  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 )Nrw   )Ú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‹   ÚAttributeErrorr7   r´   )r¾   rÊ   Údefaultr¿   rÍ   ÚfirstÚsecondr   )rÌ   r¯   r¾   r   r³     s4    
&


r³   )r9   é   )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 r[   )ÚidÚ	get_identr„   Údiscard)r_   rV   Ú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 |ƒ‚d S r[   )ÚKeyError©r_   rV   r   r   r   Ú__missing__  s    zChainMap.__missing__c              	   C   s8   | j D ]&}z|| W   S  ty*   Y q0 q|  |¡S r[   )rè   ré   rë   )r_   rV   Úmappingr   r   r   Ú__getitem__  s    
zChainMap.__getitem__Nc                 C   s   || v r| | S |S r[   r   ©r_   rV   rÐ   r   r   r   rP   '  s    zChainMap.getc                 C   s   t tƒ j| jŽ ƒS r[   )rQ   r‚   Úunionrè   r�   r   r   r   Ú__len__*  s    zChainMap.__len__c                 C   s   t tƒ j| jŽ ƒS r[   )Ú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 r[   r   )rr   Úm©rV   r   r   rv   1  rw   z(ChainMap.__contains__.<locals>.<genexpr>©r�   rè   rê   r   rô   r   Ú__contains__0  s    zChainMap.__contains__c                 C   s
   t | jƒS r[   rõ   r�   r   r   r   Ú__bool__3  s    zChainMap.__bool__c                 C   s   d  | d tt| jƒ¡¡S )Nz{0.__class__.__name__}({1})rN   )rÁ   r<   rR   r4   rè   r�   r   r   r   Ú__repr__6  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ú   ;  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_childF  s    zChainMap.new_childc                 C   s   | j | jdd… Ž S )zNew ChainMap from maps[1:].r   Nrÿ   r�   r   r   r   ÚparentsJ  s    zChainMap.parentsc                 C   s   || j d |< d S )Nr   )rè   )r_   rV   rW   r   r   r   Ú__setitem__O  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__R  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  X  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_   rV   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  f  s    zChainMap.clear)N)r-   r.   r/   rb   ra   rë   rí   rP   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)rp   )re   Údebug_overrideÚsuffixr   r   r   r  p  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)rQ   r¬   Ú_OrderedDict__rootrÏ   Ú_OrderedDict__mapÚ_OrderedDict__update)r_   r˜   ÚkwdsÚrootr   r   r   ra   —  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_   rV   rW   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_   rV   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  rV   rW   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   ©rr   rV   r�   r   r   rx   õ  rw   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   rx   ù  rw   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)rQ   r¬   r   rù   Úhasattrr#  r&  )r˜   r  r_   ÚotherrV   rW   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_   rV   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   Ú
setdefault9  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   ©rr   r)  r�   r   r   rx   P  rw   z*OrderedDict.__reduce__.<locals>.<listcomp>N)Úvarsrþ   r  r  rý   )r_   r&  Ú	inst_dictr)  r   r�   r   Ú
__reduce__N  s    zOrderedDict.__reduce__c                 C   s
   |   | ¡S )z!od.copy() -> a shallow copy of od)rý   r�   r   r   r   rþ   X  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ü   rW   ÚdrV   r   r   r   rú   \  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  rQ   r&  rù   Ú__eq__©r_   r,  r   r   r   r6  g  s    
 zOrderedDict.__eq__c                 C   s
   | |k S r[   r   r7  r   r   r   Ú__ne__p  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   Úviewkeysu  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   Ú
viewvaluesy  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/   rb   ra   rù   r  r  rò   r  r  r  r#  r%  r&  r'  r   r*  r^   r  Úobjectr-  r  r.  rø   r4  rþ   r  rú   r6  r8  r9  r:  r;  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>   rO   )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 r[   )
rù   rí   ÚconfiguratorÚconvertr­   r@  ÚConvertingListÚConvertingTupleÚparentrV   ©r_   rV   rW   rÝ   r   r   r   rí   š  s    
ÿzConvertingDict.__getitem__Nc                 C   sL   t  | ||¡}| j |¡}||urH|| |< t|ƒtttfv rH| |_||_	|S r[   )
rù   rP   rA  rB  r­   r@  rC  rD  rE  rV   ©r_   rV   rÐ   rW   rÝ   r   r   r   rP   ¦  s    
ÿzConvertingDict.get)N)r-   r.   r/   rb   rí   rP   r   r   r   r   r@  —  s   r@  c                 C   sD   t  | ||¡}| j |¡}||ur@t|ƒtttfv r@| |_||_	|S r[   )
rù   r  rA  rB  r­   r@  rC  rD  rE  rV   rG  r   r   r   r  ²  s    
ÿr  c                   @   s"   e Zd ZdZdd„ Zddd„ZdS )	rC  zA converting list wrapper.c                 C   sJ   t  | |¡}| j |¡}||urF|| |< t|ƒtttfv rF| |_||_	|S r[   )
rç   rí   rA  rB  r­   r@  rC  rD  rE  rV   rF  r   r   r   rí   ¾  s    
ÿzConvertingList.__getitem__éÿÿÿÿc                 C   s<   t  | |¡}| j |¡}||ur8t|ƒtttfv r8| |_|S r[   )	rç   r  rA  rB  r­   r@  rC  rD  rE  )r_   ÚidxrW   rÝ   r   r   r   r  Ê  s    
ÿzConvertingList.popN)rH  )r-   r.   r/   rb   rí   r  r   r   r   r   rC  ¼  s   rC  c                   @   s   e Zd ZdZdd„ ZdS )rD  zA converting tuple wrapper.c                 C   sB   t  | |¡}| j |¡}||ur>t|ƒtttfv r>| |_||_	|S r[   )
Útuplerí   rA  rB  r­   r@  rC  rD  rE  rV   rF  r   r   r   rí   Õ  s    
ÿzConvertingTuple.__getitem__N)r-   r.   r/   rb   rí   r   r   r   r   rD  Ó  s   rD  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)rs   Úcfgc                 C   s   t |ƒ| _| | j_d S r[   )r@  ÚconfigrA  )r_   rN  r   r   r   ra   ó  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.
            r0   r   r   NzCannot resolve %r: %s)r2   r  Úimporterrã   rÏ   ÚImportErrorr}   r”   rO   Ú	__cause__Ú__traceback__)	r_   r   r‹   ÚusedÚfoundrG   ÚeÚtbÚvr   r   r   Úresolve÷  s"    



zBaseConfigurator.resolvec                 C   s
   |   |¡S )z*Default converter for the ext:// protocol.)rX  ©r_   rW   r   r   r   rK    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>   rO   ÚendrN  ÚgroupsÚDOT_PATTERNÚINDEX_PATTERNÚDIGIT_PATTERNÚintr¬   )r_   rW   Úrestró   r5  rI  Únr   r   r   rL    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ù   rA  rC  rç   rD  rJ  Ústring_typesÚCONVERT_PATTERNr>   Ú	groupdictÚvalue_convertersrP   rã   )r_   rW   ró   r5  rc  Ú	converterr  r   r   r   rB  4  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()r0   Nc                    s    g | ]}t |ƒr|ˆ | f‘qS r   )r>  r1  ©rN  r   r   rx   W  rw   z5BaseConfigurator.configure_custom.<locals>.<listcomp>)r  r£   rX  rù   r&  Úsetattr)r_   rN  r  Úpropsr`   rÝ   r‹   rW   r   ri  r   Úconfigure_customP  s    

z!BaseConfigurator.configure_customc                 C   s   t |tƒrt|ƒ}|S )z0Utility function which converts lists to tuples.)r   rç   rJ  rY  r   r   r   Úas_tuple^  s    
zBaseConfigurator.as_tupleN)r-   r.   r/   rb   r8   r;   re  rZ  r]  r^  r_  rg  ÚstaticmethodÚ
__import__rO  ra   rX  rK  rL  rB  rl  rm  r   r   r   r   r=  ß  s"   




þ"r=  )r   )rÙ   )N)N)�Ú
__future__r   rd   r8   r}   ÚsslrP  Úversion_infor   Ú
basestringrd  r   r©   Útypesr   Ú	file_typeÚ__builtin__ÚbuiltinsÚConfigParserÚconfigparserZ	_backportr   r   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,   rO   rI   rY   rZ   r<  rc   ÚF_OKÚX_OKÚzipfilerŒ   r–   r+  rŽ   ZBaseZipExtFiler~   r™   r    r£   Ú	NameErrorÚcollections.abcr¡   r°   r²   rÏ   Úgetfilesystemencodingrª   r«   Útokenizer³   Úcodecsr´   rµ   r;   rÃ   r¼   Úhtmlr9   ÚcgirÕ   ÚcollectionsrÖ   r×   ÚreprlibrØ   ræ   Úimportlib.utilr  Úimpr  ÚthreadrÛ   r/  Údummy_threadÚ_abcollr  r  r  rù   Úlogging.configr=  r>  ÚIr?  r@  r  rç   rC  rJ  rD  r   r   r   r   Ú<module>   s(  
$,(0
2+A


		
[
b
 w

