File "_inputstream.cpython-38.opt-1.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/usr/lib/python3.8/site-packages/pip/_vendor/html5lib/__pycache__/_inputstream.cpython-38.opt-1.pyc
File size: 20.96 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

U

.e(!@sddlmZmZmZddlmZmZddlmZm	Z	ddl
Z
ddlZddlm
Z
ddlmZmZmZmZddlmZdd	lmZdd
lmZzddlmZWnek
reZYnXedd
eDZedd
eDZedd
eDZeeddgBZdZej r(e!edde"ddZ#n
e!eZ#e$ddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5g Z%e!d6Z&iZ'Gd7d8d8e(Z)d9d:Z*Gd;d<d<e(Z+Gd=d>d>e+Z,Gd?d@d@e-Z.GdAdBdBe(Z/GdCdDdDe(Z0dEdFZ1dS)G)absolute_importdivisionunicode_literals)	text_typebinary_type)http_clienturllibN)webencodings)EOFspaceCharactersasciiLettersasciiUppercase)_ReparseException)_utils)StringIO)BytesIOcCsg|]}|dqSasciiencode.0itemrE/usr/lib/python3.8/site-packages/pip/_vendor/html5lib/_inputstream.py
<listcomp>srcCsg|]}|dqSrrrrrrrscCsg|]}|dqSrrrrrrrs><u[---Ÿ﷐-﷯￾￿🿾🿿𯿾𯿿𿿾𿿿񏿾񏿿񟿾񟿿񯿾񯿿񿿾񿿿򏿾򏿿򟿾򟿿򯿾򯿿򿿾򿿿󏿾󏿿󟿾󟿿󯿾󯿿󿿾󿿿􏿾􏿿]z"\uD800-\uDFFF"]iiiiiiiiiiiiiiiii	i	i
i
iiiii
i
iiiiiiz[	-
 -/:-@\[-`{-~]c@sHeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
dS)BufferedStreamzBuffering 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)
    cCs||_g|_ddg|_dS)Nrr)streambufferposition)selfr"rrr__init__@szBufferedStream.__init__cCs<d}|jd|jdD]}|t|7}q||jd7}|SNrr
)r#r$len)r%poschunkrrrtellEs
zBufferedStream.tellcCsD|}d}t|j||kr6|t|j|8}|d7}q||g|_dSr')r(r#r$)r%r)offsetirrrseekLs
zBufferedStream.seekcCsT|js||S|jdt|jkrF|jdt|jdkrF||S||SdS)Nrr
r)r#_readStreamr$r(_readFromBuffer)r%bytesrrrreadUs

zBufferedStream.readcCstdd|jDS)NcSsg|]}t|qSr)r(rrrrr_sz1BufferedStream._bufferedBytes.<locals>.<listcomp>)sumr#r%rrr_bufferedBytes^szBufferedStream._bufferedBytescCs<|j|}|j||jdd7<t||jd<|Sr')r"r2r#appendr$r()r%r1datarrrr/as
zBufferedStream._readStreamcCs|}g}|jd}|jd}|t|jkr|dkr|j|}|t||kr`|}|||g|_n"t||}|t|g|_|d7}|||||||8}d}q|r|||d|S)Nrr
)r$r(r#r6r/join)r%r1ZremainingBytesrvZbufferIndexZbufferOffsetZbufferedDataZbytesToReadrrrr0hs$


zBufferedStream._readFromBufferN)__name__
__module____qualname____doc__r&r+r.r2r5r/r0rrrrr!9s		r!cKst|tjs(t|tjjr.t|jtjr.d}n&t|drJt|dt	}n
t|t	}|rdd|D}|rvt
d|t|f|St|f|SdS)NFr2rcSsg|]}|dr|qS)Z	_encoding)endswith)rxrrrrs
z#HTMLInputStream.<locals>.<listcomp>z3Cannot set an encoding with a unicode input, set %r)
isinstancerZHTTPResponserZresponseZaddbasefphasattrr2r	TypeErrorHTMLUnicodeInputStreamHTMLBinaryInputStream)sourcekwargsZ	isUnicodeZ	encodingsrrrHTMLInputStreams

