Edit File: etree_lxml.pyc
� ��abc�����������@`�s'��d��Z��d�d�l�m�Z�m�Z�m�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�m �Z �d�d�l �m�Z�d�d�l�m �Z �d�d �l�m�Z �d�d �l�m�Z�d�d�l�j�Z�e�Z�e�j�d���Z�e�j�d���j�Z�d �e�f�d�������YZ�d�e�f�d�������YZ�d����Z�d����Z�d�e �j�f�d�������YZ�d�S(���u���Module for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause problems: Text or comments as siblings of the root element Docypes with no name When any of these things occur, we emit a DataLossWarning i����(���t���absolute_importt���divisiont���unicode_literalsNi���(���t���basei���(���t���DataLossWarning(���t ���constants(���t���etree(���t ���_ihatexmlu ���{([^}]*)}(.*)u���asdt���DocumentTypec�����������B`�s���e��Z�d�����Z�RS(���c���������C`�s���|�|��_��|�|��_�|�|��_�d��S(���N(���t���namet���publicIdt���systemId(���t���selfR ���R ���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���__init__#���s���� (���t���__name__t ���__module__R ���(����(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR���"���s���t���Documentc�����������B`�s/���e��Z�d�����Z�d����Z�d����Z�e�e���Z�RS(���c���������C`�s���d��|��_�g��|��_�d��S(���N(���t���Nonet���_elementTreet���_childNodes(���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR ���*���s���� c���������C`�s���|��j��j����j�|�j���d��S(���N(���R���t���getroott���addnextt���_element(���R���t���element(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���appendChild.���s����c���������C`�s���|��j��S(���N(���R���(���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_getChildNodes1���s����(���R���R���R ���R���R���t���propertyt ���childNodes(����(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR���)���s��� c���������`�sJ���g����t��j�d�t������d��������f�d�������|��d���d�j�����S(���Nt���preventDoubleDashCommentsi����c��� ������`�sM��t��|��d���s�t��|��d���r ��j�d���|��j�j�r��|��j�j�pL�|��j�j�sb�d�|��j�j�}�n%�d�|��j�j�|��j�j�|��j�j�f�}���j�d�d�|�d�|�f���n��|��j����}�x"�|�j����d��k �r��|�j����}�q��Wx��|�d��k �r ��|�|�d���|�j ����}�q��WqIt�|��t���s+t�|��t ���rqt�|��t���sSt�j�d �d�k�sSt�����j�d �d�|�|��f���qI��j�d���x�|��D]�}���|�|�d���q�Wn�|��j�t�k�r��j�d�d�|�|��j�f���t��|��d ���rI|��j�rI��j�d �d�|�|��j�f���qIn=t�|��t�j���s$t���t�j�j�|��j���}�|�d��k �r�|�j�d���}�|�j�d���}�t�j�|�}���j�d�d�|�|����j�|���f���n'���j�d�d�|����j�|��j���f���t��|��d���r�g��}�x��|��j�j����D]��\�} �} �t�j�| ���}�|�d��k �rN|�j ����\�}�} ����j�| ���} �t�j�|�}�d�|�| �f�}�n����j�| ���}�|�j�|�| �f���q�Wx?�t!�|���D].�\�} �} ���j�d�d�|�d�| �| �f���q�Wn��|��j�r���j�d �d�|�d�|��j�f���n��|�d�7}�x�|��D]�}���|�|���q�Wt��|��d ���rI|��j�rI��j�d �d�|�d�|��j�f���n��d��S(���Nu���tagu���getrootu ���#documentu ���<!DOCTYPE %s>u���<!DOCTYPE %s "%s" "%s">u���|%s%su��� i���i����u���|%s"%s"u���#document-fragmentu���|%s<!-- %s -->u���taili���u ���|%s<%s %s>u���|%s<%s>u���attribu���%s %su ���|%s%s="%s"("���t���hasattrt���appendt���docinfot���internalDTDt ���public_idt ���system_urlt ���root_nameR���t���getpreviousR���t���getnextt ���isinstancet���strt���bytest���syst���version_infot���AssertionErrort���tagt���comment_typet���textt���tailR���t���_Elementt���etree_builderst ���tag_regexpt���matcht���groupR���t���prefixest���fromXmlNamet���attribt���itemst���groupst���sorted( ���R���t���indentt���dtd_strt���next_elementt���nsmatcht���nsR,���t���prefixt ���attributesR ���t���valuet���attr_stringt���child(���t ���infosetFiltert���rvt���serializeElement(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRG���;���st���� "( $ ) % u��� (���R���t ���InfosetFiltert���Truet���join(���R���(����(���RE���RF���RG���sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���testSerializer7���s ����F c���������`�s/���g����������f�d��������|����d�j�������S(���u4���Serialize an element and its child nodes to a stringc���������`�s���t��|��d���si�|��j�j�rV�|��j�j�r6�|��j�j�}�n�d�|��j�j�}����j�|���n����|��j������n��|��j�t�k�r�����j�d�|��j �f���n��|��j �s�����j�d�|��j�f���nU�d�j�g��|��j �j����D]�\�}�}�d�|�|�f�^�q����}����j�d�|��j�|�f���|��j �r&���j�|��j ���n��x�|��D]�}���|���q-W���j�d�|��j�f���t��|��d ���r�|��j �r����j�|��j ���n��d��S( ���Nu���tagu ���<!DOCTYPE %s>u ���<!--%s-->u���<%s>u��� u���%s="%s"u���<%s %s>u���</%s>u���tail(���R���R���R ���t���doctypeR#���R���R���R,���R-���R.���R7���RJ���R8���R/���(���R���R<���R ���RB���t���attrRD���(���RF���RG���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRG�������s*���� 2 u����(���RJ���(���R���(����(���RF���RG���sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���tostring����s���� t���TreeBuilderc�����������B`�s����e��Z�e�Z�e�Z�d �Z�d �Z�e�Z �e �Z�e�d����Z �d����Z�d����Z�d����Z�d����Z�d����Z�d �d���Z�d �d���Z�d����Z�RS( ���c���������`�s����t��j�t�d�|����t�j�d�t�����|��_�|�|��_�d�t�f���f�d�������Y���d���j �f��������f�d�������Y}�d���j �f�����f�d�������Y}�|�|��_�|�|��_�t �j�j�|��|���d��S( ���Nt���fullTreeR���t ���Attributesc�����������`�s)���e��Z�d����f�d����Z����f�d����Z�RS(���c���������`�s����|�d��k�r�i��}�n��|�|��_�t�j�|��|���xo�|��j����D]a�\�}�}�t�|�t���rz�d�|�d����j�|�d���f�}�n����j�|���}�|�|��j�j�j�|�<q;�Wd��S(���Nu���{%s}%si���i���( ���R���R���t���dictR ���R8���R&���t���tuplet���coerceAttributeR7���(���R���R���RB���t���keyR ���(���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR �������s���� $c���������`�sl���t��j�|��|�|���t�|�t���rF�d�|�d����j�|�d���f�}�n����j�|���}�|�|��j�j�j�|�<d��S(���Nu���{%s}%si���i���(���RR���t���__setitem__R&���RS���RT���R���R7���(���R���RU���RB���R ���(���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRV�������s ����$N(���R���R���R���R ���RV���(����(���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRQ�������s���t���Elementc�����������`�s����e��Z��������f�d�����Z���f�d����Z���f�d����Z�e�e�e���Z�d����Z����f�d����Z�e�e�e���Z �d�����f�d���Z���f�d����Z�RS(���c���������`�s;�����j��|���}���j�j�|��|�d�|�����|����|��_�d��S(���Nt ���namespace(���t ���coerceElementRW���R ���t���_attributes(���R���R ���RX���(���RQ���t���builderRE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR �������s����c���������`�s4������j��|���|��_�|��j�|��j�|��j���|��j�_�d��S(���N(���RY���t���_namet���_getETreeTagt ���_namespaceR���R,���(���R���R ���(���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_setName����s����c���������`�s������j��|��j���S(���N(���R6���R\���(���R���(���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_getName����s����c���������S`�s���|��j��S(���N(���RZ���(���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_getAttributes����s����c���������`�s������|��|���|��_��d��S(���N(���RZ���(���R���RA���(���RQ���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_setAttributes����s����c���������`�s)�����j��|���}����j�j�|��|�|���d��S(���N(���t���coerceCharactersRW���t ���insertText(���R���t���datat���insertBefore(���R[���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRd�������s����c���������`�s������j��j�|��|���d��S(���N(���RW���R���(���R���RD���(���R[���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�������s����N( ���R���R���R ���R_���R`���R���R ���Ra���Rb���RA���R���Rd���R���(����(���RQ���R[���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRW�������s��� t���Commentc�����������`�sA���e��Z������f�d�����Z���f�d����Z�d����Z�e�e�e���Z�RS(���c���������`�s&�����j��|���}����j�j�|��|���d��S(���N(���t ���coerceCommentRg���R ���(���R���Re���(���R[���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR �������s����c���������`�s������j��|���}�|�|��j�_�d��S(���N(���Rh���R���R.���(���R���Re���(���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_setData����s����c���������S`�s ���|��j��j�S(���N(���R���R.���(���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���_getData����s����(���R���R���R ���Ri���Rj���R���Re���(����(���R[���RE���(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRg�������s��� (���R1���t���getETreeModuleR���R���RH���RI���RE���t���namespaceHTMLElementsRR���RW���Rg���t���elementClasst���commentClassR���RO���R ���(���R���Rl���RP���RW���Rg���(����(���RQ���R[���RE���sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR �������s���� %" c���������C`�s2���t��j�j�|����|��j�|��_�g��|��_�d��|��_�d��S(���N(���R���RO���t���resett���insertCommentInitialt ���insertCommentt���initial_commentsR���RL���(���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRo�����s���� c���������C`�s ���t��|���S(���N(���RK���(���R���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRK��� ��s����c���������C`�s$���t��r�|��j�j�S|��j�j�j����Sd��S(���N(���RP���t���documentR���R���(���R���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���getDocument��s���� c���������C`�se���g��}�|��j��d�j�}�|�j�r2�|�j�|�j���n��|�j�t�|�����|�j�ra�|�j�|�j���n��|�S(���Ni����(���t���openElementsR���R.���R���t���extendt���listR/���(���R���t���fragmentR���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���getFragment��s���� c���������C`�s����|�d�}�|�d�}�|�d�}�|�s@�t��j�d�t���d��|��_�nO�|��j�j�|���}�|�|�k�rq�t��j�d�t���n��|��j�|�|�|���}�|�|��_�d��S(���Nu���nameu���publicIdu���systemIdu#���lxml cannot represent empty doctypeu%���lxml cannot represent non-xml doctype(���t���warningst���warnR���R���RL���RE���RY���t���doctypeClass(���R���t���tokenR ���R ���R���t���coercedNameRL���(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt ���insertDoctype��s���� c���������C`�sM���|�d��k�s!�|�|��j�k�s!�t���|��j�j�d��k�s9�t���|��j�j�|���d��S(���N(���R���Rs���R+���R���Rr���R���(���R���Re���t���parent(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRp���,��s����!c���������C`�s^���|�|��j��k�rA�|��j��j�j����d�j�t�k�rA�t�j�d�t���n��t�t �|����j �|�|���d��S(���Ni����u@���lxml cannot represent adjacent comments beyond the root elements(���Rs���R���R���R,���R-���Rz���R{���R���t���superRO���Rq���(���R���Re���R����(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���insertCommentMain1��s����c���������C`�sl��d�}�|��j��r`|��j��j�s!�t���|�d�|��j��j�7}�|��j��j�d�k �sY�|��j��j�d�k �r*|�d�|��j�j�|��j��j�pw�d���7}�|��j��j�r|��j��j�}�|�j�d���d�k�r��|�j�d���d�k�r��t �j �d�t���|�j�d�d���}�n��|�j�d���d�k�r|�d �|�7}�q'|�d �|�7}�q*|�d�7}�n��|�d�7}�|��j��j�|�d �k�r`t �j �d�t���q`n��|�d�7}�t �j�|���}�x4�|��j�D])�}�|��j�|�d���}�|�j�|�j���q�W|��j����|��_�|�j����|��j�_�|�d �}�|�j�d�|��j���}�|�d�k�r|�} �n�d�|�|�f�} �| �|�_�|��j�|�|���} �|�| �_�|��j�j�j�| ���|��j�j�| ���|��j�|��_�d�S(���u���Create the document rootu����u���<!DOCTYPE %su ��� PUBLIC "%s" u���'i����u���"u6���DOCTYPE system cannot contain single and double quotesu���U00027u���"%s"u���'%s'u���''u���>u���nameuG���lxml cannot represent doctype with a different name to the root elementu$���<THIS_SHOULD_NEVER_APPEAR_PUBLICLY/>u���datau ���namespaceu���{%s}%sN( ���RL���R ���R+���R ���R���R���RE���t���coercePubidt���findRz���R{���R���t���replaceR���t ���fromstringRr���Rn���t���addpreviousR���t ���documentClassRs���t���getroottreeR���t���gett���defaultNamespaceR,���Rm���R���R���Ru���R����Rq���(���R���R}���t���docStrt���sysidt���roott ���comment_tokent���commentR ���RX���t ���etree_tagt���root_element(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt ���insertRoot7��sL���� * N(���R���R���R���R����R���R|���R���Rm���Rn���t ���fragmentClassR���t���implementationt���FalseR ���Ro���RK���Rt���Ry���R���Rp���R����R����(����(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRO�������s���L (���t���__doc__t ���__future__R����R���R���Rz���t���reR)���t����R���R���R���R���R1���R���t ���lxml.etreeRI���RP���t���compileR2���Rg���R,���R-���t���objectR���R���RK���RN���RO���(����(����(����sP���/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt���<module> ���s$��� O )