Files
wg-backend-django/acer-env/lib/python3.10/site-packages/bs4/__pycache__/diagnose.cpython-310.pyc

93 lines
8.3 KiB
Plaintext
Raw Normal View History

2022-11-30 15:58:16 +07:00
o
<00>Ԅc<D484><00>@sdZdZddlZddlmZddlmZddlZddlmZm Z ddl
m Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZdd <09>Zd#d d <0C>ZGd d<0E>de<06>Zdd<10>ZdZdZd$dd<15>Zd%dd<18>Zd&dd<1B>Zd'dd<1E>Zd(d d!<21>Zed"kr<>eej<1F> <20><00>dSdS))z=Diagnostic functions, mainly for use when doing tech support.<2E>MIT<49>N)<01>BytesIO)<01>
HTMLParser)<02> BeautifulSoup<75> __version__)<01>builder_registryc CsRtdt<00>tdtj<00>gd<03>}|D]}tjD] }||jvr!n q|<01>|<02>td|<00>qd|vrc|<01>d<06>zddl m
}td d
<EFBFBD> t t |j<0E><02><00>Wntyb}z
td <0B>WYd }~nd }~wwd |vr<>z dd l}td|j<00>Wnty<>}z
td<0F>WYd }~nd }~wwt|d<10>r<>|<00><12>}nJ|<00>d<11>s<>|<00>d<12>r<>td|<00>td<14>d Sz&tj<15>|<00>r<>td|<00>t|<00><01> }|<07><12>}Wd <00>n1s<>wYWn ty<>Ynwtd<16>|D]E}td|<00>d} z
t||d<19>}
d} Wnt<1A>y}ztd|<00>t<1B><1C>WYd }~nd }~ww| <09>r"td|<00>t|
<EFBFBD><1D><00>td<1D>q<>d S)z<>Diagnostic suite for isolating common problems.
:param data: A string containing markup that needs to be explained.
:return: None; diagnostics are printed to standard output.
z'Diagnostic running on Beautiful Soup %szPython version %s)<03> html.parser<65>html5lib<69>lxmlz;I noticed that %s is not installed. Installing it may help.r
zlxml-xmlr<00><01>etreezFound lxml version %s<>.z.lxml is not installed or couldn't be imported.Nr zFound html5lib version %sz2html5lib is not installed or couldn't be imported.<2E>readzhttp:zhttps:z<"%s" looks like a URL. Beautiful Soup is not an HTTP client.zpYou need to use some other library to get the document behind the URL, and feed that document to Beautiful Soup.z7"%s" looks like a filename. Reading data from the file.<2E>z#Trying to parse your markup with %sF)<01>featuresT<73>%s could not parse the markup.z#Here's what %s did with the markup:zP--------------------------------------------------------------------------------)<1E>printr<00>sys<79>versionr<00>buildersr<00>remove<76>appendr
r <00>join<69>map<61>str<74> LXML_VERSION<4F> ImportErrorr <00>hasattrr<00>
startswith<EFBFBD>os<6F>path<74>exists<74>open<65>
ValueErrorr<00> Exception<6F> traceback<63> print_exc<78>prettify) <0B>data<74> basic_parsers<72>name<6D>builderr <00>er <00>fp<66>parser<65>success<73>soup<75>r1<00>_/home/infidel/Sync/Project/ocp-wg-backend/acer-env/lib/python3.10/site-packages/bs4/diagnose.py<70>diagnoses<> 

<02>
<02><04><02>
 <10><08><02><10><08><02>

   

<1C><04> <02>   <08><02>  
<04>r3TcKspddlm}|<02>dd<04>}t|t<04>r|<00>d<05>}t|<00>}|j|f||d<06>|<02><01>D]\}}td||j |j
f<00>q&dS) a<>Print out the lxml events that occur during parsing.
This lets you see how lxml parses a document when no Beautiful
Soup code is running. You can use this to determine whether
an lxml-specific problem is in Beautiful Soup's lxml tree builders
or in lxml itself.
:param data: Some markup.
:param html: If True, markup will be parsed with lxml's HTML parser.
if False, lxml's XML parser will be used.
rr <00>recoverT<72>utf8)<02>htmlr4z %s, %4s, %sN) r
r <00>pop<6F>
isinstancer<00>encoder<00> iterparser<00>tag<61>text)r(r6<00>kwargsr r4<00>reader<65>event<6E>elementr1r1r2<00>
lxml_trace]s 

