PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` 3 B;W~)@sddlmZmZmZddlmZmZddlmZm Z ddl Z ddl Z ddl Z ddl mZmZmZmZddl mZddlmZdd lmZydd lmZWnek reZYnXed d eDZed d eDZedd eDZeeddgBZdZejrFedEdkr"ej ddks&t!e j"eddFe#ddZ$n e j"eZ$e%ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3g Z&e j"d4Z'iZ(Gd5d6d6e)Z*d7d8Z+Gd9d:d:e)Z,Gd;d<dd>e.Z/Gd?d@d@e)Z0GdAdBdBe)Z1dCdDZ2dS)G)absolute_importdivisionunicode_literals) text_type binary_type) http_clienturllibN)EOFspaceCharacters asciiLettersasciiUppercase)ReparseException)_utils)StringIO)BytesIOcCsg|]}|jdqS)ascii)encode).0itemr"/usr/lib/python3.6/_inputstream.py srcCsg|]}|jdqS)r)r)rrrrrrscCsg|]}|jdqS)r)r)rrrrrrs>.)sumr)r!rrrr'^szBufferedStream._bufferedBytescCs<|jj|}|jj||jdd7<t||jd<|S)Nrr )rr/rappendr r#)r!r.datarrrr,as   zBufferedStream._readStreamcCs|}g}|jd}|jd}x|t|jkr|dkr|dks@t|j|}|t||krn|}|||g|_n"t||}|t|g|_|d7}|j||||||8}d}qW|r|j|j|dj|S)Nrr )r r#rr(r1r,join)r!r.ZremainingBytesrvZ bufferIndexZ bufferOffsetZ bufferedDataZ bytesToReadrrrr-hs&     zBufferedStream._readFromBufferN) __name__ __module__ __qualname____doc__r"r&r+r/r'r,r-rrrrr9s  rcKst|tjs(t|tjjr.t|jtjr.d}n&t|drJt|jdt }n t|t }|rdd|D}|rvt d|t |f|St |f|SdS)NFr/rcSsg|]}|jdr|qS)Z _encoding)endswith)rxrrrrsz#HTMLInputStream..z3Cannot set an encoding with a unicode input, set %r) isinstancerZ HTTPResponserZresponseZaddbasefphasattrr/r TypeErrorHTMLUnicodeInputStreamHTMLBinaryInputStream)sourcekwargsZ isUnicodeZ encodingsrrrHTMLInputStreams     rDc@speZdZdZdZddZddZddZd d Zd d Z d dZ dddZ ddZ ddZ dddZddZdS)r@zProvides 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|_|j ||_ |j dS)aInitialises 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 rzutf-8certain) rsupports_lone_surrogatesreportCharacterErrorsr#characterErrorsUCS4characterErrorsUCS2ZnewLineslookupEncoding charEncoding openStream dataStreamreset)r!rBrrrr"s   zHTMLUnicodeInputStream.__init__cCs.d|_d|_d|_g|_d|_d|_d|_dS)Nr)r% chunkSize chunkOffseterrors prevNumLines prevNumCols_bufferedCharacter)r!rrrrNszHTMLUnicodeInputStream.resetcCst|dr|}nt|}|S)zvProduces a file object from source. source can be either a file object, local filename or a string. r/)r>r)r!rBrrrrrLs z!HTMLUnicodeInputStream.openStreamcCsT|j}|jdd|}|j|}|jdd|}|dkr@|j|}n ||d}||fS)N rr r)r%countrSrfindrT)r!r)r%ZnLinesZ positionLineZ lastLinePosZpositionColumnrrr _positions   z HTMLUnicodeInputStream._positioncCs|j|j\}}|d|fS)z:Returns (line, col) of the current position in the stream.r )rYrQ)r!linecolrrrr szHTMLUnicodeInputStream.positioncCs6|j|jkr|jstS|j}|j|}|d|_|S)zo Read one character from the stream or queue if available. Return EOF when EOF is reached. r )rQrP readChunkr r%)r!rQcharrrrr]s   zHTMLUnicodeInputStream.charNcCs|dkr|j}|j|j\|_|_d|_d|_d|_|jj|}|j rX|j |}d|_ n|s`dSt |dkrt |d }|dksd|kodknr|d |_ |dd}|j r|j ||j dd }|j d d }||_t ||_d S)NrOrFr iiz rV Trrr)_defaultChunkSizerYrPrSrTr%rQrMr/rUr#ordrGreplace)r!rPr2Zlastvrrrr\s0           z HTMLUnicodeInputStream.readChunkcCs,x&tttj|D]}|jjdqWdS)Nzinvalid-codepoint)ranger#invalid_unicode_refindallrRr1)r!r2_rrrrH%sz*HTMLUnicodeInputStream.characterErrorsUCS4cCsd}xtj|D]}|rqt|j}|j}tj|||drttj|||d}|tkrn|j j dd}q|dkr|dkr|t |dkr|j j dqd}|j j dqWdS)NFzinvalid-codepointTiir ) rdfinditerragroupstartrZisSurrogatePairZsurrogatePairToCodepointnon_bmp_invalid_codepointsrRr1r#)r!r2skipmatchZ codepointr$Zchar_valrrrrI)s   z*HTMLUnicodeInputStream.characterErrorsUCS2Fc Csyt||f}Wnltk r|x|D]}t|dks&tq&Wdjdd|D}|s^d|}tjd|}t||f<YnXg}x||j|j|j }|dkr|j |j krPn0|j }||j kr|j |j|j |||_ P|j |j|j d|j sPqWdj|} | 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. rOcSsg|]}dt|qS)z\x%02x)ra)rcrrrrNsz5HTMLUnicodeInputStream.charsUntil..z^%sz[%s]+N)charsUntilRegExKeyErrorrar(r4recompilermr%rQrPendr1r\) r!Z charactersZoppositecharsroZregexr5mrtrrrr charsUntil@s2     z!HTMLUnicodeInputStream.charsUntilcCsT|dk rP|jdkr.||j|_|jd7_n"|jd8_|j|j|ksPtdS)Nrr )rQr%rPr()r!r]rrrungetos   zHTMLUnicodeInputStream.unget)N)F)r6r7r8r9r`r"rNrLrYr r]r\rHrIrxryrrrrr@s   & /r@c@sLeZdZdZdddZddZd d Zdd d Zd dZddZ ddZ dS)rAzProvides 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. N windows-1252TcCsn|j||_tj||jd|_d|_||_||_||_||_ ||_ |j ||_ |j ddk sbt |jdS)aInitialises 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) idrN)rL rawStreamr@r" numBytesMetanumBytesChardetoverride_encodingtransport_encodingsame_origin_parent_encodinglikely_encodingdefault_encodingdetermineEncodingrKr(rN)r!rBrrrrrZ useChardetrrrr"s  zHTMLBinaryInputStream.__init__cCs&|jdjj|jd|_tj|dS)Nrrb)rKZ codec_info streamreaderr|rMr@rN)r!rrrrNszHTMLBinaryInputStream.resetc CsDt|dr|}nt|}y|j|jWnt|}YnX|S)zvProduces a file object from source. source can be either a file object, local filename or a string. r/)r>rr+r&r)r!rBrrrrrLs z HTMLBinaryInputStream.openStreamc Cs|jdf}|ddk r|St|jdf}|ddk r:|St|jdf}|ddk rX|S|jdf}|ddk rt|St|jdf}|ddk r|djjd r|St|jdf}|ddk r|S|rtyddl m }Wnt k rYnXg}|}xF|j s>|j j|j}t|ts t|s(P|j||j|qW|jt|jd}|j jd|dk rt|dfSt|jdf}|ddk r|StddfS)NrErZ tentativezutf-16)UniversalDetectorencodingz windows-1252) detectBOMrJrrdetectEncodingMetarname startswithrZchardet.universaldetectorr ImportErrordoner|r/r~r<r.r(r1Zfeedcloseresultr+r)r!ZchardetrKrZbuffersZdetectorrrrrrrsR           z'HTMLBinaryInputStream.determineEncodingcCs|jddkstt|}|dkr&dS|jdkrFtd}|dk stnT||jdkrf|jddf|_n4|jjd|df|_|jtd|jd|fdS) Nr rEutf-16beutf-16lezutf-8rzEncoding changed from %s to %s)rr)rKr(rJrr|r+rNr)r!Z newEncodingrrrchangeEncodings   z$HTMLBinaryInputStream.changeEncodingc Cstjdtjdtjdtjdtjdi}|jjd}t|t s"rAc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e e e 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|tsttj||jS)N)r<r.r(__new__lower)r!valuerrrrLszEncodingBytes.__new__cCs d|_dS)Nr r)rY)r!rrrrr"PszEncodingBytes.__init__cCs|S)Nr)r!rrr__iter__TszEncodingBytes.__iter__cCs>|jd}|_|t|kr"tn |dkr.t|||dS)Nr r)rYr# StopIterationr?)r!prrr__next__Ws  zEncodingBytes.__next__cCs|jS)N)r)r!rrrnext_szEncodingBytes.nextcCsB|j}|t|krtn |dkr$t|d|_}|||dS)Nrr )rYr#rr?)r!rrrrpreviouscs zEncodingBytes.previouscCs|jt|krt||_dS)N)rYr#r)r!r rrr setPositionlszEncodingBytes.setPositioncCs*|jt|krt|jdkr"|jSdSdS)Nr)rYr#r)r!rrr getPositionqs  zEncodingBytes.getPositioncCs||j|jdS)Nr )r )r!rrrgetCurrentByte{szEncodingBytes.getCurrentBytecCsL|j}x:|t|kr@|||d}||kr6||_|S|d7}qW||_dS)zSkip past a list of charactersr N)r r#rY)r!rurrorrrrls zEncodingBytes.skipcCsL|j}x:|t|kr@|||d}||kr6||_|S|d7}qW||_dS)Nr )r r#rY)r!rurrorrr skipUntils zEncodingBytes.skipUntilcCs>|j}|||t|}|j|}|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!r.rr2r5rrr matchBytess  zEncodingBytes.matchBytescCsR||jdj|}|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 matchNr rTrr)r findrYr#r)r!r.Z newPositionrrrjumpTos zEncodingBytes.jumpToN)r6r7r8r9rr"rrrrrrpropertyr r currentBytespaceCharactersBytesrlrrrrrrrrHs      rc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS)rz?Mini parser for detecting character encoding from meta elementscCst||_d|_dS)z3string - the data to work on for encoding detectionN)rr2r)r!r2rrrr"s zEncodingParser.__init__c Csd|jfd|jfd|jfd|jfd|jfd|jff}x^|jD]T}d}xD|D]<\}}|jj|rJy |}PWqJtk rd}PYqJXqJW|s)r2r)r!rrrrszEncodingParser.handleCommentcCs|jjtkrdSd}d}x|j}|dkr.dS|ddkr^|ddk}|r|dk r||_dSq|ddkr|d}t|}|dk r||_dSq|ddkrtt|d}|j}|dk rt|}|dk r|r||_dS|}qWdS) NTFrs http-equivr s content-typescharsetscontent) r2rr getAttributerrJContentAttrParserrparse)r!Z hasPragmaZpendingEncodingattrZtentativeEncodingcodecZ contentParserrrrrs:      zEncodingParser.handleMetacCs |jdS)NF)handlePossibleTag)r!rrrrsz%EncodingParser.handlePossibleStartTagcCst|j|jdS)NT)rr2r)r!rrrrs z#EncodingParser.handlePossibleEndTagcCsf|j}|jtkr(|r$|j|jdS|jt}|dkrD|jn|j}x|dk r`|j}qNWdS)NTr)r2rasciiLettersBytesrrrspacesAngleBracketsr)r!ZendTagr2rorrrrrs     z EncodingParser.handlePossibleTagcCs |jjdS)Nr)r2r)r!rrrrszEncodingParser.handleOthercCs|j}|jttdgB}|dks2t|dks2t|d kr>dSg}g}xt|dkrX|rXPnX|tkrl|j}PnD|d krdj|dfS|tkr|j|j n|dkrdS|j|t |}qHW|dkr|j dj|dfSt ||j}|d krT|}xt |}||kr(t |dj|dj|fS|tkrB|j|j n |j|qWnJ|dkrldj|dfS|tkr|j|j n|dkrdS|j|x^t |}|t krdj|dj|fS|tkr|j|j n|dkrdS|j|qWdS) z_Return a name,value pair for the next attribute in the stream, if one is found, or None/Nr r=r3'")rN)rr)rr) r2rlr frozensetr#r(r4asciiUppercaseBytesr1rrrr)r!r2roZattrNameZ attrValueZ quoteCharrrrrsh             zEncodingParser.getAttributeN) r6r7r8r9r"rrrrrrrrrrrrrs$rc@seZdZddZddZdS)rcCst|tst||_dS)N)r<r.r(r2)r!r2rrrr"fszContentAttrParser.__init__cCsy|jjd|jjd7_|jj|jjdks8dS|jjd7_|jj|jjdkr|jj}|jjd7_|jj}|jj|r|j||jjSdSnF|jj}y|jjt|j||jjStk r|j|dSXWntk rdSXdS)Nscharsetr rrr)rr)r2rr rlrrrr)r!Z quoteMarkZ oldPositionrrrrjs.       zContentAttrParser.parseN)r6r7r8r"rrrrrresrcCs`t|tr.y|jd}Wntk r,dSX|dk rXy tj|Stk rTdSXndSdS)z{Return the python codec name corresponding to an encoding or None if the string doesn't correspond to a valid encoding.rN)r<rdecodeUnicodeDecodeError webencodingslookupAttributeError)rrrrrJs  rJrr)3Z __future__rrrZsixrrZ six.movesrrrrrrZ constantsr r r r rrOriorrrrrrrrZinvalid_unicode_no_surrogaterFrWr(rsevalrdsetrkZascii_punctuation_rerpobjectrrDr@rAr.rrrrJrrrrsX    "          JgIh6'