/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders
Edit: /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyo (15012B)
ó
•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
` s
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Ý Wq t | t ƒ s+t | t
ƒ rIˆ j d d | | f ƒ q ˆ j d
ƒ x°| D] } ˆ | | d ƒ q]WnŽ| j t k räˆ j d d | | j f ƒ t | d ƒ r | j r ˆ j d d | | j f ƒ q n%t j j | j ƒ } | d k rZ| j d
ƒ } | j d ƒ } t j | } ˆ j d d | | ˆ j | ƒ f ƒ n' ˆ j d d | ˆ j | j ƒ f ƒ t | d ƒ rvg } x› | j j ƒ D]Š \ } }
t j | ƒ } | d k r| j ƒ \ } } ˆ j | ƒ } t j | } d | | f } n ˆ j | ƒ } | j | |
f ƒ q¦Wx? t | ƒ D]. \ } }
ˆ j d d | d | |
f ƒ qAWn | j r¤ˆ j d d | d | j f ƒ n | d 7} x | D] } ˆ | | ƒ qµWt | d ƒ r | j r ˆ j d d | d | j f ƒ n d S( Nu tagu getrootu #documentu
u u |%s%su 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 tagt comment_typet textt tailt 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.pyRC ; sp
"
$
) %
u
( R t
InfosetFiltert Truet join( R ( ( RA RB RC 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
u u <%s>u u %s="%s"u <%s %s>u %s>u tail( R R R t doctypeR# R R R) R* R+ R3 RF R4 R, ( R R8 R R> t attrR@ ( RB RC ( sP /usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRC Š s* 2
u ( RF ( R ( ( RB RC 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 |