
    Uh                        d dl mZ d dlZd dlZd dlZd dlZ	 d dlZej                  d    dk  rd 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 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 nd 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 e7Z7	 d dlmHZHmIZI 	 d dlmLZM 	 d dlmOZO d dlRmSZT  eUeTd      reTZSnd dlRmVZW  G d  d!eW      ZV G d" d#eT      ZS	 d d$lXmYZY d dlZZZ	 e[Z[	 ej                  Z_ej                  Z`	 d d.lemfZf 	 d d3lmmnZn ej                  dd4 d5k  r e2       j                  Zpnd d6lmmpZp 	 d d7lqmrZr 	 d d=lwmxZx 	 d d?lqmyZy 	 d dDlmZmZ y# e$ r dZY w xY w# e$ r  G d deJ      ZIdPdZKd ZHY w xY w# e$ r  G d deN      ZMY w xY w# e$ r! ej                  ej                  z  dfdZOY w xY w# e$ r d% ZYY w xY w# e\$ r d d&l]m^Z^ d' Z[Y w xY w# ea$ r)  ej                         xs d(Zcecd)k(  rd*Zdnd+Zdd, Z_d- Z`Y w xY w# e$ r$ d d/lgmhZhmiZi  ej                  d0      Zkd1 Zld2 ZfY 5w xY w# e$ r
 d d3lomnZn Y @w xY w# e$ r, d d8lqmsZs 	 d d9ltmuZv n# e$ r dQd:ZvY nw xY w G d; d<es      ZrY Cw xY w# e$ r dRd>ZxY Lw xY w# e$ r? 	 d d@lzm{Z| n# e$ r	 d d@l}m{Z| Y nw xY w	 d dAl~mZmZmZ n# e$ r Y nw xY w G dB dCe      ZyY w xY w# e$ rT  ej                  dEej                        ZdF Z G dG dHe      ZdRdIZ G dJ dKe      Z G dL dMe      Z G dN dOeN      ZY yw xY w)S    )absolute_importN   )StringIO)FileType)urlparse
urlunparseurljoinurlsplit
urlunsplit)urlretrievequoteunquoteurl2pathnamepathname2urlContentTooShortError	splittypec                 Z    t        | t              r| j                  d      } t        |       S )Nutf-8)
isinstanceunicodeencode_quote)ss    T/var/www/html/IOPaint/env/lib/python3.12/site-packages/pip/_vendor/distlib/compat.pyr   r      s$    a!!Aay    )	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                       e Zd Zy)r,   N)__name__
__module____qualname__ r   r   r,   r,   ]   s    r   r,   c                    g }| sy| j                  d      }|d   |dd }}|j                  d      }||kD  rt        dt        |       z         |s!| j	                         |j	                         k(  S |dk(  r|j                  d       n{|j                  d	      s|j                  d	      r%|j                  t        j                  |             n4|j                  t        j                  |      j                  d
d             |D ]&  }|j                  t        j                  |             ( t        j                  ddj                  |      z   dz   t        j                        }	|	j                  |      S )zpMatching according to RFC 6125, section 6.4.3

        http://tools.ietf.org/html/rfc6125#section-6.4.3
        F.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pats
             r   _dnsname_matchrM   `   sI   
 #Ahab	)NN3'	}$
 #>bIK K 88:!111
 s? KK   (H,?,?,G
 KK		(+, KK		(+33E7CD  	)DKK		$(	) jjD!11E92==Iyy""r   c                    | st        d      g }| j                  dd      }|D ]*  \  }}|dk(  st        ||      r y|j                  |       , |sG| j                  dd      D ]2  }|D ]+  \  }}|dk(  st        ||      r  y|j                  |       - 4 t	        |      dkD  r.t        d	|d
dj                  t        t        |                  t	        |      dk(  rt        d	|d|d         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subjectAltNamer1   DNSNsubject
commonNamer4   z	hostname z doesn't match either of , z doesn't match r   z=no appropriate commonName or subjectAltName fields were found)	
ValueErrorgetrM   r:   lenr,   r@   mapr8   )certrD   dnsnamessankeyvaluesubs          r   r+   r+      s3     > ? ? hh', 	'JCe|!%2&		'
  xx	2. /"% /JC l*)%:" .// x=1"$,diiD(8K.L$N O O ]a"$,hqk$; < < # $F G Gr   )SimpleNamespacec                       e Zd ZdZd Zy)	ContainerzR
        A generic container for when multiple values need to be returned
        c                 :    | j                   j                  |       y N__dict__update)selfkwargss     r   __init__zContainer.__init__   s    MM  (r   N)r.   r/   r0   __doc__rh   r1   r   r   r`   r`      s    		)r   r`   )whichc                 h    d }t         j                  j                         r | |      r S y|.t         j                  j	                  dt         j
                        }|sy|j                  t         j                        }t        j                  dk(  rt         j                  |vr |j                  dt         j                         t         j                  j	                  dd      j                  t         j                        }t         fd|D              r g}n|D cg c]  } |z   	 }}n g}t               }|D ]m  }t         j                  j                  |      }	|	|vs'|j                  |	       |D ]1  }