<02><04><0E><04>rAc@s`eZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z dd<0F>Z
dd<11>Z dd<13>Z dd<15>Z dS)<17>AnnouncingParserz<72>Subclass of HTMLParser that announces parse events, without doing
anything else.
You can use this to get a picture of how html.parser sees a given
document. The easiest way to do this is to call `htmlparser_trace`.
cCs t|<01>dS)N)r)<02>self<6C>sr1r1r2<00>_p{s zAnnouncingParser._pcC<00>|<00>d|<00>dS)Nz%s START<52>rE)rCr*<00>attrsr1r1r2<00>handle_starttag~<00>z AnnouncingParser.handle_starttagcCrF)Nz%s ENDrG<00>rCr*r1r1r2<00> handle_endtag<61>rJzAnnouncingParser.handle_endtagcCrF)Nz%s DATArG<00>rCr(r1r1r2<00> handle_data<74>rJzAnnouncingParser.handle_datacCrF)Nz
%s CHARREFrGrKr1r1r2<00>handle_charref<65>rJzAnnouncingParser.handle_charrefcCrF)Nz %s ENTITYREFrGrKr1r1r2<00>handle_entityref<65>rJz!AnnouncingParser.handle_entityrefcCrF)Nz
%s COMMENTrGrMr1r1r2<00>handle_comment<6E>rJzAnnouncingParser.handle_commentcCrF)Nz%s DECLrGrMr1r1r2<00> handle_decl<63>rJzAnnouncingParser.handle_declcCrF)Nz%s UNKNOWN-DECLrGrMr1r1r2<00> unknown_decl<63>rJzAnnouncingParser.unknown_declcCrF)Nz%s PIrGrMr1r1r2<00> handle_pi<70>rJzAnnouncingParser.handle_piN)<0E>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rErIrLrNrOrPrQrRrSrTr1r1r1r2rBss rBcCst<00>}|<01>|<00>dS)z<>Print out the HTMLParser events that occur during parsing.
This lets you see how HTMLParser parses a document when no
Beautiful Soup code is running.
:param data: Some markup.
N)rB<00>feed)r(r.r1r1r2<00>htmlparser_trace<63>srZ<00>aeiou<6F>bcdfghjklmnpqrstvwxyz<79>cCs:d}t|<00>D]}|ddkrt}nt}|t<03>|<03>7}q|S)z#Generate a random word-like string.r<00>r)<05>range<67> _consonants<74>_vowels<6C>random<6F>choice)<04>lengthrD<00>i<>tr1r1r2<00>rword<72>s  rg<00>cCsd<01>dd<03>t|<00>D<00><01>S)z'Generate a random sentence-like string.<2E> css <00>|] }tt<01>dd<01><02>VqdS)rh<00> N)rgrb<00>randint)<02>.0rer1r1r2<00> <genexpr><3E>s<02>zrsentence.<locals>.<genexpr>)rr_)rdr1r1r2<00> rsentence<63>srn<00><>cCs<>gd<01>}g}t|<00>D]9}t<01>dd<03>}|dkr#t<01>|<01>}|<02>d|<00>q
|dkr3|<02>tt<01>dd<06><02><01>q
|dkrCt<01>|<01>}|<02>d|<00>q
d d
<EFBFBD>|<02>d S) z+Randomly generate an invalid HTML document.)<07>p<>div<69>spanre<00>b<>script<70>tabler<00>z<%s><3E>rhr^z</%s>z<html><3E>
z</html>)r_rbrkrcrrnr)<06> num_elements<74> tag_names<65>elementsrerc<00>tag_namer1r1r2<00>rdoc<6F>s  

<02>r}c
Cs&tdt<00>t|<00>}tdt|<01><00>dddgddfD]>}d}zt<04><04>}t||<02>}t<04><04>}d}WntyK}ztd |<00>t<07><08>WYd
}~nd
}~ww|rXtd |||f<00>qd d l m
}t<04><04>}|<08> |<01>t<04><04>}td||<00>d d
l } | <09> <0A>}t<04><04>}|<02>|<01>t<04><04>}td||<00>d
S)z.Very basic head-to-head performance benchmark.z1Comparative parser benchmark on Beautiful Soup %sz3Generated a large invalid HTML document (%d bytes).r
r6r rFTrNz"BS4+%s parsed the markup in %.2fs.rr z$Raw lxml parsed the markup in %.2fs.z(Raw html5lib parsed the markup in %.2fs.)rrr}<00>len<65>timerr$r%r&r
r <00>HTMLr r<00>parse)
ryr(r.r/<00>ar0rsr,r r r1r1r2<00>benchmark_parsers<72>s: 
 <08><02><02> 

r<>r
cCsXt<00><01>}|j}t|<00>}tt||d<01>}t<06>d|||<03>t<08> |<03>}|<06>
d<03>|<06> dd<05>dS)z7Use Python's profiler on a randomly generated document.)<03>bs4r(r.zbs4.BeautifulSoup(data, parser)<29>
cumulativez _html5lib|bs4<73>2N) <0C>tempfile<6C>NamedTemporaryFiler*r}<00>dictr<74><00>cProfile<6C>runctx<74>pstats<74>Stats<74>
sort_stats<EFBFBD> print_stats)ryr.<00>
filehandle<EFBFBD>filenamer(<00>vars<72>statsr1r1r2<00>profile<6C>s

r<><00>__main__)T)r])rh)ro)r~)r~r
)!rX<00> __license__r<5F><00>ior<00> html.parserrr<>rr<00> bs4.builderrrr<>rbr<>r<>r%rr3rArBrZrar`rgrnr}r<>r<>rU<00>stdinrr1r1r1r2<00><module>s<   
G& 



<04>