o
    Ëý°ja~  ã                   @   s®  d dl mZmZmZ d dlmZ d dlmZmZ d dl	Z	d dl
Z
d dlmZm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 edd„ eD ƒƒZedd„ eD ƒƒZedd„ eD ƒƒZeeddgƒB ZdZejr�ed dkr{e d¡dks}J ‚e
  edd… e!dƒ d ¡Z"ne
  e¡Z"h d£Z#e
  d¡Z$i Z%G dd„ de&ƒZ'dd„ Z(G dd„ de&ƒZ)G dd„ de)ƒZ*G dd „ d e+ƒZ,G d!d"„ d"e&ƒZ-G d#d$„ d$e&ƒZ.d%d&„ Z/dS )'é    )Úabsolute_importÚdivisionÚunicode_literals)Ú	text_type)Úhttp_clientÚurllibN)ÚBytesIOÚStringIO)Úwebencodingsé   )ÚEOFÚspaceCharactersÚasciiLettersÚasciiUppercase)Ú_ReparseException)Ú_utilsc                 C   ó   g | ]}|  d ¡‘qS ©Úascii©Úencode©Ú.0Úitem© r   ú”/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pip/_vendor/html5lib/_inputstream.pyÚ
<listcomp>   ó    r   c                 C   r   r   r   r   r   r   r   r      r   c                 C   r   r   r   r   r   r   r   r      r   ó   >ó   <uš   [---ÂŸï·�-ï·¯ï¿¾ï¿¿ðŸ¿¾ðŸ¿¿ð¯¿¾ð¯¿¿ð¿¿¾ð¿¿¿ñ�¿¾ñ�¿¿ñŸ¿¾ñŸ¿¿ñ¯¿¾ñ¯¿¿ñ¿¿¾ñ¿¿¿ò�¿¾ò�¿¿òŸ¿¾òŸ¿¿ò¯¿¾ò¯¿¿ò¿¿¾ò¿¿¿ó�¿¾ó�¿¿óŸ¿¾óŸ¿¿ó¯¿¾ó¯¿¿ó¿¿¾ó¿¿¿ô�¿¾ô�¿¿]éÿÿÿÿú]z"\uD800-\uDFFF">    éþÿ éþÿ éþÿ éþÿ éþÿ éþÿ éþÿ éþÿ éþÿ	 éþÿ
 éþÿ éþÿ éþÿ éþÿ éþÿ éþÿ éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ	 éÿÿ
 éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ éÿÿ z[	- -/:-@\[-`{-~]c                   @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚBufferedStreamzÆ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 )Nr    r   )ÚstreamÚbufferÚposition)ÚselfrC   r   r   r   Ú__init__:   s   zBufferedStream.__init__c                 C   s<   d}| j d | jd … D ]}|t|ƒ7 }q|| jd 7 }|S ©Nr   r   )rD   rE   Úlen)rF   ÚposÚchunkr   r   r   Útell?   s
   zBufferedStream.tellc                 C   sd   ||   ¡ ksJ ‚|}d}t| j| ƒ|k r+|t| j| ƒ8 }|d7 }t| j| ƒ|k s||g| _d S rH   )Ú_bufferedBytesrI   rD   rE   )rF   rJ   ÚoffsetÚir   r   r   ÚseekF   s   þzBufferedStream.seekc                 C   sP   | j s|  |¡S | jd t| j ƒkr#| jd t| j d ƒkr#|  |¡S |  |¡S )Nr   r   r    )rD   Ú_readStreamrE   rI   Ú_readFromBuffer©rF   Úbytesr   r   r   ÚreadO   s   


zBufferedStream.readc                 C   s   t dd„ | jD ƒƒS )Nc                 S   s   g | ]}t |ƒ‘qS r   )rI   r   r   r   r   r   Y   s    z1BufferedStream._bufferedBytes.<locals>.<listcomp>)ÚsumrD   ©rF   r   r   r   rM   X   ó   zBufferedStream._bufferedBytesc                 C   s<   | j  |¡}| j |¡ | jd  d7  < t|ƒ| jd< |S rH   )rC   rU   rD   ÚappendrE   rI   )rF   rT   Údatar   r   r   rQ   [   s
   zBufferedStream._readStreamc                 C   sä   |}g }| j d }| j d }|t| jƒk rc|dkrc|dksJ ‚| j| }|t|ƒ| kr6|}||| g| _ nt|ƒ| }|t|ƒg| _ |d7 }| |||| … ¡ ||8 }d}|t| jƒk rc|dks|rm| |  |¡¡ d |¡S )Nr   r   ó    )rE   rI   rD   rY   rQ   Újoin)rF   rT   ÚremainingBytesÚrvÚbufferIndexÚbufferOffsetÚbufferedDataÚbytesToReadr   r   r   rR   b   s(   


ò
zBufferedStream._readFromBufferN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rG   rL   rP   rU   rM   rQ   rR   r   r   r   r   rB   3   s    		rB   c                 K   s–   t | tjƒst | tjjƒrt | jtjƒrd}nt| dƒr%t |  d¡t	ƒ}nt | t	ƒ}|rCdd„ |D ƒ}|r;t
d| ƒ‚t| fi |¤ŽS t| fi |¤ŽS )NFrU   r   c                 S   s   g | ]	}|  d ¡r|‘qS )Ú	_encoding)Úendswith)r   Úxr   r   r   r   ‹   s    z#HTMLInputStream.<locals>.<listcomp>z3Cannot set an encoding with a unicode input, set %r)Ú
isinstancer   ÚHTTPResponser   ÚresponseÚaddbaseÚfpÚhasattrrU   r   Ú	TypeErrorÚHTMLUnicodeInputStreamÚHTMLBinaryInputStream)ÚsourceÚkwargsÚ	isUnicodeÚ	encodingsr   r   r   ÚHTMLInputStream}   s   þý

rw   c                   @   sp   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Z	dd„ Z
ddd„Zdd„ Zdd„ Zddd„Zdd„ ZdS )rq   ú×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   sZ   t jsd| _ntdƒdkr| j| _n| j| _dg| _tdƒdf| _|  	|¡| _
|  ¡  dS )á¿  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)

        Nu   ô�¿¿r   r   úutf-8Úcertain)r   Úsupports_lone_surrogatesÚreportCharacterErrorsrI   ÚcharacterErrorsUCS4ÚcharacterErrorsUCS2ÚnewLinesÚlookupEncodingÚcharEncodingÚ
openStreamÚ
dataStreamÚreset)rF   rs   r   r   r   rG   ž   s   
zHTMLUnicodeInputStream.__init__c                 C   s.   d| _ d| _d| _g | _d| _d| _d | _d S )NÚ r   )rK   Ú	chunkSizeÚchunkOffsetÚerrorsÚprevNumLinesÚprevNumColsÚ_bufferedCharacterrW   r   r   r   r…   ¾   s   
zHTMLUnicodeInputStream.resetc                 C   s   t |dƒr	|}|S t|ƒ}|S ©zvProduces a file object from source.

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

        rU   )ro   r	   ©rF   rs   rC   r   r   r   rƒ   Ì   s
   
þz!HTMLUnicodeInputStream.openStreamc                 C   sZ   | j }| dd|¡}| j| }| dd|¡}|dkr#| j| }||fS ||d  }||fS )NÚ
r   r    r   )rK   ÚcountrŠ   Úrfindr‹   )rF   rN   rK   ÚnLinesÚpositionLineÚlastLinePosÚpositionColumnr   r   r   Ú	_positionÚ   s   

ÿz HTMLUnicodeInputStream._positionc                 C   s   |   | j¡\}}|d |fS )z:Returns (line, col) of the current position in the stream.r   )r–   rˆ   )rF   ÚlineÚcolr   r   r   rE   å   s   zHTMLUnicodeInputStream.positionc                 C   s6   | j | jkr|  ¡ stS | j }| j| }|d | _ |S )zo Read one character from the stream or queue if available. Return
            EOF when EOF is reached.
        r   )rˆ   r‡   Ú	readChunkr   rK   )rF   rˆ   Úcharr   r   r   rš   ê   s   

zHTMLUnicodeInputStream.charNc                 C   sê   |d u r| j }|  | j¡\| _| _d| _d| _d| _| j |¡}| j	r,| j	| }d | _	n|s0dS t
|ƒdkrWt|d ƒ}|dksLd|  krJdkrWn n|d | _	|d d… }| jr_|  |¡ | d	d
¡}| dd
¡}|| _t
|ƒ| _dS )Nr†   r   Fr   r    é   é Ø  iÿÛ  z
r�   úT)Ú_defaultChunkSizer–   r‡   rŠ   r‹   rK   rˆ   r„   rU   rŒ   rI   Úordr}   Úreplace)rF   r‡   rZ   Úlastvr   r   r   r™   ù   s0   
 


z HTMLUnicodeInputStream.readChunkc                 C   s(   t tt |¡ƒƒD ]}| j d¡ q	d S )Núinvalid-codepoint)ÚrangerI   Úinvalid_unicode_reÚfindallr‰   rY   )rF   rZ   Ú_r   r   r   r~     s   ÿz*HTMLUnicodeInputStream.characterErrorsUCS4c                 C   s¶   d}t  |¡D ]Q}|rqt| ¡ ƒ}| ¡ }t |||d … ¡r9t |||d … ¡}|tv r6| j	 
d¡ d}q|dkrP|dkrP|t|ƒd krP| j	 
d¡ qd}| j	 
d¡ qd S )NFé   r¢   Trœ   iÿß  r   )r¤   ÚfinditerrŸ   ÚgroupÚstartr   ÚisSurrogatePairÚsurrogatePairToCodepointÚnon_bmp_invalid_codepointsr‰   rY   rI   )rF   rZ   ÚskipÚmatchÚ	codepointrJ   Úchar_valr   r   r   r   #  s"   ïz*HTMLUnicodeInputStream.characterErrorsUCS2Fc           
      C   s  zt ||f }W n4 ty<   	 |D ]
}t|ƒdk sJ ‚qd dd„ |D ƒ¡}|s-d| }t d| ¡ }t ||f< Y nw g }	 | | j| j¡}|du rT| j| j	krSn*n| 
¡ }|| j	krl| | j| j|… ¡ || _n| | j| jd… ¡ |  ¡ s|nq@d |¡}	|	S )	zð 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.
        Té€   r†   c                 S   s   g | ]}d t |ƒ ‘qS )z\x%02x)rŸ   )r   Úcr   r   r   r   H  s    z5HTMLUnicodeInputStream.charsUntil.<locals>.<listcomp>z^%sz[%s]+N)ÚcharsUntilRegExÚKeyErrorrŸ   r\   ÚreÚcompiler¯   rK   rˆ   r‡   ÚendrY   r™   )
rF   Ú
charactersÚoppositeÚcharsr³   Úregexr^   Úmr¸   Úrr   r   r   Ú
charsUntil:  s:   ù	ÿ
ë
z!HTMLUnicodeInputStream.charsUntilc                 C   sZ   |t ur)| jdkr|| j | _|  jd7  _d S |  jd8  _| j| j |ks+J ‚d S d S rH   )r   rˆ   rK   r‡   )rF   rš   r   r   r   Úungeti  s   
õzHTMLUnicodeInputStream.unget©N)F)rc   rd   re   rf   rž   rG   r…   rƒ   r–   rE   rš   r™   r~   r   r¿   rÀ   r   r   r   r   rq   ”   s     
&
/rq   c                   @   sR   e Zd ZdZ			ddd„Zdd„ Zd	d
„ Zddd„Zdd„ Zdd„ Z	dd„ Z
dS )rr   rx   Núwindows-1252Tc                 C   sn   |   |¡| _t | | j¡ d| _d| _|| _|| _|| _|| _	|| _
|  |¡| _| jd dus1J ‚|  ¡  dS )ry   i   éd   r   N)rƒ   Ú	rawStreamrq   rG   ÚnumBytesMetaÚnumBytesChardetÚoverride_encodingÚtransport_encodingÚsame_origin_parent_encodingÚlikely_encodingÚdefault_encodingÚdetermineEncodingr‚   r…   )rF   rs   rÇ   rÈ   rÉ   rÊ   rË   Ú
useChardetr   r   r   rG   ‚  s   zHTMLBinaryInputStream.__init__c                 C   s&   | j d j | jd¡| _t | ¡ d S )Nr   r    )r‚   Ú
codec_infoÚstreamreaderrÄ   r„   rq   r…   rW   r   r   r   r…   ¬  s   zHTMLBinaryInputStream.resetc                 C   sJ   t |dƒr|}nt|ƒ}z
| | ¡ ¡ W |S  ty$   t|ƒ}Y |S w r�   )ro   r   rP   rL   Ú	ExceptionrB   rŽ   r   r   r   rƒ   °  s   
ý
ýz HTMLBinaryInputStream.openStreamc                 C   s�  |   ¡ df}|d d ur|S t| jƒdf}|d d ur|S t| jƒdf}|d d ur,|S |  ¡ df}|d d ur:|S t| jƒdf}|d d urQ|d j d¡sQ|S t| jƒdf}|d d ur`|S |r³zddl	m
} W n	 tys   Y n@w g }|ƒ }|jsš| j | j¡}t|tƒsŠJ ‚|s�n| |¡ | |¡ |jr|| ¡  t|jd ƒ}| j d¡ |d ur³|dfS t| jƒdf}|d d urÂ|S tdƒdfS )Nr{   r   Ú	tentativezutf-16)ÚUniversalDetectorÚencodingrÂ   )Ú	detectBOMr�   rÇ   rÈ   ÚdetectEncodingMetarÉ   ÚnameÚ
startswithrÊ   Ú%pip._vendor.chardet.universaldetectorrÒ   ÚImportErrorÚdonerÄ   rU   rÆ   rj   rT   rY   ÚfeedÚcloseÚresultrP   rË   )rF   Úchardetr‚   rÒ   ÚbuffersÚdetectorrD   rÓ   r   r   r   rÌ   Ã  sV   ÿ