t         j                  j!                  ||
      } |||      s-|c c S  o yc c}w )	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                     t         j                  j                  |       xr8 t        j                  | |      xr  t         j                  j	                  |        S rb   )ospathexistsaccessisdir)fnmodes     r   _access_checkzwhich.<locals>._access_check   sA    GGNN2& .299R+> .GGMM"--/r   NPATHwin32r   PATHEXT c              3   x   K   | ]1  }j                         j                  |j                                3 y wrb   )r9   endswith).0extcmds     r   	<genexpr>zwhich.<locals>.<genexpr>   s(     H399;''		4Hs   7:)rm   rn   dirnameenvironrU   defpathr6   pathsepsysplatformcurdirinsertanysetnormcaseaddr@   )r}   rs   rn   rt   pathextfilesr|   seendirnormdirthefilenames   `           r   rj   rj      sa   	/ 77??3S$'
<::>>&"**5Dzz"**%<<7"yy$Aryy) jjnnY399"**EG
 HHH.56ss66 EEu 	$Cgg&&s+Gd"!$ $G77<<W5D$T40#$		$  7s    F/)ZipFile	__enter__)
ZipExtFilec                       e Zd Zd Zd Zd Zy)r   c                 N    | j                   j                  |j                          y rb   rc   )rf   bases     r   rh   zZipExtFile.__init__  s    MM  /r   c                     | S rb   r1   rf   s    r   r   zZipExtFile.__enter__      Kr   c                 $    | j                          y rb   closerf   exc_infos     r   __exit__zZipExtFile.__exit__      JJLr   N)r.   r/   r0   rh   r   r   r1   r   r   r   r     s    	0		r   r   c                       e Zd Zd Zd Zd Zy)r   c                     | S rb   r1   r   s    r   r   zZipFile.__enter__$  r   r   c                 $    | j                          y rb   r   r   s     r   r   zZipFile.__exit__'  r   r   c                 J    t        j                  | g|i |}t        |      S rb   )BaseZipFileopenr   )rf   argsrg   r   s       r   r   zZipFile.open+  s'    ##D:4:6:Dd##r   N)r.   r/   r0   r   r   r   r1   r   r   r   r   "  s    			$r   r   )python_implementationc                      dt         j                  v ryt        j                  dk(  ryt         j                  j	                  d      ryy)z6Return a string identifying the Python implementation.PyPyjavaJython
IronPythonCPython)r   versionrm   r   r;   r1   r   r   r   r   4  s8    S[[ 77f;;!!,/r   )Callablec                 "    t        | t              S rb   )r   r   )objs    r   callabler   F  s    #x((r   r   mbcsstrictsurrogateescapec                     t        | t              r| S t        | t              r| j                  t        t
              S t        dt        |       j                  z        Nzexpect bytes or str, not %s)	r   bytes	text_typer   _fsencoding	_fserrors	TypeErrortyper.   filenames    r   fsencoder   Z  sN    h&O),??;	::9 N334 5 5r   c                     t        | t              r| S t        | t              r| j                  t        t
              S t        dt        |       j                  z        r   )	r   r   r   decoder   r   r   r   r.   r   s    r   fsdecoder   c  sN    h	*O%(??;	::9 N334 5 5r   )detect_encoding)BOM_UTF8lookupzcoding[:=]\s*([-\w.]+)c                     | dd j                         j                  dd      }|dk(  s|j                  d      ry|dv s|j                  d      ry	| 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   )r9   r>   r;   )orig_encencs     r   _get_normal_namer   t  sX     sm!!#++C5'>S^^H5::>>EFr   c                 6    	  j                   j                  dd}d} fd}fd} |       }|j                  t              r	d|dd }d}|s|g fS  ||      }|r||gfS  |       }|s||gfS  ||      }|r|||gfS |||gfS # t        $ r dY |w xY w)	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                  2    	          S # t         $ r Y yw xY w)Nr   )StopIteration)readlines   r   read_or_stopz%detect_encoding.<locals>.read_or_stop  s"    z!  s   
 	c                    	 | j                  d      }t        j                  |      }|sy t        |d         }	 t        |      }r?|j                  dk7  r+d}t        |      dj                        }t        |      |d	z  }|S # t        $ r" d}dj                  |      }t        |      w xY w# t        $ r0 d|z   }t        |      dj                  |      }t        |      w xY w)
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   s         r   find_cookiez$detect_encoding.<locals>.find_cookie  s.   	' #kk'2  ''4G'
3H	'x( ::('7 &c** AGG$&%c**F"O? & '?''..sH=C!#&&	'  '#.9C "#&& :@@ (,C!#&&'s   B	 B7 	+B479C0Tr   z	utf-8-sig)__self__r   AttributeErrorr;   r   )	r   r   defaultr   r   firstsecondr   r   s	   `      @@r   r   r     s    "	((--H 		%	N H%I!"IE!GB;u%eW$$UG##v&eV_,,''O  	H	s   B
 
