n1k d Z g dZddlZddlmZmZ ddlmZmZm Z m Z mZmZm Z ee fZn# e$ r ddlmZmZm Z m Z mZmZ eZY nw xY wddZddZdd 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. ) fromstringparseconvert_tree N)etreehtml) BeautifulSoupTagCommentProcessingInstructionNavigableStringDeclarationDoctype)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 ```` 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 beautifulsoupmakeelementbsargss v/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/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)hasattropenr r ElementTree)filer r r roots r r r $ sK 4 Dzz$ {==f==DT"""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_treegetchildrenremove)beautiful_soup_treer r childrenchilds r r r 3 sN ,k::D!!H EOr c |t }t |d r d|vrd|d<