úz'HTMLBinaryInputStream.determineEncodingc                 C   sž   | j d dks	J ‚t|ƒ}|d u rd S |jdv r$tdƒ}|d us"J ‚d S || j d kr5| j d df| _ d S | j d¡ |df| _ |  ¡  td| j d |f ƒ‚)Nr   r{   ©úutf-16beúutf-16lerz   r   zEncoding changed from %s to %s)r‚   r�   rÖ   rÄ   rP   r…   r   )rF   ÚnewEncodingr   r   r   ÚchangeEncoding  s   

z$HTMLBinaryInputStream.changeEncodingc              
   C   s¦   t jdt jdt jdt jdt jdi}| j d¡}t|t	ƒsJ ‚| 
|dd… ¡}d}|s?| 
|¡}d}|s?| 
|dd	… ¡}d	}|rK| j |¡ t|ƒS | j d
¡ dS )z©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 Nonerz   rã   râ   zutf-32lezutf-32beé   Né   r§   r   )ÚcodecsÚBOM_UTF8ÚBOM_UTF16_LEÚBOM_UTF16_BEÚBOM_UTF32_LEÚBOM_UTF32_BErÄ   rU   rj   rT   ÚgetrP   r�   )rF   ÚbomDictÚstringrÓ   rP   r   r   r   rÔ     s&   ý
zHTMLBinaryInputStream.detectBOMc                 C   sV   | j  | j¡}t|tƒsJ ‚t|ƒ}| j  d¡ | ¡ }|dur)|jdv r)t	dƒ}|S )z9Report the encoding declared by the meta element
        r   Nrá   rz   )
