File: //opt/alt/python37/lib64/python3.7/site-packages/lxml/html/__pycache__/soupparser.cpython-37.pyc
B
x_�(��X2� @ sT d Z dddgZddlZddlmZmZ y0ddlmZmZm Z m
Z
mZmZm
Z
ee
fZW n8 ek
r� ddlmZmZm Z m
Z
mZmZ eZY nX dd d�Zdd
d�Zddd�Zdd
� Ze�dej�jZG dd� d�Zdd� Zdd� ZyddlmZ W n" ek
�r ddlmZ Y nX e�d�jZye W n e!k
�rF e"Z Y nX dd� Z#dS )z5External interface to the BeautifulSoup HTML parser.
�
fromstring�parse�convert_tree� N)�etree�html)�
BeautifulSoup�Tag�Comment�ProcessingInstruction�NavigableString�Declaration�Doctype)r r r r
r r c K s t | ||f|�S )a� 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.
)�_parse)�data�
beautifulsoup�makeelement�bsargs� r �G/opt/alt/python37/lib64/python3.7/site-packages/lxml/html/soupparser.pyr s c K s, t | d�st| �} t| ||f|�}t�|�S )aY Parse 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.
�read)�hasattr�openr r ZElementTree)�filer r r �rootr r r r $ s
c C s. t | |�}|�� }x|D ]}|�|� qW |S )a Convert 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.
)�
_convert_treeZgetchildren�remove)�beautiful_soup_treer r �children�childr r r r 3 s
c K s� |d krt }t|d�r&d|kr&d|d<