BB)r=      )r      )unescape)ChainMap)MutableMapping)recursive_reprc                       fd}|S )zm
            Decorator to make a repr function return fillvalue for a recursive
            call
            c                      t                fd}t         d      |_        t         d      |_        t         d      |_        t         di       |_        |S )Nc                     t        |       t               f}|v rS j                  |       	  |       }j                  |       |S # j                  |       w xY wrb   )id	get_identr   discard)rf   r[   result	fillvaluerepr_runninguser_functions      r   wrapperz=_recursive_repr.<locals>.decorating_function.<locals>.wrapper  sc    T(IK/Cl*(( $$S)2!.t!4$,,S1!M %,,S1s   A
 
Ar/   ri   r.   __annotations__)r   getattrr/   ri   r.   r   )r   r   r   r   s   ` @r   decorating_functionz,_recursive_repr.<locals>.decorating_function  sW    "u	" &-]L%I"")-"C#*=*#E *1-2CR+I'r   r1   )r   r   s   ` r   _recursive_reprr     s    , '&r   c                       e Zd ZdZd Zd Zd ZddZd Zd Z	d	 Z
d
 Z e       d        Zed        Zd ZeZd Zed        Zd Zd Zd Zd Zd Zy)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                 .    t        |      xs i g| _        y)zInitialize a ChainMap by setting *maps* to the given mappings.
            If no mappings are provided, a single empty dictionary is used.

            N)listmaps)rf   r  s     r   rh   zChainMap.__init__  s    
 T