rÄ   rU   rÅ   rj   rT   ÚEncodingParserrP   ÚgetEncodingrÖ   r�   )rF   rD   ÚparserrÓ   r   r   r   rÕ   3  s   z(HTMLBinaryInputStream.detectEncodingMeta)NNNNrÂ   T)T)rc   rd   re   rf   rG   r…   rƒ   rÌ   rå   rÔ   rÕ   r   r   r   r   rr   z  s    
þ*
>"rr   c                   @   sŽ   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zeee
ƒZdd„ ZeeƒZefdd„Zdd„ Zdd„ Zdd„ ZdS )ÚEncodingBytesz£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ƒsJ ‚t | | ¡ ¡S rÁ   )rj   rT   Ú__new__Úlower©rF   Úvaluer   r   r   rõ   F  s   zEncodingBytes.__new__c                 C   s
   d| _ d S )Nr    )r–   r÷   r   r   r   rG   J  s   
zEncodingBytes.__init__c                 C   s   | S rÁ   r   rW   r   r   r   Ú__iter__N  s   zEncodingBytes.__iter__c                 C   s<   | j d  }| _ |t| ƒkrt‚|dk rt‚| ||d … S )Nr   r   ©r–   rI   ÚStopIterationrp   ©rF   Úpr   r   r   Ú__next__Q  s   zEncodingBytes.__next__c                 C   s   |   ¡ S rÁ   )rþ   rW   r   r   r   ÚnextY  s   zEncodingBytes.nextc                 C   s@   | j }|t| ƒkrt‚|dk rt‚|d  | _ }| ||d … S rH   rú   rü   r   r   r   Úprevious]  s   zEncodingBytes.previousc                 C   s   | j t| ƒkr	t‚|| _ d S rÁ   ©r–   rI   rû   )rF   rE   r   r   r   ÚsetPositionf  s   
zEncodingBytes.setPositionc                 C   s&   | j t| ƒkr	t‚| j dkr| j S d S )Nr   r  rW   r   r   r   ÚgetPositionk  s
   
