
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
•�abc        !   @` sÛ  d  d l  m Z m Z m Z d  d l m Z m Z d  d l m Z 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 d d l m Z d d	 l m Z d  d
 l m Z y d  d l m Z Wn e k
 rï e Z n Xe g  e D] Z e j d ƒ ^ qú ƒ Z e g  e D] Z e j d ƒ ^ q"ƒ Z e g  e D] Z e j d ƒ ^ qJƒ Z e e d d g ƒ BZ  d Z! e j" r±e j# e! d  e$ d ƒ d ƒ Z% n e j# e! ƒ 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/ d0 d1 d2 g  ƒ Z' e j# d3 ƒ Z( i  Z) d4 e* f d5 „  ƒ  YZ+ d6 „  Z, d7 e* f d8 „  ƒ  YZ- d9 e- f d: „  ƒ  YZ. d; e/ f d< „  ƒ  YZ0 d= e* f d> „  ƒ  YZ1 d? e* f d@ „  ƒ  YZ2 dA „  Z3 d S(B   i    (   t   absolute_importt   divisiont   unicode_literals(   t	   text_typet   binary_type(   t   http_clientt   urllibN(   t   webencodingsi   (   t   EOFt   spaceCharacterst   asciiLetterst   asciiUppercase(   t   ReparseException(   t   _utils(   t   StringIO(   t   BytesIOu   asciit   >t   <uš   [---ÂŸï·�-ï·¯ï¿¾ï¿¿ðŸ¿¾ðŸ¿¿ð¯¿¾ð¯¿¿ð¿¿¾ð¿¿¿ñ�¿¾ñ�¿¿ñŸ¿¾ñŸ¿¿ñ¯¿¾ñ¯¿¿ñ¿¿¾ñ¿¿¿ò�¿¾ò�¿¿òŸ¿¾òŸ¿¿ò¯¿¾ò¯¿¿ò¿¿¾ò¿¿¿ó�¿¾ó�¿¿óŸ¿¾óŸ¿¿ó¯¿¾ó¯¿¿ó¿¿¾ó¿¿¿ô�¿¾ô�¿¿]iÿÿÿÿu   "\uD800-\uDFFF"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(   Niÿÿÿÿi    (   t   streamt   buffert   position(   t   selfR   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   __init__@   s    		c         C` sJ   d } x, |  j  |  j d  D] } | t | ƒ 7} q W| |  j d 7} | S(   Ni    i   (   R   R   t   len(   R   t   post   chunk(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   tellE   s
    c         C` s`   | } d } x> t  |  j | ƒ | k  rL | t  |  j | ƒ 8} | d 7} q W| | g |  _ d  S(   Ni    i   (   R   R   R   (   R   R   t   offsett   i(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   seekL   s    c         C` sp   |  j  s |  j | ƒ S|  j d t |  j  ƒ k r_ |  j d t |  j  d ƒ k r_ |  j | ƒ S|  j | ƒ Sd  S(   Ni    i   iÿÿÿÿ(   R   t   _readStreamR   R   t   _readFromBuffer(   R   t   bytes(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   readU   s    	 c         C` s&   t  g  |  j D] } t | ƒ ^ q ƒ S(   N(   t   sumR   R   (   R   t   item(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   _bufferedBytes^   s    c         C` sL   |  j  j | ƒ } |  j j | ƒ |  j d c d 7<t | ƒ |  j d <| S(   Ni    i   (   R   R"   R   t   appendR   R   (   R   R!   t   data(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   a   s
    c         C` s  | } g  } |  j  d } |  j  d } x» | t |  j ƒ k  rã | d k rã |  j | } | t | ƒ | k r‰ | } | | | g |  _  n/ t | ƒ | } | t | ƒ g |  _  | d 7} | j | | | | !ƒ | | 8} d } q) W| r| j |  j | ƒ ƒ n  d j | ƒ S(   Ni    i   t    (   R   R   R   R&   R   t   join(   R   R!   t   remainingBytest   rvt   bufferIndext   bufferOffsett   bufferedDatat   bytesToRead(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR    h   s$    $


(
   t   __name__t
   __module__t   __doc__R   R   R   R"   R%   R   R    (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   9   s   								c         K` sã   t  |  t j ƒ s< t  |  t j j ƒ rE t  |  j t j ƒ rE t } n9 t |  d ƒ ro t  |  j	 d ƒ t
 ƒ } n t  |  t
 ƒ } | rÒ g  | D] } | j d ƒ r‹ | ^ q‹ } | rÅ t d | ƒ ‚ n  t |  | � St |  | � Sd  S(   Nu   readi    u	   _encodingu3   Cannot set an encoding with a unicode input, set %r(   t
   isinstanceR   t   HTTPResponseR   t   responset   addbaset   fpt   Falset   hasattrR"   R   t   endswitht	   TypeErrort   HTMLUnicodeInputStreamt   HTMLBinaryInputStream(   t   sourcet   kwargst	   isUnicodet   xt	   encodings(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   HTMLInputStreamƒ   s    	(R<   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  j s d |  _ n- t d ƒ d k r6 |  j |  _ n |  j |  _ d g |  _ t d ƒ d f |  _	 |  j
 | ƒ |  _ |  j ƒ  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)

        u   ô�¿¿i   i    u   utf-8u   certainN(   R   t   supports_lone_surrogatest   Nonet   reportCharacterErrorsR   t   characterErrorsUCS4t   characterErrorsUCS2t   newLinest   lookupEncodingt   charEncodingt
   openStreamt
   dataStreamt   reset(   R   R>   (    (    sE   /usr/lib/python2.7/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   prevNumColsRE   t   _bufferedCharacter(   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRN   Ä   s    						c         C` s(   t  | d ƒ r | } n t | ƒ } | S(   uv   Produces a file object from source.

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

        u   read(   R9   R   (   R   R>   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRL   Ò   s    	c         C` st   |  j  } | j d d | ƒ } |  j | } | j d d | ƒ } | d k r\ |  j | } n | | d } | | f S(   Nu   
i    iÿÿÿÿi   (   R   t   countRR   t   rfindRS   (   R   R   R   t   nLinest   positionLinet   lastLinePost   positionColumn(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt	   _positionà   s    	c         C` s&   |  j  |  j ƒ \ } } | d | f S(   u:   Returns (line, col) of the current position in the stream.i   (   R[   RP   (   R   t   linet   col(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   ë   s    c         C` sL   |  j  |  j k r% |  j ƒ  s% t Sn  |  j  } |  j | } | d |  _  | S(   uo    Read one character from the stream or queue if available. Return
            EOF when EOF is reached.
        i   (   RP   RO   t	   readChunkR   R   (   R   RP   t   char(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR_   ð   s    	c         C` sO  | d  k r |  j } n  |  j |  j ƒ \ |  _ |  _ d |  _ d |  _ d |  _ |  j j	 | ƒ } |  j
 r… |  j
 | } d  |  _
 n
 | s� t St | ƒ d k rö t | d ƒ } | d k sÙ d | k oÔ d k n rö | d |  _
 | d  } qö n  |  j r|  j | ƒ n  | j d d	 ƒ } | j d
 d	 ƒ } | |  _ t | ƒ |  _ t S(   Nu    i    i   iÿÿÿÿi   i Ø  iÿÛ  u   
u   
u   (   RE   t   _defaultChunkSizeR[   RO   RR   RS   R   RP   RM   R"   RT   R8   R   t   ordRF   t   replacet   True(   R   RO   R'   t   lastv(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR^   ÿ   s0    				(		c         C` s:   x3 t  t t j | ƒ ƒ ƒ D] } |  j j d ƒ q Wd  S(   Nu   invalid-codepoint(   t   rangeR   t   invalid_unicode_ret   findallRQ   R&   (   R   R'   t   _(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRG   %  s    "c         C` s  t  } xô t j | ƒ D]ã } | r( q n  t | j ƒ  ƒ } | j ƒ  } t j | | | d !ƒ r¢ t j | | | d !ƒ } | t	 k r™ |  j
 j d ƒ n  t } q | d k rã | d k rã | t | ƒ d k rã |  j
 j d ƒ q t  } |  j
 j d ƒ q Wd  S(   Ni   u   invalid-codepointi Ø  iÿß  i   (   R8   Rf   t   finditerRa   t   groupt   startR   t   isSurrogatePairt   surrogatePairToCodepointt   non_bmp_invalid_codepointsRQ   R&   Rc   R   (   R   R'   t   skipt   matcht	   codepointR   t   char_val(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRH   )  s     	c   
      C` sT  y t  | | f } Wnq t k
 r‡ d j g  | D] } d t | ƒ ^ q1 ƒ } | sc d | } n  t j d | ƒ } t  | | f <n Xg  } x° t r@| j |  j |  j	 ƒ } | d k rÔ |  j	 |  j k rPqnB | j ƒ  } | |  j k r| j |  j |  j	 | !ƒ | |  _	 Pn  | j |  j |  j	 ƒ |  j ƒ  s‘ Pq‘ q‘ Wd j | ƒ }	 |	 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.
        u    u   \x%02xu   ^%su   [%s]+N(   t   charsUntilRegExt   KeyErrorR)   Ra   t   ret   compileRc   Rp   R   RP   RE   RO   t   endR&   R^   (
   R   t
   characterst   oppositet   charst   ct   regexR+   t   mRw   t   r(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt
   charsUntil@  s.    ,%		c         C` sS   | d  k	 rO |  j d k r= | |  j |  _ |  j d 7_ qO |  j d 8_ n  d  S(   Ni    i   (   RE   RP   R   RO   (   R   R_   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   ungeto  s    N(   R0   R1   R2   R`   R   RN   RL   R[   R   R_   RE   R^   RG   RH   R8   R   R€   (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR<   š   s   	 					&		/R=   c           B` sb   e  Z d  Z d	 d	 d	 d	 d e d „ Z d „  Z d „  Z 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.

    u   windows-1252c         C` s„   |  j  | ƒ |  _ t j |  |  j ƒ d |  _ d |  _ | |  _ | |  _ | |  _ | |  _	 | |  _
 |  j | ƒ |  _ |  j ƒ  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)

        i   id   N(   RL   t	   rawStreamR<   R   t   numBytesMetat   numBytesChardett   override_encodingt   transport_encodingt   same_origin_parent_encodingt   likely_encodingt   default_encodingt   determineEncodingRK   RN   (   R   R>   R„   R…   R†   R‡   Rˆ   t
   useChardet(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   ˆ  s    							c         C` s3   |  j  d j j |  j d ƒ |  _ t j |  ƒ d  S(   Ni    u   replace(   RK   t
   codec_infot   streamreaderR�   RM   R<   RN   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRN   ²  s    "c         C` sU   t  | d ƒ r | } n t | ƒ } y | j | j ƒ  ƒ 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(   R9   R   R   R   R   (   R   R>   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRL   ¶  s    	c         C` s  |  j  ƒ  d f } | d d  k	 r& | St |  j ƒ d f } | d d  k	 rO | St |  j ƒ d f } | d d  k	 rx | S|  j ƒ  d f } | d d  k	 rž | St |  j ƒ d f } | d d  k	 rÞ | d j j d ƒ rÞ | St |  j	 ƒ d f } | d d  k	 r| S| rÓy d d l
 m } Wn t k
 r4qÓXg  } | ƒ  } xF | j sŒ|  j j |  j ƒ } | soPn  | j | ƒ | j | ƒ qGW| j ƒ  t | j d ƒ } |  j j d ƒ | d  k	 rÓ| d f Sn  t |  j ƒ d f } | d d  k	 rü| St d ƒ d f S(   Nu   certaini    u	   tentativeu   utf-16(   t   UniversalDetectoru   encodingu   windows-1252(   t	   detectBOMRE   RJ   R„   R…   t   detectEncodingMetaR†   t   namet
   startswithR‡   t   chardet.universaldetectorR�   t   ImportErrort   doneR�   R"   Rƒ   R&   t   feedt   closet   resultR   Rˆ   (   R   t   chardetRK   R�   t   bufferst   detectorR   t   encoding(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR‰   É  sP    '	
c         C` s°   t  | ƒ } | d  k r d  S| j d k r: t  d ƒ } nr | |  j d k rf |  j d d f |  _ nF |  j j d ƒ | d f |  _ |  j ƒ  t d |  j d | f ƒ ‚ d  S(   Nu   utf-16beu   utf-16leu   utf-8i    u   certainu   Encoding changed from %s to %s(   u   utf-16beu   utf-16le(   RJ   RE   R�   RK   R�   R   RN   R   (   R   t   newEncoding(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   changeEncoding  s    
c         C` sÛ   i d t  j 6d t  j 6d t  j 6d t  j 6d t  j 6} |  j j d ƒ } | j | d  ƒ } d } | s£ | j | ƒ } d } | s£ | j | d  ƒ } d } q£ n  | rÃ |  j j	 | ƒ t
 | ƒ S|  j j	 d	 ƒ d
 Sd
 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-16leu   utf-16beu   utf-32leu   utf-32bei   i   i   i    N(   t   codecst   BOM_UTF8t   BOM_UTF16_LEt   BOM_UTF16_BEt   BOM_UTF32_LEt   BOM_UTF32_BER�   R"   t   getR   RJ   RE   (   R   t   bomDictt   stringR›   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRŽ     s$    

c         C` sk   |  j  j |  j ƒ } t | ƒ } |  j  j d ƒ | j ƒ  } | d k	 rg | j d k rg t d ƒ } n  | S(   u9   Report the encoding declared by the meta element
        i    u   utf-16beu   utf-16leu   utf-8N(   u   utf-16beu   utf-16le(	   R�   R"   R‚   t   EncodingParserR   t   getEncodingRE   R�   RJ   (   R   R   t   parserR›   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR�   9  s    N(   R0   R1   R2   RE   Rc   R   RN   RL   R‰   R�   RŽ   R�   (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR=   €  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  j |  | j ƒ  ƒ S(   N(   R!   t   __new__t   lower(   R   t   value(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR«   L  s    c         C` s   d |  _  d  S(   Niÿÿÿÿ(   R[   (   R   R­   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   P  s    c         C` s   |  S(   N(    (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   __iter__T  s    c         C` sS   |  j  d } |  _  | t |  ƒ k r/ t ‚ n | d k  rD t ‚ n  |  | | d !S(   Ni   i    (   R[   R   t   StopIterationR;   (   R   t   p(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   __next__W  s    		c         C` s
   |  j  ƒ  S(   N(   R±   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   next_  s    c         C` sY   |  j  } | t |  ƒ k r$ t ‚ n | d k  r9 t ‚ n  | d |  _  } |  | | d !S(   Ni    i   (   R[   R   R¯   R;   (   R   R°   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   previousc  s    			c         C` s+   |  j  t |  ƒ k r t ‚ n  | |  _  d  S(   N(   R[   R   R¯   (   R   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   setPositionl  s    	c         C` s<   |  j  t |  ƒ k r t ‚ n  |  j  d k r4 |  j  Sd  Sd  S(   Ni    (   R[   R   R¯   RE   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   getPositionq  s
    	c         C` s   |  |  j  |  j  d !S(   Ni   (   R   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   getCurrentByte{  s    c         C` sc   |  j  } xJ | t |  ƒ k  rU |  | | d !} | | k rH | |  _ | S| d 7} q W| |  _ d S(   u   Skip past a list of charactersi   N(   R   R   R[   RE   (   R   Rz   R°   R{   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRo   €  s    			c         C` sc   |  j  } xJ | t |  ƒ k  rU |  | | d !} | | k rH | |  _ | S| d 7} q W| |  _ d  S(   Ni   (   R   R   R[   RE   (   R   Rz   R°   R{   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt	   skipUntilŒ  s    			c         C` sQ   |  j  } |  | | t | ƒ !} | j | ƒ } | rM |  j  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   R‘   (   R   R!   R°   R'   R+   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt
   matchBytes—  s    	c         C` sh   |  |  j  j | ƒ } | d k r^ |  j d k r= d |  _ n  |  j | t | ƒ d 7_ t St ‚ 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 matchiÿÿÿÿi    i   N(   R   t   findR[   R   Rc   R¯   (   R   R!   t   newPosition(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   jumpTo¢  s    (   R0   R1   R2   R«   R   R®   R±   R²   R³   R´   Rµ   t   propertyR   R¶   t   currentBytet   spaceCharactersBytesRo   R·   R¸   R»   (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRª   H  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'   RE   R›   (   R   R'   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   ³  s    c         C` sÎ   d |  j  f d |  j f d |  j f d |  j f d |  j f d |  j f f } xv |  j D]k } t } xR | D]J \ } } |  j j | ƒ rk y | ƒ  } PWqµ t k
 r± t	 } Pqµ Xqk qk W| sX PqX qX W|  j
 S(   Ns   <!--s   <metas   </s   <!s   <?R   (   t   handleCommentt
   handleMetat   handlePossibleEndTagt   handleOthert   handlePossibleStartTagR'   Rc   R¸   R¯   R8   R›   (   R   t   methodDispatchRh   t   keepParsingt   keyt   method(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR¨   ¸  s&    	c         C` s   |  j  j d ƒ S(   u   Skip over commentss   -->(   R'   R»   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR¿   Ï  s    c         C` sK  |  j  j t k r t St } d  } x"t rF|  j ƒ  } | d  k rG t S| d d k r‰ | d d k } | rC| d  k	 rC| |  _ t Sq% | d d k rË | d } t | ƒ } | d  k	 rC| |  _ t Sq% | d d k r% t	 t
 | d ƒ ƒ } | j ƒ  } | d  k	 rCt | ƒ } | d  k	 r@| r4| |  _ t S| } q@qCq% q% Wd  S(   Ni    s
   http-equivi   s   content-typet   charsett   content(   R'   R½   R¾   Rc   R8   RE   t   getAttributeR›   RJ   t   ContentAttrParserRª   t   parse(   R   t	   hasPragmat   pendingEncodingt   attrt   tentativeEncodingt   codect   contentParser(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÀ   Ó  s:    		
		c         C` s   |  j  t ƒ S(   N(   t   handlePossibleTagR8   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÃ   ÷  s    c         C` s   t  |  j ƒ |  j t ƒ S(   N(   R²   R'   RÓ   Rc   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÁ   ú  s    c         C` s�   |  j  } | j t k r9 | r5 | j ƒ  |  j ƒ  n  t S| j t ƒ } | d k ra | j ƒ  n+ |  j ƒ  } x | d  k	 r‹ |  j ƒ  } qp Wt S(   NR   (
   R'   R½   t   asciiLettersBytesR³   RÂ   Rc   R·   t   spacesAngleBracketsRÊ   RE   (   R   t   endTagR'   R{   RÏ   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÓ   þ  s    	
c         C` s   |  j  j d ƒ S(   NR   (   R'   R»   (   R   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÂ     s    c         C` sš  |  j  } | j t t d g ƒ Bƒ } | d k r5 d Sg  } g  } x¦ t ré | d k r` | r` Pnz | t k r| | j ƒ  } Pn^ | d	 k r› d j | ƒ d f S| t k r½ | j | j	 ƒ  ƒ n | d k rÍ d S| j | ƒ t
 | ƒ } qD W| d k r| j ƒ  d j | ƒ d f St
 | ƒ | j ƒ  } | d
 k r¸| } xØ t r´t
 | ƒ } | | k r‚t
 | ƒ d j | ƒ d j | ƒ f S| t k r¤| j | j	 ƒ  ƒ q>| j | ƒ q>Wn^ | d k r×d j | ƒ d f S| t k rù| j | j	 ƒ  ƒ n | d k r	d S| j | ƒ x} t r•t
 | ƒ } | t k rSd j | ƒ d j | ƒ f S| t k ru| j | j	 ƒ  ƒ q| d k r…d S| j | ƒ qWd S(   u_   Return a name,value pair for the next attribute in the stream,
        if one is found, or Nonet   /R   t   =R(   t   't   "N(   R   N(   R×   R   (   RÙ   RÚ   (   R'   Ro   R¾   t	   frozensetRE   Rc   R)   t   asciiUppercaseBytesR&   R¬   R²   R³   RÕ   (   R   R'   R{   t   attrNamet	   attrValuet	   quoteChar(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÊ     sf    		

	
	(   R0   R1   R2   R   R¨   R¿   RÀ   RÃ   RÁ   RÓ   RÂ   RÊ   (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR§   °  s   				$				RË   c           B` s   e  Z d  „  Z d „  Z RS(   c         C` s   | |  _  d  S(   N(   R'   (   R   R'   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyR   f  s    c         C` s:  y!|  j  j d ƒ |  j  j d 7_ |  j  j ƒ  |  j  j d k sH d  S|  j  j d 7_ |  j  j ƒ  |  j  j d k rÐ |  j  j } |  j  j d 7_ |  j  j } |  j  j | ƒ rÉ |  j  | |  j  j !Sd  SnP |  j  j } y( |  j  j t ƒ |  j  | |  j  j !SWn t k
 r|  j  | SXWn t k
 r5d  SXd  S(   NRÈ   i   RØ   RÚ   RÙ   (   RÚ   RÙ   (	   R'   R»   R   Ro   R½   RE   R·   R¾   R¯   (   R   t	   quoteMarkt   oldPosition(    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRÌ   j  s.    (   R0   R1   R   RÌ   (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRË   e  s   	c         C` sw   t  |  t ƒ r: y |  j d ƒ }  Wq: t k
 r6 d SXn  |  d k	 ro y t j |  ƒ SWqs t k
 rk d SXn 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   asciiN(   R3   R   t   decodet   UnicodeDecodeErrorRE   R   t   lookupt   AttributeError(   R›   (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyRJ   Œ  s    (4   t
   __future__R    R   R   t   pip._vendor.sixR   R   t   pip._vendor.six.movesR   R   Rž   Ru   t   pip._vendorR   t	   constantsR   R	   R
   R   R   R(   R   t   ioR   R   R“   RÛ   R$   t   encodeR¾   RÔ   RÜ   RÕ   t   invalid_unicode_no_surrogateRD   Rv   t   evalRf   t   setRn   t   ascii_punctuation_reRs   t   objectR   RC   R<   R=   R!   Rª   R§   RË   RJ   (    (    (    sE   /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/_inputstream.pyt   <module>   sP   "
(((	J	æÈhµ'