*rdDIr   c                     t        |      rb   )KeyErrorrf   r[   s     r   __missing__zChainMap.__missing__!  s    3-r   c                 r    | j                   D ]	  }	 ||   c S  | j                  |      S # t        $ r Y (w xY wrb   )r  r  r  )rf   r[   mappings      r   __getitem__zChainMap.__getitem__$  sV    99 "  ##    s   *	66Nc                     || v r| |   S |S rb   r1   rf   r[   r   s      r   rU   zChainMap.get.  s     #t4988r   c                 V    t         t               j                  | j                         S rb   )rV   r   unionr  r   s    r   __len__zChainMap.__len__1  s%    {su{{  r   c                 V    t         t               j                  | j                         S rb   )iterr   r  r  r   s    r   __iter__zChainMap.__iter__5  s    TYY/00r   c                 @    t        fd| j                  D              S )Nc              3   &   K   | ]  }|v  
 y wrb   r1   )r{   mr[   s     r   r~   z(ChainMap.__contains__.<locals>.<genexpr>9  s     3Asax3s   r   r  r  s    `r   __contains__zChainMap.__contains__8  s    3333r   c                 ,    t        | j                        S rb   r  r   s    r   __bool__zChainMap.__bool__;  s    tyy>!r   c           	      t    dj                  | dj                  t        t        | j                                    S )Nz{0.__class__.__name__}({1})rS   )r   r@   rW   r8   r  r   s    r   __repr__zChainMap.__repr__>  s.    077diiD$)) 457 7r   c                 :     | t        j                  |g|       S )z?Create a ChainMap with a single dict created from the iterable.)dictfromkeys)clsiterabler   s      r   r  zChainMap.fromkeysC  s     t}}X5566r   c                 x     | j                   | j                  d   j                         g| j                  dd  S )zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r   r4   N)	__class__r  copyr   s    r   r"  zChainMap.copyH  s3    !4>>$))A,"3"3"5F		!"FFr   c                 <     | j                   i g| j                   S )z;New ChainMap with a new dict followed by all previous maps.r!  r  r   s    r   	new_childzChainMap.new_childN  s    !4>>"1tyy11r   c                 :     | j                   | j                  dd  S )zNew ChainMap from maps[1:].r4   Nr$  r   s    r   parentszChainMap.parentsR  s     "4>>499QR=11r   c                 (    || j                   d   |<   y )Nr   )r  )rf   r[   r\   s      r   __setitem__zChainMap.__setitem__W  s     %DIIaLr   c                 t    	 | j                   d   |= y # t        $ r t        dj                  |            w xY w)Nr   (Key not found in the first mapping: {!r})r  r  r   r  s     r   __delitem__zChainMap.__delitem__Z  sF    LIIaL% L>EEcJL LLs    $7c                 n    	 | j                   d   j                         S # t        $ r t        d      w xY 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   s    r   r.  zChainMap.popitema  s<    Fyy|++-- FDEEFs    4c                     	  | j                   d   j                  |g| S # t        $ r t        dj                  |            w xY w)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r   r+  )r  popr  r   )rf   r[   r   s      r   r0  zChainMap.poph  sV    L'tyy|''3d33 L>EEcJL LLs	   " $Ac                 >    | j                   d   j                          y)z'Clear maps[0], leaving maps[1:] intact.r   N)r  clearr   s    r   r2  zChainMap.clearp  s    IIaL r   rb   )r.   r/   r0   ri   rh   r  r	  rU   r  r  r  r  r   r  classmethodr  r"  __copy__r%  propertyr'  r)  r,  r.  r0  r2  r1   r   r   r   r     s    
		+	 		9		1	4	" 
		7 
	7 
	7 
	7	G 	2 
	2 
	2	&	L	F	L	!r   r   )cache_from_sourcec                 P    | j                  d      sJ |d}|rd}| |z   S d}| |z   S )Nz.pyTco)rz   )rn   debug_overridesuffixs      r   r6  r6  y  sD    }}U###!&NF f} Ff}r   )OrderedDict)r   )KeysView
ValuesView	ItemsViewc                       e Zd ZdZd Zej                  fdZej                  fdZd Zd Z	d Z
ddZd	 Zd
 Zd Zd Zd Zd Zd ZeZ e       ZefdZddZddZd Zd Zedd       Zd Zd Zd Zd Z d Z!y)r<  z)Dictionary that remembers insertion orderc                     t        |      dkD  rt        dt        |      z        	 | j                    | j
                  |i | y# t        $ r g x| _        }||dg|dd i | _        Y 6w xY w)zInitialize an ordered dictionary.  Signature is the same as for
            regular dictionaries, but keyword arguments are not recommended
            because their insertion order is arbitrary.

            r4   z$expected at most 1 arguments, got %dN)rV   r   _OrderedDict__rootr   _OrderedDict__map_OrderedDict__update)rf   r   kwdsroots       r   rh   zOrderedDict.__init__  s     4y1} F #D	!* + + 
 DMM4(4(	 "  %''dt,Q
 s   A !A*)A*c                 z    || vr-| j                   }|d   }|||gx|d<   x|d<   | j                  |<    || ||       y)z!od.__setitem__(i, y) <==> od[i]=yr   r4   N)rB  rC  )rf   r[   r\   dict_setitemrF  lasts         r   r)  zOrderedDict.__setitem__  sO     ${{Aw7;T36GGQG$q'DJJsOsE*r   c                 h     || |       | j                   j                  |      \  }}}||d<   ||d<   y)z od.__delitem__(y) <==> del od[y]r4   r   N)rC  r0  )rf   r[   dict_delitem	link_prev	link_nexts        r   r,  zOrderedDict.__delitem__  s9     s#(,

s(;%Iy#$IaL$IaLr   c              #   Z   K   | j                   }|d   }||ur|d    |d   }||uryyw)zod.__iter__() <==> iter(od)r4   r   NrB  rf   rF  currs      r   r  zOrderedDict.__iter__  <     ;;D7Dd"1gAw d"   &++c              #   Z   K   | j                   }|d   }||ur|d    |d   }||uryyw)z#od.__reversed__() <==> reversed(od)r   r   NrO  rP  s      r   __reversed__zOrderedDict.__reversed__  rR  rS  c                     	 | j                   j                         D ]  }|dd= 	 | j                  }||dg|dd | j                   j                          t
        j                  |        y# t        $ r Y !w xY w)z.od.clear() -> None.  Remove all items from od.N)rC  
itervaluesrB  r2  r   r  )rf   noderF  s      r   r2  zOrderedDict.clear  su     JJ113  DQ {{t,Q

  " JJt " s   AA* *	A65A6c                     | st        d      | j                  }|r|d   }|d   }||d<   ||d<   n|d   }|d   }||d<   ||d<   |d   }| j                  |= t        j	                  | |      }||fS )zod.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   r4   r   )r  rB  rC  r  r0  )rf   rI  rF  linkrL  rM  r[   r\   s           r   r.  zOrderedDict.popitem  s    
 455;;DAw G	#	!#QAw G	#Q#	!q'C

3HHT3'E:r   c                     t        |       S )zod.keys() -> list of keys in od)r  r   s    r   keyszOrderedDict.keys      :r   c                 2    | D cg c]  }| |   	 c}S c c}w )z#od.values() -> list of values in odr1   r  s     r   valueszOrderedDict.values  s    )-.#DI...s   c                 6    | D cg c]	  }|| |   f c}S c c}w )z.od.items() -> list of (key, value) pairs in odr1   r  s     r   itemszOrderedDict.items  s    045S$s)$555s   c                     t        |       S )z0od.iterkeys() -> an iterator over the keys in od)r  r   s    r   iterkeyszOrderedDict.iterkeys  r]  r   c              #   (   K   | D ]	  }| |     yw)z2od.itervalues -> an iterator over the values in odNr1   rf   ks     r   rW  zOrderedDict.itervalues
  s      1gs   c              #   ,   K   | D ]  }|| |   f  yw)z=od.iteritems -> an iterator over the (key, value) items in odNr1   re  s     r   	iteritemszOrderedDict.iteritems  s#      #$q'l"#s   c                     t        |       dkD  rt        dt        |       fz        | st        d      | d   }d}t        |       dk(  r| d   }t        |t              r|D ]
  }||   ||<    n9t	        |d      r|j                         D ]
  }||   ||<    n|D ]
  \  }}|||<    |j                         D ]
  \  }}|||<    y)	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   r1   r4   r\  N)rV   r   r   r  hasattrr\  ra  )r   rE  rf   otherr[   r\   s         r   re   zOrderedDict.update  s     4y1} !7:=d)!G H H NOO7DE4yA~Q%&  +C %c
DI+' ::< +C %c
DI+ #( &JC %DI&"jjl "
U!S	"r   c                 T    || v r
| |   }| |= |S || j                   u rt        |      |S )zod.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  )rf   r[   r   r   s       r   r0  zOrderedDict.pop7  s;    
 d{cI$--'sm#Nr   Nc                 "    || v r| |   S || |<   |S )zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr1   r  s      r   
setdefaultzOrderedDict.setdefaultD  s!    d{Cy DINr   c                     |si }t        |       t               f}||v ryd||<   	 | s| j                  j                  d||= S | j                  j                  d| j	                         d||= S # ||= w xY w)zod.__repr__() <==> repr(od)...r4   ()())r   
_get_identr!  r.   ra  )rf   _repr_runningcall_keys      r   r  zOrderedDict.__repr__K  s|      "$x-H=(&'M(#,%)^^%<%<? "(+ $(>>#:#:DJJLI!(+M(+s   A0 )A0 0A5c                     | D cg c]	  }|| |   g }}t        |       j                         }t        t                     D ]  }|j                  |d        |r| j                  |f|fS | j                  |ffS c c}w )z%Return state information for picklingN)varsr"  r<  r0  r!  )rf   rf  ra  	inst_dicts       r   
__reduce__zOrderedDict.__reduce__Z  s}    +/0aaa\0E0T
)I+-( 'a&'	9==>>E9,, 1s   A9c                 $    | j                  |       S )z!od.copy() -> a shallow copy of od)r!  r   s    r   r"  zOrderedDict.copyd  s    >>$''r   c                 ,     |        }|D ]  }|||<   	 |S )zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S
            and values equal to v (which defaults to None).

            r1   )r  r  r\   dr[   s        r   r  zOrderedDict.fromkeysh  s(     A #Hr   c                     t        |t              r:t        |       t        |      k(  xr! | j                         |j                         k(  S t        j                  | |      S )zod.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
            while comparison to a regular mapping is order-insensitive.

            )r   r<  rV   ra  r  __eq__rf   rk  s     r   r  zOrderedDict.__eq__s  sS    
 %-4yC%  =#zz|u{{}<=;;tU++r   c                     | |k(   S rb   r1   r  s     r   __ne__zOrderedDict.__ne__}  s    u}$$r   c                     t        |       S )z@od.viewkeys() -> a set-like object providing a view on od's keys)r=  r   s    r   viewkeyszOrderedDict.viewkeys  s    D>!r   c                     t        |       S )z<od.viewvalues() -> an object providing a view on od's values)r>  r   s    r   
viewvalueszOrderedDict.viewvalues  s    d##r   c                     t        |       S )zBod.viewitems() -> a set-like object providing a view on od's items)r?  r   s    r   	viewitemszOrderedDict.viewitems  s    T?"r   )Trb   )"r.   r/   r0   ri   rh   r  r)  r,  r  rU  r2  r.  r\  r_  ra  rc  rW  rh  re   rD  objectrm  r0  ro  r  r{  r"  r3  r  r  r  r  r  r  r1   r   r   r<  r<    s    3	)" 8<7G7G 	+ 150@0@ 	%		
		2		/	6		
	#
	"> 8#+ 			,	-	( 
	 
		,	%
	"	$	#r   r<  )BaseConfiguratorvalid_identz^[a-z_][a-z0-9_]*$c                 N    t         j                  |       }|st        d| z        y)Nz!Not a valid Python identifier: %rT)
IDENTIFIERrB   rT   )r   r  s     r   r  r    s)    Q@1DEEr   c                       e Zd ZdZd ZddZy)ConvertingDictz A converting dictionary wrapper.c                     t         j                  | |      }| j                  j                  |      }||ur/|| |<   t	        |      t
        t        t        fv r| |_        ||_	        |S rb   )
r  r	  configuratorconvertr   r  ConvertingListConvertingTupleparentr[   rf   r[   r\   r   s       r   r	  zConvertingDict.__getitem__  f    $$T3/E&&..u5FF""S	<NN$3$5 5$(FM!$FJMr   Nc                     t         j                  | ||      }| j                  j                  |      }||ur/|| |<   t	        |      t
        t        t        fv r| |_        ||_	        |S rb   )
r  rU   r  r  r   r  r  r  r  r[   rf   r[   r   r\   r   s        r   rU   zConvertingDict.get  sf    HHT30E&&..u5FF""S	<NN$3$5 5$(FM!$FJMr   rb   )r.   r/   r0   ri   r	  rU   r1   r   r   r  r    s    .
	
	r   r  c                     t         j                  | ||      }| j                  j                  |      }||ur*t	        |      t
        t        t        fv r| |_        ||_	        |S rb   )
r  r0  r  r  r   r  r  r  r  r[   r  s        r   r0  r0    s]    sG,""**51F| / 1 1 $ 
r   c                       e Zd ZdZd ZddZy)r  zA converting list wrapper.c                     t         j                  | |      }| j                  j                  |      }||ur/|| |<   t	        |      t
        t        t        fv r| |_        ||_	        |S rb   )
r  r	  r  r  r   r  r  r  r  r[   r  s       r   r	  zConvertingList.__getitem__  r  r   c                     t         j                  | |      }| j                  j                  |      }||ur#t	        |      t
        t        t        fv r| |_        |S rb   )	r  r0  r  r  r   r  r  r  r  )rf   idxr\   r   s       r   r0  zConvertingList.pop  sT    HHT3'E&&..u5FF"<NN$3$5 5$(FMMr   N))r.   r/   r0   ri   r	  r0  r1   r   r   r  r    s    (
		r   r  c                       e Zd ZdZd Zy)r  zA converting tuple wrapper.c                     t         j                  | |      }| j                  j                  |      }||ur*t	        |      t
        t        t        fv r| |_        ||_	        |S rb   )
tupler	  r  r  r   r  r  r  r  r[   r  s       r   r	  zConvertingTuple.__getitem__  s]    %%dC0E&&..u5FF"<NN$3$5 5$(FM!$FJMr   N)r.   r/   r0   ri   r	  r1   r   r   r  r    s
    )	r   r  c                      e Zd ZdZ ej
                  d      Z ej
                  d      Z ej
                  d      Z ej
                  d      Z	 ej
                  d      Z
ddd	Z ee      Zd
 Zd Zd Zd Zd Zd Zd Zy)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)r|   cfgc                 F    t        |      | _        | | j                  _        y rb   )r  configr  )rf   r  s     r   rh   zBaseConfigurator.__init__  s    (0DK'+DKK$r   c                    |j                  d      }|j                  d      }	 | j                  |      }|D ]  }|d|z   z  }	 t        ||      } |S # t        $ r  | j                  |       t        ||      }Y Dw xY w# t
        $ r= t        j                         dd \  }}t        d|d|      }||c|_	        |_
        |w xY w)zl
            Resolve strings to objects using standard import and attribute
            syntax.
            r3   r   r4   NzCannot resolve z: )r6   r0  importerr   r   ImportErrorr   r   rT   	__cause____traceback__)	rf   r   r   usedfoundrK   etbvs	            r   resolvezBaseConfigurator.resolve  s    
 773<D88A;Dd+  5DC$J&D5 't 45  * 5d+ 't 45  qr*2!Q?@/0",Q_	s0   A? AA? &A<9A? ;A<<A? ?ACc                 $    | j                  |      S )z*Default converter for the ext:// protocol.)r  rf   r\   s     r   r  zBaseConfigurator.ext_convert  s    <<&&r   c                 r   |}| j                   j                  |      }|t        d|z        ||j                         d }| j                  |j                         d      }|r| j                  j                  |      }|r||j                         d      }nb| j                  j                  |      }|rE|j                         d   }| j                  j                  |      s||   }n	 t        |      }||   }|r||j                         d }nt        d|d|      |r|S # t        $ r ||   }Y <w xY w)z*Default converter for the cfg:// protocol.NzUnable to convert %rr   zUnable to convert z at )WORD_PATTERNrB   rT   endr  groupsDOT_PATTERNINDEX_PATTERNDIGIT_PATTERNintr   )rf   r\   restr  r~  r  ns          r   r  zBaseConfigurator.cfg_convert   sD   D!!''-Ay !7%!?@@AEEGH~KK
1.((..t4Aahhjm, ..44T:"#((*Q-C#'#5#5#;#;C#@$%cF!/(+(+)&A )*!A #AEEGH~(7<d*D E E+ 0 H (1 !/()#A!/s   )D% %D65D6c                 0   t        |t              s$t        |t              rt        |      }| |_        |S t        |t              s$t        |t
              rt	        |      }| |_        |S t        |t              s$t        |t              rt        |      }| |_        |S t        |t              ri| j                  j                  |      }|rL|j                         }|d   }| j                  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  r  string_typesCONVERT_PATTERNrB   	groupdictvalue_convertersrU   r   )rf   r\   r  r~  r  	converterr;  s          r   r  zBaseConfigurator.convertC  s
    e^44:!&u-%)"$ L#  ~6:4<!&u-%)" L  7Jue<T'.%)" L E<0((..u5Ax[F $ 5 5 9 9&$ GI !"8$+D)$<	 )& 1Lr   c                 @   |j                  d      }t        |      s| j                  |      }|j                  dd      }t        |D cg c]  }t	        |      s|||   f c}      } |di |}|r%|j                         D ]  \  }}t        |||        |S c c}w )z1Configure an object with a user-supplied factory.rr  r3   Nr1   )r0  r   r  r  r  ra  setattr)	rf   r  r8  propsrf  rg   r   r   r\   s	            r   configure_customz!BaseConfigurator.configure_custom`  s    

4 AA;LLOJJsD)E6La[^Avay>LMF[[F#(;;= 1KD%FD%01M Ms   	B	Bc                 <    t        |t              rt        |      }|S )z0Utility function which converts lists to tuples.)r   r  r  r  s     r   as_tuplezBaseConfigurator.as_tuplen  s    %&eLr   N)r.   r/   r0   ri   r<   r?   r  r  r  r  r  r  staticmethod
__import__r  rh   r  r  r  r  r  r  r1   r   r   r  r    s    	 %"**%MN!rzz/2 bjj!23"

#9:"

8, ! 
  
+	,	.	'!	F	:		r   r  )r4   )rq  rb   )
__future__r   rm   r<   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,   rT   rM   r^   r`   r  rj   F_OKX_OKzipfiler   r   rj  r   BaseZipExtFiler   r   	sysconfigr   	NameErrorcollections.abcr   r   r   r   getfilesystemencodingr   r   tokenizer   codecsr   r   r?   r   r   htmlr=   cgir   collectionsr   r   reprlibr   r   importlib.utilr6  r<  threadr   ru  dummy_thread_abcollr=  r>  r?  r  logging.configr  r  Ir  r  r0  r  r  r  r  r1   r   r   <module>r     s:   ' 	 	  
 A!;LI+"'LLG G G
 < < < (%I+5  4LI-? ? ?C C C /FF!$%&*I%F`G4D
)2AJ +
;$G4	^ 	$+ $. )H 5{{H{{HBl((^ BQ& |$$HL!$\0H#'Tc<<A  
CV  ^G: /#b(Gm^GF  ))F ))  ?"'') =?N  

"  )())  5 ,#++-8Kf	%	55-5D  j('

45I	Z(!j(`    J!* '= '	''@e!> e!KJ!^  

  F#92 989;; x#d x#F#V  a0"$$7J 6 0% E6 EyasV  G7 5H >H" H8 :I! I/ J !J4 (K  K2  L& 'L6 .M= 7HHHH"H54H58"II!I,+I,/J ?J *J10J14%KK K/.K/2L#>LL#	LL#LL#"L#&	L32L36M:<MM:MM:MM:
M M: M(%M:'M((M:9M:=AOO