zEncodingBytes.getPositionc                 C   s   | | j | j d … S ©Nr   )rE   rW   r   r   r   ÚgetCurrentByteu  rX   zEncodingBytes.getCurrentBytec                 C   sR   | j }|t| ƒk r$| ||d … }||vr|| _|S |d7 }|t| ƒk s	|| _dS )zSkip past a list of charactersr   N©rE   rI   r–   ©rF   r»   rý   r³   r   r   r   r®   z  s   ûzEncodingBytes.skipc                 C   sR   | j }|t| ƒk r$| ||d … }||v r|| _|S |d7 }|t| ƒk s	|| _d S r  r  r  r   r   r   Ú	skipUntil†  s   ûzEncodingBytes.skipUntilc                 C   s(   |   || j¡}|r|  jt|ƒ7  _|S )zÓ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×   rE   rI   )rF   rT   r^   r   r   r   Ú
matchBytes‘  s   zEncodingBytes.matchBytesc                 C   s6   z|   || j¡t|ƒ d | _W dS  ty   t‚w )z�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 matchr   T)ÚindexrE   rI   r–   Ú
ValueErrorrû   rS   r   r   r   ÚjumpToš  s   þÿzEncodingBytes.jumpToN)rc   rd   re   rf   rõ   rG   rù   rþ   rÿ   r   r  r  ÚpropertyrE   r  ÚcurrentByteÚspaceCharactersBytesr®   r  r	  r  r   r   r   r   rô   B  s"    	
	rô   c                   @   sX   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )rñ   z?Mini parser for detecting character encoding from meta elementsc                 C   s   t |ƒ| _d| _dS )z3string - the data to work on for encoding detectionN)rô   rZ   rÓ   ©rF   rZ   r   r   r   rG   §  s   