rIc@speZdZdZdZddZddZddZd	d
ZddZ	d
dZ
dddZddZddZ
dddZddZdS)rEProvides 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(cCsZtjsd|_ntddkr$|j|_n|j|_dg|_tddf|_|	||_
|dS)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
rutf-8certain)rsupports_lone_surrogatesreportCharacterErrorsr(characterErrorsUCS4characterErrorsUCS2ZnewLineslookupEncodingcharEncoding
openStream
dataStreamreset)r%rGrrrr&s
zHTMLUnicodeInputStream.__init__cCs.d|_d|_d|_g|_d|_d|_d|_dS)Nr)r*	chunkSizechunkOffseterrorsprevNumLinesprevNumCols_bufferedCharacterr4rrrrVszHTMLUnicodeInputStream.resetcCst|dr|}nt|}|SzvProduces a file object from source.

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

        r2)rCrr%rGr"rrrrTs
z!HTMLUnicodeInputStream.openStreamcCsT|j}|dd|}|j|}|dd|}|dkr@|j|}n||d}||fS)N
rrr
)r*countr[rfindr\)r%r,r*ZnLinesZpositionLineZlastLinePosZpositionColumnrrr	_positions
z HTMLUnicodeInputStream._positioncCs||j\}}|d|fS)z:Returns (line, col) of the current position in the stream.r
)rcrY)r%linecolrrrr$szHTMLUnicodeInputStream.positioncCs6|j|jkr|stS|j}|j|}|d|_|S)zo Read one character from the stream or queue if available. Return
            EOF when EOF is reached.
        r
)rYrX	readChunkrr*)r%rYcharrrrrgs

zHTMLUnicodeInputStream.charNcCs|dkr|j}||j\|_|_d|_d|_d|_|j|}|j	rX|j	|}d|_	n|s`dSt
|dkrt|d}|dksd|krdkrnn|d|_	|dd}|jr|||
d	d
}|
dd
}||_t
||_dS)
NrWrFr
r
iz
r`
T)_defaultChunkSizercrXr[r\r*rYrUr2r]r(ordrOreplace)r%rXr7Zlastvrrrrfs0
 


z HTMLUnicodeInputStream.readChunkcCs(ttt|D]}|jdqdS)Ninvalid-codepoint)ranger(invalid_unicode_refindallrZr6)r%r7_rrrrP%sz*HTMLUnicodeInputStream.characterErrorsUCS4cCsd}t|D]}|rqt|}|}t|||drrt|||d}|tkrl|j	
dd}q|dkr|dkr|t|dkr|j	
dqd}|j	
dqdS)NFrnTriir
)rpfinditerrlgroupstartrZisSurrogatePairZsurrogatePairToCodepointnon_bmp_invalid_codepointsrZr6r()r%r7skipmatchZ	codepointr)Zchar_valrrrrQ)s"z*HTMLUnicodeInputStream.characterErrorsUCS2Fc	Cszt||f}WnNtk
r^ddd|D}|s@d|}td|}t||f<YnXg}||j|j}|dkr|j|jkrqn0|	}||jkr|
|j|j|||_q|
|j|jd|sdqqdd|}|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.
        rWcSsg|]}dt|qS)z\x%02x)rl)rcrrrrNsz5HTMLUnicodeInputStream.charsUntil.<locals>.<listcomp>z^%sz[%s]+N)charsUntilRegExKeyErrorr9recompileryr*rYrXendr6rf)	r%Z
charactersZoppositecharsZregexr:mrrrrr
charsUntil@s, 

