File: //opt/cloudlinux/venv/lib/python3.11/site-packages/lxml/html/__pycache__/soupparser.cpython-311.pyc
�
n��1��k� � � d Z g d�ZddlZddlmZmZ ddlmZmZm Z m
Z
mZmZm
Z
ee
fZn# e$ r ddlmZmZm Z m
Z
mZmZ eZY nw xY wdd�Zdd�Zdd �Zd
� Z ej dej � � j Z G d� d
� � Zd� Zd� Z ddlmZ n# e$ r ddlmZ Y nw xY w ej d� � j Z e n
# e!$ r e"Z Y nw xY wd� 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 � � t | ||fi |��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�bsargss �g/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib64/python3.11/site-packages/lxml/html/soupparser.pyr r s � � �$�
�{�=�=�f�=�=�=� c � � t | d� � st | � � } t | ||fi |��}t j |� � 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 �ElementTree)�filer r r �roots r r r $ sK � � �4�� � � ��D�z�z���$�
�{�=�=�f�=�=�D���T�"�"�"r c � � t | |� � }|� � � }|D ]}|� |� � �|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_tree�getchildren�remove)�beautiful_soup_treer r �children�childs r r r 3 sN � � �,�k�:�:�D����!�!�H�� � �����E������Or c � � |�t }t |d� � r d|vrd|d<