zEncodingParser.__init__c              
   C   sÎ   d| j vrd S d| jfd| jfd| jfd| jfd| jfd| jff}| j D ]?}d}z| j  d¡ W n ty<   Y  | j	S w |D ]\}}| j  |¡r\z|ƒ }W  n ty[   d}Y  nw q?|sc | j	S q$| j	S )	Ns   <metas   <!--s   </s   <!s   <?r   TF)
rZ   ÚhandleCommentÚ
handleMetaÚhandlePossibleEndTagÚhandleOtherÚhandlePossibleStartTagr  rû   r	  rÓ   )rF   ÚmethodDispatchr¦   ÚkeepParsingÚkeyÚmethodr   r   r   rò   ¬  s@   
ú
óþüýzEncodingParser.getEncodingc                 C   ó   | j  d¡S )zSkip over commentss   -->©rZ   r  rW   r   r   r   r  Ê  s   zEncodingParser.handleCommentc                 C   sÞ   | j jtvrdS d}d }	 |  ¡ }|d u rdS |d dkr/|d dk}|r.|d ur.|| _dS n?|d dkrG|d }t|ƒ}|d urF|| _dS n'|d dkrntt|d ƒƒ}| ¡ }|d urnt|ƒ}|d urn|rl|| _dS |}q)	NTFr   s
   http-equivr   s   content-typeó   charsets   content)	rZ   r  r  ÚgetAttributerÓ   r�   ÚContentAttrParserrô   Úparse)rF   Ú	hasPragmaÚpendingEncodingÚattrÚtentativeEncodingÚcodecÚcontentParserr   r   r   r  Î  s@   €þåzEncodingParser.handleMetac                 C   s
   |   d¡S )NF)ÚhandlePossibleTagrW   r   r   r   r  ò  s   
