bg'dZgdZddlZddlmZmZ ddlmZmZm Z m Z m Z m Z m Z e e fZn#e$rddlmZmZm Z m Z m Z m Z e ZYnwxYwddZddZdd Zd Zejd ejjZGd d ZdZdZ ddlmZn#e$r ddlmZYnwxYwejdjZ e n #e!$re"Z YnwxYwdZ#dS)z5External interface to the BeautifulSoup HTML parser. ) fromstringparse convert_treeN)etreehtml) BeautifulSoupTagCommentProcessingInstructionNavigableString DeclarationDoctype)rr r r r r c t|||fi|S)aParse 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 beautifulsoup makeelementbsargss g/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/lxml/html/soupparser.pyrrs $ { = =f = ==c t|dst|}t|||fi|}tj|S)aYParse 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)hasattropenrr ElementTree)filerrrroots rrr$sK 4 Dzz $ { = =f = =D  T " ""rct||}|}|D]}|||S)aConvert 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 getchildrenremove)beautiful_soup_treerrchildrenchilds rrr3sN ,k : :D!!H E Orc |t}t|dr d|vrd|d<t|dr d|vrd|d<||fi|}t||}t|dkr|djdkr|dSd|_|S) N HTML_ENTITIESconvertEntitiesrDEFAULT_BUILDER_FEATURESfeaturesz html.parserr)rrrlentag)sourcerrrtreers rrrEs% }o../ F * *(.F$ %}899/ V # #!.F:  = * *6 * *D { + +D 4yyA~~$q'+//AwDH Krz`(?:\s|[?OPQ?Q-QR'01A!1C1D1DE  KK " ""2A2Y);;eAaCDDkI u%% (55L|I&&H D h   LOO    Y ' ' 'D D  LOO  LL # # #D 0(5577NN 0 0 0(/NNN 0+>:: ; #(<<>> K**,,4G + A AbD0AG !(!:WQrT]G  OsF00GGc0 ig  fd} fd d  fd d d|tt fd}|td}|td}|tfd }S) Ncfd}|S)NcFD]}||<||Sr8)append)handlert convertersordered_node_typestypess raddz5_init_node_converters..converter..adds7 - - ' 1 "))!,,,,Nrr=)rlrmrjrks` r converterz(_init_node_converters..converters.         rcFD]}t||r |cSdSr8)rB)noderirjrks rfind_best_converterz2_init_node_converters..find_best_converters># % %A$"" %!!}$$$ %trc t|}n-#t$r |x}t|<YnwxYw|dS|||Sr8)typeKeyError)bs_nodeparentrhrjrqs rr\z+_init_node_converters..convert_nodes| O g/GG O O O2E2Eg2N2N NGjg/// O ?4ww'''s'AAct|trYi}|D]A\}}t|trd|}t |||<Bntd|D}|S)N c3>K|]\}}|t|fVdSr8unescape).0kvs r z;_init_node_converters..map_attrs..s1AA1Ax{{+AAAAAAr)rBdictitemslistjoinr{)bs_attrsattribsr}r~s r map_attrsz(_init_node_converters..map_attrss h % % BG (( ) )1a&&$ A%a[[  ) AAAAAAAGrct|dkr|jpd|z|_dS|djpd|z|d_dS)Nrr?)r+texttail)rvrs r append_textz*_init_node_converters..append_textsI v;;!  !;,"4FKKK%bz4".convert_tags   */9ii&&&TG"67<HHHCC*/7ii&&&RG+gl7;;;C % %E $T%[[1&GE3'''      L $ $ $ $ sB B Bc\tj|}||||Sr8)r HtmlCommentrgrurvrs rconvert_commentz._init_node_converters..convert_comments/w''   MM#    rc|dr |dd}tj|dd}||||S)N?r?rxr*)endswithrr splitrgrs r convert_piz)_init_node_converters..convert_pi s_   C  #crclG)7==a+@+@A   MM#    rc>||t|dSr8rz)rurvrs r convert_textz+_init_node_converters..convert_texts(   K 1 1 2 2 2trr8)r r0r r r ) rrnrrrrrr\rjrqrrks ` @@@@@@rrFrFsWJ (((((((   ===YsJ ,Yw Y$%%&%Y  r)name2codepointz&(\w+);c0|sdSd}t||S)Nrc tt|dS#t$r|dcYSwxYw)Nr*r)unichrrgrouprt)ms runescape_entityz!unescape..unescape_entity5sU .455 5   771::    s,/AA)handle_entities)rLrs rr{r{1s0 r ?F 3 33r)NNr8)$__doc____all__relxmlrrbs4rr r r r r rrD ImportErrorrrrrcompile IGNORECASErarMr0rrF html.entitiesrhtmlentitydefssubrr NameErrorchrr{r=rrrs 2 1 1  * +G4**** * > > > > # # # #    $$(RZ$M  ((((((((RRRj^^^F.,,,,,,,...--------."*Z((, FF FFF 4 4 4 4 4s3+AAB BB4B77CC