Ñò
•èRc        
   @` s³   d  d k  l Z l Z l Z d  d k l Z d  d k Z d d k l Z d d k l	 Z	 d d k l
 Z
 d d	 k
 l Z d d
 k l Z e i d ƒ Z e d „ Z e e ƒ Z d S(   i    (   t   absolute_importt   divisiont   unicode_literals(   t	   text_typeNi   (   t   _basei   (   t   ihatexml(   t	   constants(   t
   namespaces(   t   moduleFactoryFactoryu   {([^}]*)}(.*)c         ` s  ˆ ‰	 ˆ	 i  d ƒ i ‰ d t i f ‡	 f d †  ƒ  Y‰ d ˆ f ‡	 f d †  ƒ  Y‰  d ˆ f ‡ f d †  ƒ  Y‰ d ˆ f ‡ f d	 †  ƒ  Y‰ d
 ˆ f ‡ f d †  ƒ  Y‰ ‡ f d †  ‰ ‡ ‡	 f d †  } d t i f ‡  ‡ ‡ ‡ ‡ ‡ ‡ ‡ f d †  ƒ  Y} t ƒ  S(   Nu   asdt   Elementc           ` sé   e  Z d ‡  f d  † Z d „  Z d „  Z d „  Z e e e ƒ Z d „  Z	 d „  Z
 e e
 e	 ƒ Z d „  Z d „  Z e e e ƒ Z d „  Z d	 „  Z e e e ƒ Z d
 „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z d „  Z RS(   c         ` s‹   | |  _  | |  _ ˆ  i |  i | | ƒ ƒ |  _ | d  j o t d |  i  f |  _ n |  i |  i  f |  _ d  |  _ g  |  _	 g  |  _
 d  S(   Nu   html(   t   _namet
   _namespaceR	   t   _getETreeTagt   _elementt   NoneR   t	   nameTuplet   parentt   _childNodest   _flags(   t   selft   namet	   namespace(   t   ElementTree(    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   __init__   s    				c         S` s+   | d  j o
 | } n d | | f } | S(   Nu   {%s}%s(   R   (   R   R   R   t	   etree_tag(    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyR   !   s    
c         S` s+   | |  _  |  i |  i  |  i ƒ |  i _ d  S(   N(   R
   R   R   R   t   tag(   R   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setName(   s    	c         S` s   |  i  S(   N(   R
   (   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getName,   s    c         S` s+   | |  _  |  i |  i |  i  ƒ |  i _ d  S(   N(   R   R   R
   R   R   (   R   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setNamespace1   s    	c         S` s   |  i  S(   N(   R   (   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getNamespace5   s    c         S` s
   |  i  i S(   N(   R   t   attrib(   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getAttributes:   s    c         S` s–   x- t  |  i i i ƒ  ƒ D] } |  i i | =q Wx_ | i ƒ  D]Q \ } } t | t ƒ o d | d | d f } n | } |  i i | | ƒ q= Wd  S(   Nu   {%s}%si   i   (   t   listR   R   t   keyst   itemst
   isinstancet   tuplet   set(   R   t
   attributest   keyt   valueR   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setAttributes=   s      c         S` s   |  i  S(   N(   R   (   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getChildNodesK   s    c         S` s2   |  i  2g  |  _ x | D] } |  i | ƒ q Wd  S(   N(   R   R   t   insertChild(   R   R(   t   element(    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setChildNodesN   s
    	 c         S` s    t  |  i i p t |  i ƒ ƒ S(   u,   Return true if the node has children or text(   t   boolR   t   textt   len(   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt
   hasContentV   s    c         S` s0   |  i  i | ƒ |  i i | i ƒ |  | _ d  S(   N(   R   t   appendR   R   (   R   t   node(    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   appendChildZ   s    c         S` s>   t  |  i ƒ i | i ƒ } |  i i | | i ƒ |  | _ d  S(   N(   R    R   t   indext   insertR   (   R   R3   t   refNodeR5   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   insertBefore_   s    c         S` s    |  i  i | i  ƒ d  | _ d  S(   N(   R   t   removeR   R   (   R   R3   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   removeChildd   s    c         S` s;  t  |  i ƒ p3 |  i i p d |  i _ n |  i i | 7_ nõ | d  j o? |  i d i p d |  i d _ n |  i d i | 7_ n© t |  i ƒ } | i | i ƒ } | d j oK |  i | d i p d |  i | d _ n |  i | d i | 7_ n0 |  i i p d |  i _ n |  i i | 7_ d  S(   Nu    iÿÿÿÿi    i   (   R0   R   R/   R   t   tailR    R5   (   R   t   dataR8   t   childrenR5   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt
   insertTexth   s"    c         S` sL   t  |  ƒ |  i |  i ƒ } x* |  i i ƒ  D] \ } } | | i | <q+ W| S(   N(   t   typeR   R   R&   R"   (   R   R,   R   R(   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt	   cloneNode   s
     c         S` sœ   | i  o# | i  d i i |  i i 7_ nM | i i p d | i _ n |  i i d  j	 o | i i |  i i 7_ n d |  i _ t i i |  | ƒ d  S(   Niÿÿÿÿu    (   t
   childNodesR   R;   R/   R   R   t   Nodet   reparentChildren(   R   t	   newParent(    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRC   …   s    
#N(   t   __name__t
   __module__R   R   R   R   R   t   propertyR   R   R   R   R   R)   R&   R*   R-   RA   R1   R4   R8   R:   R>   R@   RC   (    (   R   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyR	      s*   														t   Commentc           ` s8   e  Z ‡  f d  †  Z d „  Z d „  Z e e e ƒ Z RS(   c         ` s1   ˆ  i  | ƒ |  _ d  |  _ g  |  _ g  |  _ d  S(   N(   RH   R   R   R   R   R   (   R   R<   (   R   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyR   ‘   s    		c         S` s
   |  i  i S(   N(   R   R/   (   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getData™   s    c         S` s   | |  i  _ d  S(   N(   R   R/   (   R   R(   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setDataœ   s    (   RE   RF   R   RI   RJ   RG   R<   (    (   R   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRH      s   		t   DocumentTypec           ` sY   e  Z ‡  f d  †  Z d „  Z d „  Z e e e ƒ Z d „  Z d „  Z e e e ƒ Z	 RS(   c         ` s2   ˆ  i  |  d ƒ | |  i _ | |  _ | |  _ d  S(   Nu
   <!DOCTYPE>(   R   R   R/   t   publicIdt   systemId(   R   R   RL   RM   (   R	   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyR   ¢   s    	c         S` s   |  i  i d d ƒ S(   Nu   publicIdu    (   R   t   get(   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getPublicId¨   s    c         S` s(   | d  j	 o |  i i d | ƒ n d  S(   Nu   publicId(   R   R   R%   (   R   R(   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setPublicId«   s    c         S` s   |  i  i d d ƒ S(   Nu   systemIdu    (   R   RN   (   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _getSystemId±   s    c         S` s(   | d  j	 o |  i i d | ƒ n d  S(   Nu   systemId(   R   R   R%   (   R   R(   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   _setSystemId´   s    (
   RE   RF   R   RO   RP   RG   RL   RQ   RR   RM   (    (   R	   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRK   ¡   s   				t   Documentc           ` s   e  Z ‡  f d  †  Z RS(   c         ` s   ˆ  i  |  d ƒ d  S(   Nu   DOCUMENT_ROOT(   R   (   R   (   R	   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyR   »   s    (   RE   RF   R   (    (   R	   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRS   º   s   t   DocumentFragmentc           ` s   e  Z ‡  f d  †  Z RS(   c         ` s   ˆ  i  |  d ƒ d  S(   Nu   DOCUMENT_FRAGMENT(   R   (   R   (   R	   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyR   ¿   s    (   RE   RF   R   (    (   R	   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRT   ¾   s   c         ` s8   g  ‰  d ‡  ‡ ‡ f d † ‰ ˆ |  d ƒ d i  ˆ  ƒ S(   Ni    c         ` s§  t  |  d ƒ p |  i ƒ  }  n |  i d j oˆ |  i d ƒ p |  i d ƒ oM |  i d ƒ p d } |  i d ƒ p d } ˆ  i d |  i | | f ƒ qKˆ  i d |  i f ƒ n”|  i d j o— ˆ  i d	 ƒ |  i d  j	 o& ˆ  i d
 d | d |  i f ƒ n |  i d  j	 o t d ƒ ‚ n t  |  d ƒ o  t	 |  i
 ƒ o t d ƒ ‚ qKní|  i ˆ j o" ˆ  i d d | |  i f ƒ n»t |  i t ƒ p  t d t |  i ƒ |  i f ‚ t i |  i ƒ } | d  j o |  i } n0 | i ƒ  \ } } t i | } d | | f } ˆ  i d d | | f ƒ t  |  d ƒ oÑ g  } x… |  i
 i ƒ  D]t \ } }	 t i | ƒ } | d  j	 o3 | i ƒ  \ } } t i | } d | | f }
 n | }
 | i |
 |	 f ƒ q`Wx@ t | ƒ D]. \ } }	 ˆ  i d d | d | |	 f ƒ qåWn |  i o& ˆ  i d
 d | d |  i f ƒ n | d 7} x |  D] } ˆ | | ƒ q\W|  i o& ˆ  i d
 d | d |  i f ƒ n d  S(   Nu   tagu
   <!DOCTYPE>u   publicIdu   systemIdu    u   <!DOCTYPE %s "%s" "%s">u   <!DOCTYPE %s>u   DOCUMENT_ROOTu	   #documentu   |%s"%s"u    i   u   Document node cannot have tailu   attribu$   Document node cannot have attributesu   |%s<!-- %s -->u   Expected unicode, got %s, %su   %s %su   |%s<%s>u
   |%s%s="%s"(   t   hasattrt   getrootR   RN   R2   R/   R   R;   t	   TypeErrorR0   R   R#   R   t   AssertionErrorR?   t
   tag_regexpt   matcht   groupsR   t   prefixesR"   t   sorted(   R,   t   indentRL   RM   t   nsmatchR   t   nst   prefixR&   R(   t   attr_stringt   child(   t   rvt   serializeElementt   ElementTreeCommentType(    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRe   Å   sd     	& "  *
&
 
u   
(   t   join(   R,   (   Rf   (   Rd   Re   sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   testSerializerÂ   s    7c         ` sD   g  ‰  t  i ƒ  ‰ ‡  ‡ ‡ ‡ ‡ f d †  ‰ ˆ |  ƒ d i ˆ  ƒ S(   u4   Serialize an element and its child nodes to a stringc         ` s  t  |  ˆ i ƒ o |  i ƒ  }  n |  i d j oˆ |  i d ƒ p |  i d ƒ oM |  i d ƒ p d } |  i d ƒ p d } ˆ  i d |  i | | f ƒ qmˆ  i d |  i f ƒ n³|  i d j o“ |  i d  j	 o ˆ  i |  i ƒ n |  i d  j	 o t	 d ƒ ‚ n t
 |  d	 ƒ o  t |  i ƒ o t	 d
 ƒ ‚ n x+|  D] } ˆ | ƒ qFWn|  i ˆ j o ˆ  i d |  i f ƒ nå |  i p$ ˆ  i d ˆ i |  i ƒ f ƒ ng d i g  } |  i i ƒ  D]& \ } } | d ˆ i | ƒ | f qÑ~ ƒ } ˆ  i d |  i | f ƒ |  i o ˆ  i |  i ƒ n x |  D] } ˆ | ƒ qBWˆ  i d |  i f ƒ |  i o ˆ  i |  i ƒ n d  S(   Nu
   <!DOCTYPE>u   publicIdu   systemIdu    u   <!DOCTYPE %s PUBLIC "%s" "%s">u   <!DOCTYPE %s>u   DOCUMENT_ROOTu   Document node cannot have tailu   attribu$   Document node cannot have attributesu	   <!--%s-->u   <%s>u    u   %s="%s"u   <%s %s>u   </%s>(   R#   R   RV   R   RN   R2   R/   R   R;   RW   RU   R0   R   t   fromXmlNameRg   R"   (   R,   RL   RM   Rc   t   _[1]R   R(   t   attr(   Rd   Re   t   filterRf   R   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRe     sD     	  
$?
 
u    (   R   t   InfosetFilterRg   (   R,   (   Rf   R   (   Rd   Re   Rl   sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   tostring   s
    -
t   TreeBuilderc           ` sS   e  Z ˆ Z ˆ Z ˆ Z ˆ  Z ˆ Z ˆ Z ‡ f d  †  Z ‡ f d †  Z	 d „  Z
 RS(   c         ` s
   ˆ  | ƒ S(   N(    (   R   R,   (   Rh   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRh   >  s    c         ` sT   ˆ  o |  i  i S|  i d  j	 o |  i  i i d |  i ƒ S|  i  i i d ƒ Sd  S(   Nu   {%s}htmlu   html(   t   documentR   t   defaultNamespaceR   t   find(   R   (   t   fullTree(    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   getDocumentA  s    c         S` s   t  i i |  ƒ i S(   N(   R   Ro   t   getFragmentR   (   R   (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRu   K  s    (   RE   RF   t   documentClasst   doctypeClasst   elementClasst   commentClasst   fragmentClasst   implementationRh   Rt   Ru   (    (   RH   RT   Rh   t   ElementTreeImplementationR	   RK   Rs   RS   (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyRo   6  s   
(   RH   R   R   RB   Ro   t   locals(   R|   Rs   Rn   Ro   (    (
   RH   RS   Rh   R	   R|   Rs   RK   Rf   RT   R   sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   getETreeBuilder   s    }>64(   t
   __future__R    R   R   t   pip.vendor.sixR   t   ret    R   R   R   R   t   utilsR   t   compileRY   t   FalseR~   t   getETreeModule(    (    (    sb   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/treebuilders/etree.pyt   <module>   s   ÿ C