z!HTMLUnicodeInputStream.charsUntilcCs@|dk	r<|jdkr.||j|_|jd7_n|jd8_dSr')rYr*rX)r%rgrrrungetos
zHTMLUnicodeInputStream.unget)N)F)r;r<r=r>rkr&rVrTrcr$rgrfrPrQrrrrrrrEs 
&
/rEc@sLeZdZdZdddZddZd	d
ZdddZd
dZddZ	ddZ
dS)rFrJNwindows-1252TcCs\|||_t||jd|_d|_||_||_||_||_	||_
|||_|
dS)rKidN)rT	rawStreamrEr&numBytesMetanumBytesChardetoverride_encodingtransport_encodingsame_origin_parent_encodinglikely_encodingdefault_encodingdetermineEncodingrSrV)r%rGrrrrrZ
useChardetrrrr&szHTMLBinaryInputStream.__init__cCs&|jdj|jd|_t|dS)Nrrm)rSZ
codec_infostreamreaderrrUrErVr4rrrrVszHTMLBinaryInputStream.resetcCsDt|dr|}nt|}z||Wnt|}YnX|Sr^)rCrr.r+r!r_rrrrTs
z HTMLBinaryInputStream.openStreamcCs|df}|ddk	r|St|jdf}|ddk	r:|St|jdf}|ddk	rX|S|df}|ddk	rt|St|jdf}|ddk	r|djds|St|jdf}|ddk	r|S|r`zddl	m
}Wntk
rYnvXg}|}|js,|j
|j}|sq,||||q|t|jd}|j
d|dk	r`|dfSt|jdf}|ddk	r|StddfS)NrMrZ	tentativezutf-16)UniversalDetectorencodingr)	detectBOMrRrrdetectEncodingMetarname
startswithrZ%pip._vendor.chardet.universaldetectorrImportErrorZdonerr2rr6Zfeedcloseresultr.r)r%ZchardetrSrZbuffersZdetectorr#rrrrrsP

z'HTMLBinaryInputStream.determineEncodingcCst|}|dkrdS|jdkr(td}nT||jdkrH|jddf|_n4|jd|df|_|td|jd|fdS)Nutf-16beutf-16lerLrrMzEncoding changed from %s to %s)rRrrSrr.rVr)r%ZnewEncodingrrrchangeEncodings

z$HTMLBinaryInputStream.changeEncodingc
Cstjdtjdtjdtjdtjdi}|jd}||dd}d}|sp||}d}|sp||dd	}d	}|r|j	|t
|S|j	d
dSdS)zAttempts 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 NonerLrrzutf-32lezutf-32beNrsr)codecsBOM_UTF8BOM_UTF16_LEBOM_UTF16_BEBOM_UTF32_LEBOM_UTF32_BErr2getr.rR)r%ZbomDictstringrr.rrrrs2
zHTMLBinaryInputStream.detectBOMcCsH|j|j}t|}|jd|}|dk	rD|jdkrDtd}|S)z9Report the encoding declared by the meta element
        rNrrL)rr2rEncodingParserr.getEncodingrrR)r%r#parserrrrrr9sz(HTMLBinaryInputStream.detectEncodingMeta)NNNNrT)T)r;r<r=r>r&rVrTrrrrrrrrrFs
*
>"rFc@seZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZeee
Z
ddZeeZefddZddZddZddZdS)
EncodingByteszString-like object with an associated position and various extra methods
    If the position is ever greater than the string length then an exception is
    raisedcCst||SN)r1__new__lowerr%valuerrrrLszEncodingBytes.__new__cCs
d|_dS)Nr)rcrrrrr&PszEncodingBytes.__init__cCs|Srrr4rrr__iter__TszEncodingBytes.__iter__cCs>|jd}|_|t|kr"tn|dkr.t|||dS)Nr
rrcr(
StopIterationrDr%prrr__next__WszEncodingBytes.__next__cCs|Sr)rr4rrrnext_szEncodingBytes.nextcCsB|j}|t|krtn|dkr$t|d|_}|||dSr'rrrrrpreviouscszEncodingBytes.previouscCs|jt|krt||_dSrrcr(r)r%r$rrrsetPositionlszEncodingBytes.setPositioncCs*|jt|krt|jdkr"|jSdSdS)Nrrr4rrrgetPositionqs

zEncodingBytes.getPositioncCs||j|jdSNr
)r$r4rrrgetCurrentByte{szEncodingBytes.getCurrentBytecCsH|j}|t|kr>|||d}||kr4||_|S|d7}q||_dS)zSkip past a list of charactersr
Nr$r(rcr%rrrzrrrrxs
zEncodingBytes.skipcCsH|j}|t|kr>|||d}||kr4||_|S|d7}q||_dSrrrrrr	skipUntils
zEncodingBytes.skipUntilcCs>|j}|||t|}||}|r:|jt|7_|S)zLook 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%r1rr7r:rrr
matchBytess
zEncodingBytes.matchBytescCsR||jd|}|dkrJ|jdkr,d|_|j|t|d7_dStdS)zLook for the next sequence of bytes matching a given sequence. If
        a match is found advance the position to the last byte of the matchNrrr
