Edit File: HTMLParser.pyc
� ��7ec�����������@���s��d��Z��d�d�l�Z�d�d�l�Z�e�j�d���Z�e�j�d���Z�e�j�d���Z�e�j�d���Z�e�j�d���Z�e�j�d���Z �e�j�d ���Z �e�j�d ���Z�e�j�d���Z�e�j�d���Z �e�j�d �e�j���Z�e�j�d���Z�e�j�d���Z�d�e�f�d�������YZ�d�e�j�f�d�������YZ�d�S(���s���A parser for HTML and XHTML.i����Ns���[&<]s ���&[a-zA-Z#]s%���&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]s)���&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]s ���<[a-zA-Z]t���>s���--\s*>s$���([a-zA-Z][^ />�]*)(?:\s|/(?!>))*s���[a-zA-Z][^ />�]*s]���((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*s�� <[a-zA-Z][^\t\n\r\f />\x00]* # tag name (?:[\s/]* # optional whitespace before attribute name (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name (?:\s*=+\s* # value indicator (?:'[^']*' # LITA-enclosed value |"[^"]*" # LIT-enclosed value |(?!['"])[^>\s]* # bare value ) )?(?:\s|/(?!>))* )* )? \s* # trailing whitespace s#���</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>t���HTMLParseErrorc�����������B���s#���e��Z�d��Z�d�d���Z�d����Z�RS(���s&���Exception raised for all parse errors.c���������C���s3���|�s�t����|�|��_�|�d�|��_�|�d�|��_�d��S(���Ni����i���(���t���AssertionErrort���msgt���linenot���offset(���t���selfR���t���position(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���__init__<���s���� c���������C���sW���|��j��}�|��j�d��k �r,�|�d�|��j�}�n��|��j�d��k �rS�|�d�|��j�d�}�n��|�S(���Ns���, at line %ds���, column %di���(���R���R���t���NoneR���(���R���t���result(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���__str__B���s���� N(���NN(���t���__name__t ���__module__t���__doc__R ���R���R���(����(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR���9���s���t ���HTMLParserc�����������B���s ��e��Z�d��Z�d�Z�d����Z�d����Z�d����Z�d����Z�d����Z�d�Z �d����Z�d ����Z�d ����Z �d����Z�d����Z�d �d���Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d�Z�d����Z �RS( ���s���Find tags and other markup and call handler functions. Usage: p = HTMLParser() p.feed(data) ... p.close() Start tags are handled by calling self.handle_starttag() or self.handle_startendtag(); end tags by self.handle_endtag(). The data between tags is passed from the parser to the derived class by calling self.handle_data() with the data as argument (the data may be split up in arbitrary chunks). Entity references are passed by calling self.handle_entityref() with the entity reference as the argument. Numeric character references are passed to self.handle_charref() with the string containing the reference as the argument. t���scriptt���stylec���������C���s���|��j�����d�S(���s#���Initialize and reset this instance.N(���t���reset(���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR���b���s����c���������C���s8���d�|��_��d�|��_�t�|��_�d�|��_�t�j�j�|����d�S(���s1���Reset this instance. Loses all unprocessed data.t����s���???N( ���t���rawdatat���lasttagt���interesting_normalt���interestingR ���t ���cdata_elemt ���markupbaset ���ParserBaseR���(���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR���f���s ���� c���������C���s!���|��j��|�|��_��|��j�d���d�S(���s����Feed data to the parser. Call this as often as you want, with as little or as much text as you want (may include '\n'). i����N(���R���t���goahead(���R���t���data(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���feedn���s����c���������C���s���|��j��d���d�S(���s���Handle any buffered data.i���N(���R���(���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���closew���s����c���������C���s���t��|�|��j��������d��S(���N(���R���t���getpos(���R���t���message(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���error{���s����c���������C���s���|��j��S(���s)���Return full source of start tag: '<...>'.(���t���_HTMLParser__starttag_text(���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���get_starttag_text����s����c���������C���s2���|�j�����|��_�t�j�d�|��j�t�j���|��_�d��S(���Ns���</\s*%s\s*>(���t���lowerR���t���ret���compilet���IR���(���R���t���elem(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���set_cdata_mode����s����c���������C���s���t��|��_�d��|��_�d��S(���N(���R���R���R ���R���(���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���clear_cdata_mode����s���� c��� ������C���s|��|��j��}�d�}�t�|���}�x|�|�k��r%|��j�j�|�|���}�|�rT�|�j����}�n�|��j�ra�Pn��|�}�|�|�k��r��|��j�|�|�|�!��n��|��j�|�|���}�|�|�k�r��Pn��|�j�}�|�d�|���r7t �j �|�|���r��|��j�|���}�n��|�d�|���r |��j�|���}�n��|�d�|���r*|��j �|���}�nm�|�d�|���rK|��j�|���}�nL�|�d�|���rl|��j�|���}�n+�|�d�|�k��r�|��j�d���|�d�}�n�P|�d�k��r"|�s�Pn��|�j�d�|�d���}�|�d�k��r|�j�d�|�d���}�|�d�k��r|�d�}�qn �|�d�7}�|��j�|�|�|�!��n��|��j�|�|���}�q�|�d �|���rt�j �|�|���}�|�r�|�j����d �d�!} �|��j�| ���|�j����}�|�d�|�d���s�|�d�}�n��|��j�|�|���}�q�q"d�|�|�k�r|��j�|�|�|�d �!��|��j�|�|�d ���}�n��Pq�|�d �|���rt�j �|�|���}�|�r�|�j�d���} �|��j�| ���|�j����}�|�d�|�d���sv|�d�}�n��|��j�|�|���}�q�n��t�j �|�|���}�|�r�|�r�|�j����|�|�k�r�|��j�d���n��Pq"|�d�|�k��r|��j�d ���|��j�|�|�d���}�q"Pq�d�s�t�d�����q�W|�rk|�|�k��rk|��j�rk|��j�|�|�|�!��|��j�|�|���}�n��|�|�|��_��d��S(���Ni����t���<s���</s���<!--s���<?s���<!i���R����s���&#i���i����t���;t���&s#���EOF in middle of entity or char refs���interesting.search() lied(���R���t���lenR���t���searcht���startR���t���handle_datat ���updatepost ���startswitht���starttagopent���matcht���parse_starttagt���parse_endtagt ���parse_commentt���parse_pit���parse_html_declarationt���findt���charreft���groupt���handle_charreft���endt ���entityreft���handle_entityreft ���incompleteR!���R���( ���R���R?���R���t���it���nR5���t���jR3���t���kt���name(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR�������s����� �� c���������C���s����|��j��}�|�|�|�d�!d�k�r0�|��j�d���n��|�|�|�d�!d�k�rT�|��j�|���S|�|�|�d�!d�k�rx�|��j�|���S|�|�|�d�!j����d �k�r��|�j�d �|�d���}�|�d�k�r��d�S|��j�|�|�d�|�!��|�d�S|��j�|���Sd��S( ���Ni���s���<!s+���unexpected call to parse_html_declaration()i���s���<!--i���s���<![i ���s ���<!doctypeR����i����i���(���R���R!���R8���t���parse_marked_sectionR$���R;���t���handle_declt���parse_bogus_comment(���R���RC���R���t���gtpos(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR:�������s���� i���c���������C���s���|��j��}�|�|�|�d�!d�k�r0�|��j�d���n��|�j�d�|�d���}�|�d�k�rV�d�S|�rw�|��j�|�|�d�|�!��n��|�d�S( ���Ni���s���<!s���</s"���unexpected call to parse_comment()R����i����i���(���s���<!s���</(���R���R!���R;���t���handle_comment(���R���RC���t���reportR���t���pos(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRJ�����s���� c���������C���s����|��j��}�|�|�|�d�!d�k�s,�t�d�����t�j�|�|�d���}�|�sL�d�S|�j����}�|��j�|�|�d�|�!��|�j����}�|�S(���Ni���s���<?s���unexpected call to parse_pi()i����(���R���R���t���picloseR/���R0���t ���handle_piR?���(���R���RC���R���R5���RE���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR9�����s���� #c���������C���s���d��|��_�|��j�|���}�|�d�k��r(�|�S|��j�}�|�|�|�!|��_�g��}�t�j�|�|�d���}�|�so�t�d�����|�j����}�|�j�d���j ����|��_ �}�x��|�|�k��r�t�j�|�|���}�|�s��Pn��|�j�d�d�d���\�} �} �}�| �s��d��}�nX�|�d� d�k�o|�d�k�n�s7|�d� d�k�o2|�d�k�n�rG|�d�d�!}�n��|�r_|��j�|���}�n��|�j �| �j ����|�f���|�j����}�q��W|�|�|�!j����}�|�d�k�r+|��j����\�} �}�d�|��j�k�r�| �|��j�j�d���} �t�|��j���|��j�j�d���}�n�|�t�|��j���}�|��j�|�|�|�!��|�S|�j�d ���rM|��j�|�|���n/�|��j�|�|���|�|��j�k�r||��j�|���n��|�S( ���Ni����i���s#���unexpected call to parse_starttag()i���i���s���'i����t���"R����s���/>s��� (���R����s���/>(���R ���R"���t���check_for_whole_start_tagR���t���tagfindR5���R���R?���R=���R$���R���t���attrfindt���unescapet���appendt���stripR���t���countR.���t���rfindR1���t���endswitht���handle_startendtagt���handle_starttagt���CDATA_CONTENT_ELEMENTSR)���(���R���RC���t���endposR���t���attrsR5���RF���t���tagt���mt���attrnamet���restt ���attrvalueR?���R���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR6�����sR���� $$c���������C���s����|��j��}�t�j�|�|���}�|�r��|�j����}�|�|�|�d�!}�|�d�k�rR�|�d�S|�d�k�r��|�j�d�|���rx�|�d�S|�j�d�|���r��d�S|��j�|�|�d���|��j�d���n��|�d�k�r��d�S|�d �k�r��d�S|�|�k�r��|�S|�d�Sn��t�d �����d��S(���Ni���R����t���/s���/>i���i����s���malformed empty start tagR���s6���abcdefghijklmnopqrstuvwxyz=/ABCDEFGHIJKLMNOPQRSTUVWXYZs���we should not get here!(���R���t���locatestarttagendR5���R?���R3���R2���R!���R���(���R���RC���R���Ra���RE���t���next(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRR���N��s,���� c���������C���s���|��j��}�|�|�|�d�!d�k�s,�t�d�����t�j�|�|�d���}�|�sL�d�S|�j����}�t�j�|�|���}�|�s$|��j�d��k �r��|��j �|�|�|�!��|�St �j�|�|�d���}�|�s��|�|�|�d�!d�k�r��|�d�S|��j�|���Sn��|�j�d���j ����}�|�j�d�|�j������}�|��j�|���|�d�S|�j�d���j ����}�|��j�d��k �rr|�|��j�k�rr|��j �|�|�|�!��|�Sn��|��j�|���|��j����|�S( ���Ni���s���</s���unexpected call to parse_endtagi���i����i���s���</>R����(���R���R���t ���endendtagR/���R?���t ���endtagfindR5���R���R ���R1���RS���RJ���R=���R$���R;���t ���handle_endtagR*���(���R���RC���R���R5���RK���t ���namematcht���tagnameR(���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR7���n��s8���� # c���������C���s!���|��j��|�|���|��j�|���d��S(���N(���R\���Rj���(���R���R`���R_���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR[������s����c���������C���s���d��S(���N(����(���R���R`���R_���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR\������s����c���������C���s���d��S(���N(����(���R���R`���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRj������s����c���������C���s���d��S(���N(����(���R���RG���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR>������s����c���������C���s���d��S(���N(����(���R���RG���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRA������s����c���������C���s���d��S(���N(����(���R���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR1������s����c���������C���s���d��S(���N(����(���R���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRL������s����c���������C���s���d��S(���N(����(���R���t���decl(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRI������s����c���������C���s���d��S(���N(����(���R���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyRP������s����c���������C���s���d��S(���N(����(���R���R���(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���unknown_decl���s����c������������s2���d�|�k�r�|�S���f�d����}�t��j�d�|�|���S(���NR-���c������������s��|��j�����d�}��yZ�|��d�d�k�ri�|��d�}��|��d�d �k�rS�t�|��d�d���}�n�t�|����}�t�|���SWn�t�k �r��d�|��d�SXt�j�d��k�r��d �d��l�}�i�d �d�6}�x-�|�j�j ����D]�\�}�}�t�|���|�|�<q��W|�t�_�n��y����j�|��SWn�t �k �rd�|��d�SXd��S(���Ni����t���#i���t���xt���Xi���s���&#R,���i����u���'t���aposR-���(���Rp���Rq���(���t���groupst���intt���unichrt ���ValueErrorR���t ���entitydefsR ���t���htmlentitydefst���name2codepointt ���iteritemst���KeyError(���t���st���cRx���Rw���RF���t���v(���R���(����s"���/usr/lib64/python2.7/HTMLParser.pyt���replaceEntities���s(���� s#���&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));(���R%���t���sub(���R���R|���R���(����(���R���s"���/usr/lib64/python2.7/HTMLParser.pyRU������s����(���R���R���N(!���R���R ���R���R]���R���R���R���R���R!���R ���R"���R#���R)���R*���R���R:���RJ���R9���R6���RR���R7���R[���R\���Rj���R>���RA���R1���RL���RI���RP���Rn���Rw���RU���(����(����(����s"���/usr/lib64/python2.7/HTMLParser.pyR���K���s<��� ^ 4 ( (���R���R���R%���R&���R���RB���R@���R<���R4���RO���t���commentcloseRS���t���tagfind_tolerantRT���t���VERBOSERf���Rh���Ri���t ���ExceptionR���R���R���(����(����(����s"���/usr/lib64/python2.7/HTMLParser.pyt���<module>���s&���