z%EncodingParser.handlePossibleStartTagc                 C   s   t | jƒ |  d¡S )NT)rÿ   rZ   r&  rW   r   r   r   r  õ  s   

z#EncodingParser.handlePossibleEndTagc                 C   sj   | j }|jtvr|r| ¡  |  ¡  dS | t¡}|dkr#| ¡  dS |  ¡ }|d ur3|  ¡ }|d us+dS )NTr   )rZ   r  ÚasciiLettersBytesr   r  r  ÚspacesAngleBracketsr  )rF   ÚendTagrZ   r³   r"  r   r   r   r&  ù  s   

ýÿz EncodingParser.handlePossibleTagc                 C   r  )Nr   r  rW   r   r   r   r    s   zEncodingParser.handleOtherc                 C   sÜ  | j }| ttdgƒB ¡}|du st|ƒdksJ ‚|dv rdS g }g }	 |dkr+|r+n0|tv r4| ¡ }n'|dv r?d |¡dfS |tv rK| | ¡ ¡ n|du rQdS | |¡ t	|ƒ}q$|dkrj| 
¡  d |¡dfS t	|ƒ | ¡ }|d	v r¡|}	 t	|ƒ}||kr�t	|ƒ d |¡d |¡fS |tv r›| | ¡ ¡ n| |¡ qy|d
kr¬d |¡dfS |tv r¸| | ¡ ¡ n|du r¾dS | |¡ 	 t	|ƒ}|tv rÖd |¡d |¡fS |tv râ| | ¡ ¡ n|du rèdS | |¡ qÄ)z_Return a name,value pair for the next attribute in the stream,
        if one is found, or Noneó   /Nr   )r   NTó   =)r*  r   r[   )ó   'ó   "r   )rZ   r®   r  Ú	frozensetrI   r\   ÚasciiUppercaseBytesrY   rö   rÿ   r   r(  )rF   rZ   r³   ÚattrNameÚ	attrValueÚ	quoteCharr   r   r   r    sn   
ð
ô

÷zEncodingParser.getAttributeN)rc   rd   re   rf   rG   rò   r  r  r  r  r&  r  r  r   r   r   r   rñ   ¤  s    $rñ   c                   @   s   e Zd Zdd„ Zdd„ ZdS )r  c                 C   s   t |tƒsJ ‚|| _d S rÁ   )rj   rT   rZ   r  r   r   r   rG   a  s   
zContentAttrParser.__init__c                 C   s  zy| j  d¡ | j  jd7  _| j  ¡  | j jdksW d S | j  jd7  _| j  ¡  | j jdv rS| j j}| j  jd7  _| j j}| j  |¡rP| j || j j… W S W d S | j j}z| j  t¡ | j || j j… W W S  tyy   | j |d …  Y W S w  tyƒ   Y d S w )Nr  r   r+  )r-  r,  )rZ   r  rE   r®   r  r  r  rû   )rF   Ú	quoteMarkÚoldPositionr   r   r   r  e  s2   

þÿzContentAttrParser.parseN)rc   rd   re   rG   r  r   r   r   r   r  `  s    r  c                 C   s\   t | tƒrz|  d¡} W n
 ty   Y dS w | dur,zt | ¡W S  ty+   Y dS w dS )z{Return the python codec name corresponding to an encoding or None if the
    string doesn't correspond to a valid encoding.r   N)rj   rT   ÚdecodeÚUnicodeDecodeErrorr
   ÚlookupÚAttributeError)rÓ   r   r   r   r�   ‡  s   
ÿÿr�   )0Ú
__future__r   r   r   Úpip._vendor.sixr   Úpip._vendor.six.movesr   r   rè   r¶   Úior   r	   Úpip._vendorr
   Ú	constantsr   r   r   r   r   r†   r   r.  r  r'  r/  r(  Úinvalid_unicode_no_surrogater|   r�   r·   Úevalr¤   r­   Úascii_punctuation_rer´   ÚobjectrB   rw   rq   rr   rT   rô   rñ   r  r�   r   r   r   r   Ú<module>   sJ    ÿþ

J g Ib ='