T)r$findrcr(r)r%r1ZnewPositionrrrjumpTos
zEncodingBytes.jumpToN)r;r<r=r>rr&rrrrrrpropertyr$rcurrentBytespaceCharactersBytesrxrrrrrrrrHs 	
rc@sXeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZdS)rz?Mini parser for detecting character encoding from meta elementscCst||_d|_dS)z3string - the data to work on for encoding detectionN)rr7rr%r7rrrr&s
zEncodingParser.__init__c
Csd|jfd|jfd|jfd|jfd|jfd|jff}|jD]Z}d}|D]D\}}|j|rFz|}WqWqFtk
rd}YqYqFXqF|s:qq:|jS)	Ns<!--s<metas</s<!s<?rTF)	
handleComment
handleMetahandlePossibleEndTaghandleOtherhandlePossibleStartTagr7rrr)r%ZmethodDispatchrrZkeepParsingkeymethodrrrrs(

zEncodingParser.getEncodingcCs|jdS)zSkip over commentss-->r7rr4rrrrszEncodingParser.handleCommentcCs|jjtkrdSd}d}|}|dkr,dS|ddkr\|ddk}|r|dk	r||_dSq|ddkr|d}t|}|dk	r||_dSq|ddkrtt|d}|}|dk	rt|}|dk	r|r||_dS|}qdS)	NTFrs
http-equivr
scontent-typecharsetscontent)	r7rrgetAttributerrRContentAttrParserrparse)r%Z	hasPragmaZpendingEncodingattrZtentativeEncodingcodecZ
contentParserrrrrs8zEncodingParser.handleMetacCs
|dS)NF)handlePossibleTagr4rrrrsz%EncodingParser.handlePossibleStartTagcCst|j|dS)NT)rr7rr4rrrrs
z#EncodingParser.handlePossibleEndTagcCsb|j}|jtkr(|r$||dS|t}|dkrD|n|}|dk	r^|}qLdS)NTr)r7rasciiLettersBytesrrrspacesAngleBracketsr)r%ZendTagr7rzrrrrrs



z EncodingParser.handlePossibleTagcCs|jdS)Nrrr4rrrrszEncodingParser.handleOthercCs|j}|ttdgB}|dkr&dSg}g}|dkr>|r>qnX|tkrR|}qnD|dkrhd|dfS|tkr||n|dkrdS||t|}q.|dkr|	d|dfSt||}|dkr2|}t|}||kr
t|d|d|fS|tkr$||q||qnJ|dkrJd|dfS|tkrd||n|dkrrdS||t|}|t
krd|d|fS|tkr||n|dkrdS||q|dS)	z_Return a name,value pair for the next attribute in the stream,
        if one is found, or None/)rNN=)rrr8)'"r)r7rxr	frozensetr9asciiUppercaseBytesr6rrrr)r%r7rzZattrNameZ	attrValueZ	quoteCharrrrrs`











zEncodingParser.getAttributeN)
r;r<r=r>r&rrrrrrrrrrrrrs$rc@seZdZddZddZdS)rcCs
||_dSr)r7rrrrr&fszContentAttrParser.__init__cCsz|jd|jjd7_|j|jjdks<WdS|jjd7_|j|jjdkr|jj}|jjd7_|jj}|j|r|j||jjWSWdSnR|jj}z"|jt|j||jjWWStk
r|j|dYWSXWntk
rYdSXdS)Nrr
r)rr)r7rr$rxrrrr)r%Z	quoteMarkZoldPositionrrrrjs.

zContentAttrParser.parseN)r;r<r=r&rrrrrresrcCsft|tr0z|d}Wntk
r.YdSX|dk	r^zt|WStk
rZYdSXndSdS)z{Return the python codec name corresponding to an encoding or None if the
    string doesn't correspond to a valid encoding.rN)rArdecodeUnicodeDecodeErrorr	lookupAttributeError)rrrrrRs

rR)2Z
__future__rrrZpip._vendor.sixrrZpip._vendor.six.movesrrrr}Zpip._vendorr	Z	constantsrrr
rrrWriorrrrrrrrZinvalid_unicode_no_surrogaterNr~evalrpsetrwZascii_punctuation_rer{objectr!rIrErFr1rrrrRrrrr<module>s


JgIh6'