Current File : //proc/3/task/3/cwd/proc/3/root/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyc
�
�ePc@sdZdddgZddlmZmZddlmZmZmZmZm Z ddd�Zddd�Zdd �Z
d
�Zd�Zd�Zd
�ZyddlmZWn!ek
r�ddlmZnXddlZejd�jZd�ZdS(s5External interface to the BeautifulSoup HTML parser.
t
fromstringtparsetconvert_treei����(tetreethtml(t
BeautifulSouptTagtCommenttProcessingInstructiontNavigableStringcKst||||�S(s�Parse a string of HTML data into an Element tree using the
BeautifulSoup parser.
Returns the root ``<html>`` Element of the tree.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword. By default, the standard
``BeautifulSoup`` class and the default factory of `lxml.html` are
used.
(t_parse(tdatat
beautifulsouptmakeelementtbsargs((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyRscKs@t|d�st|�}nt||||�}tj|�S(sYParse a file into an ElemenTree using the BeautifulSoup parser.
You can pass a different BeautifulSoup parser through the
`beautifulsoup` keyword, and a diffent Element factory function
through the `makeelement` keyword. By default, the standard
``BeautifulSoup`` class and the default factory of `lxml.html` are
used.
tread(thasattrtopenR
RtElementTree(tfileRR
Rtroot((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyRs cCsX|dkrtjj}nt||�}|j�}x|D]}|j|�q=W|S(sConvert a BeautifulSoup tree to a list of Element trees.
Returns a list instead of a single root Element to support
HTML-like soup with more than one root element.
You can pass a different Element factory through the `makeelement`
keyword.
N(tNoneRthtml_parserR
t
_convert_treetgetchildrentremove(tbeautiful_soup_treeR
Rtchildrentchild((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR's
cKs�|dkrt}n|dkr0tjj}nd|krId|d<n|||�}t||�}t|�dkr�|djdkr�|dSd|_|S(NtconvertEntitiesRii(RRRRR
Rtlenttag(tsourceRR
RttreeR((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR
;s
% cCs2||jdt|j��}t|||�|S(Ntattrib(tnametdicttattrst_convert_children(RR
R((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyRJscCs)tj}d}x|D]}t|t�r�|||jdtg|jD]\}}|t|�f^qG��}t |||�qt
|�tkr�t||t|��qt|t
�r�|jtj
|��qt|t�r|jtj|jdd���qt||t|��qWdS(NR"t i(Rt
SubElementRt
isinstanceRR#R$R%tunescapeR&ttypeR t_append_textRtappendRtsplit(tparentRR
R(tet_childRtktv((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR&Ps
4cCs?|dkr%|jpd||_n|jp1d||_dS(Nt(Rttextttail(R/telementR4((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR,cs(tname2codepointNs&(\w+);cCs |s
dSd�}t||�S(NR3cSs=ytt|jd��SWntk
r8|jd�SXdS(Nii(tunichrR7tgrouptKeyError(tm((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pytunescape_entityxs
(thandle_entities(tstringR<((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR*ts (t__doc__t__all__tlxmlRRRRRRR RRRRR
RR&R,t
html.entitiesR7tImportErrorthtmlentitydefstretcompiletsubR=R*(((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyt<module>s"(