Files
PowerToys/PythonHome/Lib/site-packages/bs4/builder/__init__.pyc

68 lines
11 KiB
Plaintext
Raw Normal View History

2014-07-10 23:57:08 +08:00
<03>
m<EFBFBD><EFBFBD>Sc@s|ddlmZddlZddlZddlmZmZmZddddgZdZ d Z
d
Z d Z d Z d Zdefd<00><00>YZe<00>Zdefd<00><00>YZdefd<00><00>YZdefd<00><00>YZd<00>Zdefd<00><00>YZddlmZee<00>yddlmZee<00>Wnek
rEnXyddlmZee<00>Wnek
rwnXdS(i<><69><EFBFBD><EFBFBD>(t defaultdictN(tCharsetMetaAttributeValuetContentMetaAttributeValuet whitespace_retHTMLTreeBuildertSAXTreeBuildert TreeBuildertTreeBuilderRegistrytfastt
permissivetstricttxmlthtmlthtml5cBs#eZd<00>Zd<00>Zd<00>ZRS(cCstt<00>|_g|_dS(N(Rtlisttbuilders_for_featuretbuilders(tself((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt__init__scCsBx(|jD]}|j|jd|<00>q
W|jjd|<00>dS(s8Register a treebuilder based on its advertised features.iN(tfeaturesRtinsertR(Rttreebuilder_classtfeature((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytregister scGst|j<00>dkrdSt|<00>dkr6|jdSt|<00>}|j<00>d}d}x<>t|<00>dkr<>|j<00>}|jj|g<00>}t|<00>dkr[|dkr<>|}t|<00>}q<>|j t|<00><00>}q[q[W|dkr<>dSx|D]}||kr<>|Sq<53>WdS(Ni(
tlenRtNoneRtreversetpopRtgettsett intersection(RRt
candidatest candidate_setRtwe_have_the_featuret candidate((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytlookup&s.  
     (t__name__t
__module__RRR#(((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyRs  cBs}eZdZgZeZe<00>Zd Z iZ
d<00>Z d<00>Z d<00>Z d<00>Zd d d<00>Zd<00>Zd<00>Zd<00>ZRS(
s2Turn a document into a Beautiful Soup object tree.cCs d|_dS(N(Rtsoup(R((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyR_scCsdS(N((R((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytresetbscCs |jdkrtS||jkS(s<>Might a tag with this name be an empty-element tag?
The final markup may or may not actually present this tag as
self-closing.
For instance: an HTMLBuilder does not consider a <p> tag to be
an empty-element tag (it's not in
HTMLBuilder.empty_element_tags). This means an empty <p> tag
will be presented as "<p></p>", not "<p />".
The default implementation has no opinion about which tags are
empty-element tags, so a tag will be presented as an
empty-element tag if and only if it has no contents.
"<foo></foo>" will become "<foo />", and "<foo>bar</foo>" will
be left alone.
N(tempty_element_tagsRtTrue(Rttag_name((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytcan_be_empty_elementescCs t<00><00>dS(N(tNotImplementedError(Rtmarkup((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytfeedzscCs|ddtfS(N(RtFalse(RR-tuser_specified_encodingtdocument_declared_encoding((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytprepare_markup}scCs|S(s<>Wrap an HTML fragment to make it look like a document.
Different parsers do this differently. For instance, lxml
introduces an empty <head> tag, and html5lib
doesn't. Abstracting this away lets us write simple tests
which run HTML fragments through the parser and compare the
results against other HTML fragments.
This method should not be used outside of tests.
((Rtfragment((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyttest_fragment_to_document<6E>s cCstS(N(R/(Rttag((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytset_up_substitutions<6E>scCs<>|s
|S|jr<>|jjdg<00>}|jj|j<00>d<00>}xs|j<00>D]b}||kst|rP||krP||}t|t<00>r<>tj|<00>}n|}|||<qPqPWn|S(saReplaces class="foo bar" with class=["foo", "bar"]
Modifies its input in place.
t*N( tcdata_list_attributesRtlowerRtkeyst
isinstancet
basestringRtsplit(RR*tattrst universalt tag_specifictattrtvaluetvalues((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt$_replace_cdata_list_attribute_values<65>s  
N(R$R%t__doc__RR/tis_xmlRtpreserve_whitespace_tagsRR(R8RR'R+R.R2R4R6RD(((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyRPs       cBsqeZdZd<00>Zd<00>Zd<00>Zd<00>Zd<00>Zd<00>Zd<00>Z d<00>Z
d <00>Z d
<00>Z d <00>Z RS( s9A Beautiful Soup treebuilder that listens for SAX events.cCs t<00><00>dS(N(R,(RR-((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyR.<00>scCsdS(N((R((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytclose<73>scCs9td<00>t|j<00><00>D<><00>}|jj||<00>dS(Ncss%|]\}}|d|fVqdS(iN((t.0tkeyRB((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pys <genexpr><3E>s(tdictRtitemsR&thandle_starttag(RtnameR>((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt startElement<6E>s"cCs|jj|<00>dS(N(R&t handle_endtag(RRN((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt
endElement<6E>scCs|j||<00>dS(N(RO(RtnsTupletnodeNameR>((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytstartElementNS<4E>scCs|j|<00>dS(N(RQ(RRRRS((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt endElementNS<4E>scCsdS(N((Rtprefixt nodeValue((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytstartPrefixMapping<6E>scCsdS(N((RRV((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytendPrefixMapping<6E>scCs|jj|<00>dS(N(R&t handle_data(Rtcontent((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt
characters<72>scCsdS(N((R((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt startDocument<6E>scCsdS(N((R((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt endDocument<6E>s(R$R%RER.RHRORQRTRURXRYR\R]R^(((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyR<00>s          c
Bs<>eZdZeddg<00>Zeddddddd d
d g <00>Zi d d dgd6ddgd6ddgd 6dgd6dgd6dgd6dgd6dgd6dgd6dgd6dgd6dgd 6Zd!<00>ZRS("s]This TreeBuilder knows facts about HTML.
Such as which tags are empty-element tags.
tprettextareatbrthrtinputtimgtmetatspacertlinktframetbasetclasst accesskeytdropzoneR7treltrevtatheadersttdtthsaccept-charsettformtarchivetobjecttareatsizesticontsandboxtiframetfortoutputcCs<>|jdkrtS|jd<00>}|jd<00>}|jd<00>}d}|dk rk|}t|<00>|d<n=|dk r<>|dk r<>|j<00>dkr<>t|<00>|d<n|dk S(NRes
http-equivR[tcharsets content-type(RNR/RRRR9R(RR5t
http_equivR[R}t meta_encoding((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyR6<00>s  (R$R%RERRGR(R8R6(((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyR<00>s$   







 cCsvtjd}xb|jD]W}t||<00>}t|t<00>rt|||<00>|jj|<00>|jj |<00>qqWdS(s9Copy TreeBuilders from the given module into this module.s bs4.builderN(
tsystmodulest__all__tgetattrt
issubclassRtsetattrtappendtbuilder_registryR(tmodulet this_moduleRNtobj((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pytregister_treebuilders_from s tParserRejectedMarkupcBseZRS((R$R%(((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyR<79>-si(t _htmlparser(t _html5lib(t_lxml(t collectionsRt itertoolsR<73>t bs4.elementRRRR<>tFASTt
PERMISSIVEtSTRICTtXMLtHTMLtHTML_5RuRR<>RRRR<>t ExceptionR<6E>tR<>R<>t ImportErrorR<72>(((sWe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\builder\__init__.pyt<module>s@   4 _.C