
Rc        7   @` s  d  d k  l Z l Z l Z d  d k l Z d  d k Z d  d k Z d d k l	 Z	 l
 Z
 l Z l Z d d k l Z l Z d d k l Z d  d k l Z y d  d	 k l Z Wn e j
 o e Z n Xy d  d
 k l Z Wn) e j
 o d e f d     YZ n Xe g  Z e
 D] Z e e i d  q[  Z e g  Z e D] Z e e i d  qJ[  Z e g  Z e D] Z e e i d  qz[  Z e e d d g  BZ  e i! d  Z" e# d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 g   Z$ e i! d1  Z% h  Z& d2 d@ d3     YZ' d e) e) d4  Z* d5 dA d6     YZ+ d7 e+ f d8     YZ, d9 e- f d:     YZ. d; e f d<     YZ/ d= e f d>     YZ0 d?   Z1 d S(B   i    (   t   absolute_importt   divisiont   unicode_literals(   t	   text_typeNi   (   t   EOFt   spaceCharacterst   asciiLetterst   asciiUppercase(   t	   encodingst   ReparseException(   t   utils(   t   StringIO(   t   BytesIO(   t   BufferedIOBaseR   c           B` s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR      s   u   asciit   >t   <u   [----﷐-﷯￾￿🿾🿿𯿾𯿿𿿾𿿿񏿾񏿿񟿾񟿿񯿾񯿿񿿾񿿿򏿾򏿿򟿾򟿿򯿾򯿿򿿾򿿿󏿾󏿿󟿾󟿿󯿾󯿿󿿾󿿿􏿾􏿿]i i i i i i i i i i i i i i i i i	 i	 i
 i
 i i i i i i i i i i i i u   [	- -/:-@[-`{-~]t   BufferedStreamc           B` sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   u   Buffering for streams that do not have buffering of their own

    The buffer is implemented as a list of chunks on the assumption that
    joining many strings will be slow since it is O(n**2)
    c         C` s%   | |  _  g  |  _ d d g |  _ d  S(   Nii    (   t   streamt   buffert   position(   t   selfR   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   __init__5   s    		c         C` sJ   d } x, |  i  |  i d  D] } | t |  7} q W| |  i d 7} | S(   Ni    i   (   R   R   t   len(   R   t   post   chunk(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   tell:   s     c         C` so   | |  i    j  p t  | } d } x3 t |  i |  | j  o | | 8} | d 7} q) W| | g |  _ d  S(   Ni    i   (   t   _bufferedBytest   AssertionErrorR   R   R   (   R   R   t   offsett   i(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   seekA   s     
c         C` su   |  i  p |  i |  S|  i d t |  i   j o/ |  i d t |  i  d  j o |  i |  S|  i |  Sd  S(   Ni    i   i(   R   t   _readStreamR   R   t   _readFromBuffer(   R   t   bytes(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   readJ   s    
!c         C` s.   t  g  } |  i D] } | t |  q ~  S(   N(   t   sumR   R   (   R   t   _[1]t   item(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   S   s    c         C` sL   |  i  i |  } |  i i |  |  i d c d 7<t |  |  i d <| S(   Ni    i   (   R   R$   R   t   appendR   R   (   R   R#   t   data(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR!   V   s
    c         C` s+  | } g  } |  i  d } |  i  d } x | t |  i  j  o | d j o | d j p t  |  i | } | t |  | j o | } | | | g |  _  n0 t |  | } | t |  g |  _  | d 7} | i | | | | ! | | 8} d } q) W| o | i |  i |   n d i |  S(   Ni    i   u    (   R   R   R   R   R(   R!   t   join(   R   R#   t   remainingBytest   rvt   bufferIndext   bufferOffsett   bufferedDatat   bytesToRead(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR"   ]   s(     #

(
   R   R   t   __doc__R   R   R    R$   R   R!   R"   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   .   s   								c         C` s   t  |  d  o t |  i d  t  } n t |  t  } | o( | d  j	 o t d   n t |   St |  | | |  Sd  S(   Nu   readi    u7   Cannot explicitly set an encoding with a unicode string(   t   hasattrt
   isinstanceR$   R   t   Nonet	   TypeErrort   HTMLUnicodeInputStreamt   HTMLBinaryInputStream(   t   sourcet   encodingt	   parseMetat   chardett	   isUnicode(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   HTMLInputStreamx   s    R6   c           B` s}   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d d  Z d	   Z d
   Z e d  Z d   Z RS(   u   Provides a unicode stream of characters to the HTMLTokenizer.

    This class takes care of character encoding and removing or replacing
    incorrect byte-sequences and also provides column and line tracking.

    i (  c         C` s   t  d  d j o" |  i |  _ t i d  |  _ n |  i |  _ t i d  |  _ d g |  _ d	 |  _ |  i	 |  |  _
 |  i   d S(
   u  Initialises the HTMLInputStream.

        HTMLInputStream(source, [encoding]) -> Normalized stream from source
        for use by html5lib.

        source can be either a file-object, local filename or a string.

        The optional encoding parameter must be a string that indicates
        the encoding.  If specified, that encoding will be used,
        regardless of any BOM or later declaration (such as in a meta
        element)

        parseMeta - Look for a <meta> element containing encoding information

        u   􏿿i   u	   [-]u0   ([-](?![-])|(?<![-])[-])i    u   utf-8u   certainN(   u   utf-8u   certain(   R   t   characterErrorsUCS4t   reportCharacterErrorst   ret   compilet   replaceCharactersRegexpt   characterErrorsUCS2t   newLinest   charEncodingt
   openStreamt
   dataStreamt   reset(   R   R8   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR      s    	c         C` sC   d |  _  d |  _ d |  _ g  |  _ d |  _ d |  _ d  |  _ d  S(   Nu    i    (   R   t	   chunkSizet   chunkOffsett   errorst   prevNumLinest   prevNumColsR4   t   _bufferedCharacter(   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRH      s    						c         C` s*   t  | d  o
 | } n t |  } | S(   uv   Produces a file object from source.

        source can be either a file object, local filename or a string.

        u   read(   R2   R   (   R   R8   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRF      s    
c         C` sv   |  i  } | i d d |  } |  i | } | i d d |  } | d j o |  i | } n | | d } | | f S(   Nu   
i    ii   (   R   t   countRL   t   rfindRM   (   R   R   R   t   nLinest   positionLinet   lastLinePost   positionColumn(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt	   _position   s    	c         C` s&   |  i  |  i  \ } } | d | f S(   u:   Returns (line, col) of the current position in the stream.i   (   RU   RJ   (   R   t   linet   col(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR      s    c         C` sP   |  i  |  i j o |  i   p t Sn |  i  } |  i | } | d |  _  | S(   uo    Read one character from the stream or queue if available. Return
            EOF when EOF is reached.
        i   (   RJ   RI   t	   readChunkR   R   (   R   RJ   t   char(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRY      s    		c         C` sd  | d  j o |  i } n |  i |  i  \ |  _ |  _ d |  _ d |  _ d |  _ |  i i	 |  } |  i
 o |  i
 | } d  |  _
 n | p t St |  d j oZ t | d  } | d j p d | j o
 d j n o | d |  _
 | d  } qn |  i |  |  i i d |  } | i d	 d
  } | i d d
  } | |  _ t |  |  _ t S(   Nu    i    i   ii   i   i  u   �u   
u   
u   (   R4   t   _defaultChunkSizeRU   RI   RL   RM   R   RJ   RG   R$   RN   t   FalseR   t   ordR?   RB   t   subt   replacet   True(   R   RI   R)   t   lastv(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRX      s0    			
+	c         C` s:   x3 t  t t i |    D] } |  i i d  q Wd  S(   Nu   invalid-codepoint(   t   rangeR   t   invalid_unicode_ret   findallRK   R(   (   R   R)   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR>     s     c         C` s  t  } x t i |  D] } | o q n t | i    } | i   } t i | | | d ! oE t i | | | d ! } | t	 j o |  i
 i d  n t } q | d j o8 | d j o+ | t |  d j o |  i
 i d  q t  } |  i
 i d  q Wd  S(   Ni   u   invalid-codepointi   i  i   (   R[   Rb   t   finditerR\   t   groupt   startR
   t   isSurrogatePairt   surrogatePairToCodepointt   non_bmp_invalid_codepointsRK   R(   R_   R   (   R   R)   t   skipt   matcht	   codepointR   t   char_val(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRC     s"     
c      	   C` s  y t  | | f } Wn t j
 o x( | D]  } t |  d j  p t  q, Wd i g  } | D] } | d t |  qa ~  } | p d | } n t i d |  } t  | | f <n Xg  } x t o | i |  i	 |  i
  } | d j o |  i
 |  i j o PqTnE | i   }	 |	 |  i j o( | i |  i	 |  i
 |	 ! |	 |  _
 Pn | i |  i	 |  i
  |  i   p Pq q Wd i |  }
 |
 S(   u    Returns a string of characters from the stream up to but not
        including any character in 'characters' or EOF. 'characters' must be
        a container that supports the 'in' method and iteration over its
        characters.
        i   u    u   \x%02xu   ^%su   [%s]+N(   t   charsUntilRegExt   KeyErrorR\   R   R*   R@   RA   R_   Rk   R   RJ   R4   RI   t   endR(   RX   (   R   t
   characterst   oppositet   charst   cR&   t   regexR,   t   mRp   t   r(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt
   charsUntil0  s6     4& 		
c         C` su   | d  j	 od |  i d j o# | |  i |  _ |  i d 7_ qq |  i d 8_ |  i |  i | j p t  n d  S(   Ni    i   (   R4   RJ   R   RI   R   (   R   RY   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   unget_  s    N(   R   R   R1   RZ   R   RH   RF   RU   R   RY   R4   RX   R>   RC   R[   Rx   Ry   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR6      s   	!					(		/R7   c           B` s\   e  Z d  Z d e e d  Z d   Z d   Z e e d  Z d   Z	 d   Z
 d   Z RS(	   u   Provides a unicode stream of characters to the HTMLTokenizer.

    This class takes care of character encoding and removing or replacing
    incorrect byte-sequences and also provides column and line tracking.

    c         C` s   |  i  |  |  _ t i |  |  i  t |  d f |  _ d |  _ d |  _ d |  _ |  i d d j o |  i
 | |  |  _ n |  i   d S(   u  Initialises the HTMLInputStream.

        HTMLInputStream(source, [encoding]) -> Normalized stream from source
        for use by html5lib.

        source can be either a file-object, local filename or a string.

        The optional encoding parameter must be a string that indicates
        the encoding.  If specified, that encoding will be used,
        regardless of any BOM or later declaration (such as in a meta
        element)

        parseMeta - Look for a <meta> element containing encoding information

        u   certaini   id   u   windows-1252i    N(   RF   t	   rawStreamR6   R   t	   codecNameRE   t   numBytesMetat   numBytesChardett   defaultEncodingR4   t   detectEncodingRH   (   R   R8   R9   R:   R;   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   x  s    			c         C` s6   t  i |  i d  |  i d  |  _ t i |   d  S(   Ni    u   replace(   t   codecst	   getreaderRE   Rz   RG   R6   RH   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRH     s    c         C` sW   t  | d  o
 | } n t |  } y | i | i    Wn t |  } n X| S(   uv   Produces a file object from source.

        source can be either a file object, local filename or a string.

        u   read(   R2   R   R    R   R   (   R   R8   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRF     s    
c   
   
   C` s  |  i    } d } | d  j o | o |  i   } d } n | d  j o | o d } y y d d k l } Wn# t j
 o d d k l } n Xg  } |   } xa | i pV |  i i	 |  i
  } t | t  p t  | p Pn | i |  | i |  q W| i   | i d } |  i i d  WqHt j
 o qHXn | d  j o d } |  i } n h d d 6}	 | i   |	 j o |	 | i   } n | | f S(   Nu   certainu	   tentativei    (   t   UniversalDetectoru   encodingu   windows-1252u
   iso-8859-1(   t	   detectBOMR4   t   detectEncodingMetat   charade.universaldetectorR   t   ImportErrort   chardet.universaldetectort   doneRz   R$   R}   R3   R#   R   R(   t   feedt   closet   resultR    R~   t   lower(
   R   R:   R;   R9   t
   confidenceR   t   bufferst   detectorR   t   encodingSub(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     sD    
	 

	c         C` s   |  i  d d j p t  t |  } | d	 j o
 d } n | d  j o d  S| |  i  d j o |  i  d d f |  _  nG |  i i d  |  i   | d f |  _  t d |  i  d | f   d  S(
   Ni   u   certainu   utf-16u	   utf-16-beu	   utf-16-leu   utf-8i    u   Encoding changed from %s to %s(   u   utf-16u	   utf-16-beu	   utf-16-le(   RE   R   R{   R4   Rz   R    RH   R	   (   R   t   newEncoding(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   changeEncoding  s    

c         C` s   h d t  i 6d t  i 6d t  i 6d t  i 6d t  i 6} |  i i d  } t | t	  p t
  | i | d   } d } | p= | i |  } d } | p | i | d   } d } q n |  i i | o | p d	  | S(
   u   Attempts to detect at BOM at the start of the stream. If
        an encoding can be determined from the BOM return the name of the
        encoding otherwise return Noneu   utf-8u	   utf-16-leu	   utf-16-beu	   utf-32-leu	   utf-32-bei   i   i   i    (   R   t   BOM_UTF8t   BOM_UTF16_LEt   BOM_UTF16_BEt   BOM_UTF32_LEt   BOM_UTF32_BERz   R$   R3   R#   R   t   getR    (   R   t   bomDictt   stringR9   R    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s     
c         C` so   |  i  i |  i  } t | t  p t  t |  } |  i  i d  | i   } | d j o
 d } n | S(   u9   Report the encoding declared by the meta element
        i    u   utf-16u	   utf-16-beu	   utf-16-leu   utf-8(   u   utf-16u	   utf-16-beu	   utf-16-le(	   Rz   R$   R|   R3   R#   R   t   EncodingParserR    t   getEncoding(   R   R   t   parserR9   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    
N(   R   R   R1   R4   R_   R   RH   RF   R   R   R   R   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR7   p  s   (		-		t   EncodingBytesc           B` s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 e e
 e	  Z d	   Z e e  Z e d
  Z d   Z d   Z d   Z RS(   u   String-like object with an associated position and various extra methods
    If the position is ever greater than the string length then an exception is
    raisedc         C` s-   t  | t  p t  t i |  | i    S(   N(   R3   R#   R   t   __new__R   (   R   t   value(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   &  s    c         C` s   d |  _  d  S(   Ni(   RU   (   R   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   *  s    c         C` s   |  S(   N(    (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   __iter__-  s    c         C` sW   |  i  d } |  _  | t |   j o
 t  n | d j  o
 t  n |  | | d !S(   Ni   i    (   RU   R   t   StopIterationR5   (   R   t   p(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   __next__0  s    

c         C` s
   |  i    S(   N(   R   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   next8  s    c         C` s]   |  i  } | t |   j o
 t  n | d j  o
 t  n | d |  _  } |  | | d !S(   Ni    i   (   RU   R   R   R5   (   R   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   previous<  s    	

c         C` s-   |  i  t |   j o
 t  n | |  _  d  S(   N(   RU   R   R   (   R   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   setPositionE  s    
c         C` s@   |  i  t |   j o
 t  n |  i  d j o |  i  Sd  Sd  S(   Ni    (   RU   R   R   R4   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   getPositionJ  s
    
c         C` s   |  |  i  |  i  d !S(   Ni   (   R   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   getCurrentByteT  s    c         C` sg   |  i  } xN | t |   j  o: |  | | d !} | | j o | |  _ | S| d 7} q W| |  _ d S(   u   Skip past a list of charactersi   N(   R   R   RU   R4   (   R   Rs   R   Rt   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyRj   Y  s    	 		c         C` sg   |  i  } xN | t |   j  o: |  | | d !} | | j o | |  _ | S| d 7} q W| |  _ d  S(   Ni   (   R   R   RU   R4   (   R   Rs   R   Rt   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt	   skipUntile  s    	 		c         C` sS   |  i  } |  | | t |  !} | i |  } | o |  i  t |  7_  n | S(   u   Look for a sequence of bytes at the start of a string. If the bytes
        are found return True and advance the position to the byte after the
        match. Otherwise return False and leave the position alone(   R   R   t
   startswith(   R   R#   R   R)   R,   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt
   matchBytesp  s    	c         C` sl   |  |  i  i |  } | d j o? |  i d j o d |  _ n |  i | t |  d 7_ t St  d S(   u   Look for the next sequence of bytes matching a given sequence. If
        a match is found advance the position to the last byte of the matchii    i   N(   R   t   findRU   R   R_   R   (   R   R#   t   newPosition(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   jumpTo{  s    (   R   R   R1   R   R   R   R   R   R   R   R   t   propertyR   R   t   currentBytet   spaceCharactersBytesRj   R   R   R   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   "  s    												R   c           B` s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   u?   Mini parser for detecting character encoding from meta elementsc         C` s   t  |  |  _ d |  _ d S(   u3   string - the data to work on for encoding detectionN(   R   R)   R4   R9   (   R   R)   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    c         C` s   d |  i  f d |  i f d |  i f d |  i f d |  i f d |  i f f } x| |  i D]q } t } xV | D]N \ } } |  i i |  o/ y |   } PWq t j
 o t	 } Pq Xqk qk W| p PqX qX W|  i
 S(   Ns   <!--s   <metas   </s   <!s   <?R   (   t   handleCommentt
   handleMetat   handlePossibleEndTagt   handleOthert   handlePossibleStartTagR)   R_   R   R   R[   R9   (   R   t   methodDispatcht   bytet   keepParsingt   keyt   method(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s*    
  		c         C` s   |  i  i d  S(   u   Skip over commentss   -->(   R)   R   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    c         C` sb  |  i  i t j o t St } d  } x7t o/|  i   } | d  j o t S| d d j o6 | d d j } | o | d  j	 o | |  _ t Sq' | d d j o5 | d } t |  } | d  j	 o | |  _ t Sq' | d d j oo t	 t
 | d   } | i   } | d  j	 o< t |  } | d  j	 o | o | |  _ t S| } qUqYq' q' Wd  S(   Ni    s
   http-equivi   s   content-typet   charsett   content(   R)   R   R   R_   R[   R4   t   getAttributeR9   R{   t   ContentAttrParserR   t   parse(   R   t	   hasPragmat   pendingEncodingt   attrt   tentativeEncodingt   codect   contentParser(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s<     		
			c         C` s   |  i  t  S(   N(   t   handlePossibleTagR[   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    c         C` s   t  |  i  |  i t  S(   N(   R   R)   R   R_   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    c         C` s   |  i  } | i t j o$ | o | i   |  i   n t S| i t  } | d j o | i   n. |  i   } x | d  j	 o |  i   } qv Wt S(   NR   (
   R)   R   t   asciiLettersBytesR   R   R_   R   t   spacesAngleBracketsR   R4   (   R   t   endTagR)   Rt   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    	
 c         C` s   |  i  i d  S(   NR   (   R)   R   (   R   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s    c         C` s  |  i  } | i t t d g  B } | d j p t |  d j p t  | d	 j o d Sg  } g  } x t o | d j o | o Pn | t j o | i   } Pne | d
 j o d i |  d f S| t	 j o | i
 | i    n  | d j o d S| i
 |  t |  } qm W| d j o | i   d i |  d f St |  | i   } | d j o | } x t ou t |  } | | j o' t |  d i |  d i |  f S| t	 j o | i
 | i    qw| i
 |  qwWne | d j o d i |  d f S| t	 j o | i
 | i    n  | d j o d S| i
 |  x t o} t |  } | t j o d i |  d i |  f S| t	 j o | i
 | i    q_| d j o d S| i
 |  q_Wd S(   u_   Return a name,value pair for the next attribute in the stream,
        if one is found, or Nonet   /i   R   t   =t    t   't   "N(   R   N(   R   R   (   R   R   (   R)   Rj   R   t	   frozensetR4   R   R   R_   R*   t   asciiUppercaseBytesR(   R   R   R   R   (   R   R)   Rt   t   attrNamet	   attrValuet	   quoteChar(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     sn    	' 

 
 (   R   R   R1   R   R   R   R   R   R   R   R   R   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR     s   				$				R   c           B` s   e  Z d    Z d   Z RS(   c         C` s$   t  | t  p t  | |  _ d  S(   N(   R3   R#   R   R)   (   R   R)   (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   ?  s    c      	   C` sD  y)|  i  i d  |  i  i d 7_ |  i  i   |  i  i d j p d  S|  i  i d 7_ |  i  i   |  i  i d j oZ |  i  i } |  i  i d 7_ |  i  i } |  i  i |  o |  i  | |  i  i !Sd  SnS |  i  i } y( |  i  i t  |  i  | |  i  i !SWn t j
 o |  i  | SXWn t j
 o d  SXd  S(   NR   i   R   R   R   (   R   R   (	   R)   R   R   Rj   R   R4   R   R   R   (   R   t	   quoteMarkt   oldPosition(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   C  s.    (   R   R   R   R   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR   >  s   	c         C` sv   t  |  t  o. y |  i d  }  Wq> t j
 o d SXn |  o) t i d |   i   } t i	 | d  Sd Sd S(   u{   Return the python codec name corresponding to an encoding or None if the
    string doesn't correspond to a valid encoding.u   asciiu    N(
   R3   R#   t   decodet   UnicodeDecodeErrorR4   t   ascii_punctuation_reR]   R   R   R   (   R9   t   canonicalName(    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyR{   e  s    
(    (    (2   t
   __future__R    R   R   t   pip.vendor.sixR   R   R@   t	   constantsR   R   R   R   R   R	   R   R
   t   ioR   R   R   R   t   objectR   R&   R'   t   encodeR   t   _[2]R   t   _[3]R   R   RA   Rb   t   setRi   R   Rn   R   R4   R_   R=   R6   R7   R#   R   R   R   R{   (    (    (    s[   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/vendor/html5lib/inputstream.pyt   <module>   sJ   "000Jg'