ó ïRec @` su d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z y d d l m Z Wn! e k r} d d l m Z n Xd 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 d d l m Z m 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_literalsN( t MutableMappingi ( t basei ( t DataLossWarning( t constants( t etree( t _ihatexml( t PY3t binary_typeu {([^}]*)}(.*)u asdt DocumentTypec B` s e Z d „ Z RS( c C` s | | _ | | _ | | _ d S( N( t namet publicIdt systemId( t selfR R R ( ( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt __init__) s ( t __name__t __module__R ( ( ( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/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 ( ( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR 0 s c C` sC | j j ƒ } x | j j ƒ j ƒ D] } q% W| j | j ƒ d S( N( R t getroott itersiblingst addnextt _element( R t elementt last( ( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt appendChild4 s c C` s | j S( N( R ( R ( ( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt _getChildNodes; s ( R R R R R t propertyt childNodes( ( ( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/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 ƒ qWn | 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 u u |%s%su i i u |%s"%s"u #document-fragmentu |%su 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 nsR1 t prefixt attributesR t valuet attr_stringt child( t infosetFiltert rvt serializeElement( s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRL E st "( $ ) % u ( R t InfosetFiltert Truet join( R ( ( RJ RK RL s› /builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt testSerializerA 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 u u <%s>u u %s="%s"u <%s %s>u %s>u tail( R" R$ R% t doctypeR( R# R R1 R2 R3 R<