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

103 lines
14 KiB
Plaintext
Raw Normal View History

2014-07-10 23:57:08 +08:00
<03>
m<EFBFBD><EFBFBD>Sc@s`dZdZdZdZdZdgZddlZddlZddlZdd l m
Z
m Z dd
l m Z dd lmZmZmZmZmZmZmZmZmZmZmZd Zdefd <00><00>YZeZeZdefd<00><00>YZdefd<00><00>YZ de!fd<00><00>YZ"e#dkr\ddl$Z$ee$j%<00>Z&e&j'<00>GHndS(sPBeautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides provides methods and Pythonic idioms that make it easy to
navigate, search, and modify the parse tree.
Beautiful Soup works with Python 2.6 and up. It works better if lxml
and/or html5lib is installed.
For more than you ever wanted to know about Beautiful Soup, see the
documentation:
http://www.crummy.com/software/BeautifulSoup/bs4/doc/
s*Leonard Richardson (leonardr@segfault.org)s4.3.2s*Copyright (c) 2004-2013 Leonard RichardsontMITt BeautifulSoupi<70><69><EFBFBD><EFBFBD>Ni(tbuilder_registrytParserRejectedMarkup(t UnicodeDammit( tCDatatCommenttDEFAULT_OUTPUT_ENCODINGt DeclarationtDoctypetNavigableStringt PageElementtProcessingInstructiont ResultSett SoupStrainertTagu<67>You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work. You need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).cBs<>eZdZdZddgZdZdddddd<00>Zd<00>Zd<00>Z ddd <00>Z
e d
<00>Z d <00>Z d <00>Zd <00>Zd<00>Ze d<00>Zddd<00>Zded<00>Zd<00>Zdd<00>Zd<00>Zeedd<00>ZRS(s
This class defines the basic interface called by the tree builders.
These methods will be called by the parser:
reset()
feed(markup)
The tree builder may call these methods from its feed() implementation:
handle_starttag(name, attrs) # See note about return value
handle_endtag(name)
handle_data(data) # Appends to the current data node
endData(containerClass=NavigableString) # Ends the current data node
No matter how complicated the underlying parser is, you should be
able to build a tree using 'start tag' events, 'end tag' events,
'data' events, and "done with data" events.
If you encounter an empty-element tag (aka a self-closing tag,
like HTML's <br> tag), call handle_starttag and then
handle_endtag.
u
[document]thtmltfasts
tc  std<00>krtjd<00>nd<00>kr?<00>d=tjd<00>nd<00>krb<00>d=tjd<00>nd<00>kr<><00>d=tjd<00>nd <00>kr<><00>d =tjd
<00>n<00>fd <00>}|p<>|d d <00>}|p<>|dd<00>}t<00><00>dkr<01>j<00>j<00>}td|<16><00>n|dkr<>t|t<00>r?|g}n|dks]t|<00>dkri|j }nt
j |<00>} | dkr<>t ddj |<00><16><00>n| <00>}n||_|j|_||j_||_t|d<00>r<>|j<00>}nt|<00>dkr<>t|t<00>r4tjj r4|jd<00>}
n|}
t} ytjj|
<00>} Wntk
rk} nX| r<>tjd|<16>n|d dks<>|d dkr<>t|t<00>r<>d|ks<>t|t<00>r<>d|kr<>tjd|<16>q<>q<>nxb|jj||<00>D]K\|_|_|_ |_!|j"<00>y|j#<00>PWq t$k
rVq Xq Wd|_d|j_dS( s<>The Soup object is initialized as the 'root tag', and the
provided markup (which can be a string or a file-like object)
is fed into the underlying parser.tconvertEntitiess<73>BS4 does not respect the convertEntities argument to the BeautifulSoup constructor. Entities are always converted to Unicode characters.t markupMassages<65>BS4 does not respect the markupMassage argument to the BeautifulSoup constructor. The tree builder is responsible for any necessary markup massage.t smartQuotesTos<6F>BS4 does not respect the smartQuotesTo argument to the BeautifulSoup constructor. Smart quotes are always converted to Unicode characters.tselfClosingTagss<73>BS4 does not respect the selfClosingTags argument to the BeautifulSoup constructor. The tree builder is responsible for understanding self-closing tags.tisHTMLs<4C>BS4 does not respect the isHTML argument to the BeautifulSoup constructor. You can pass in features='html' or features='xml' to get a builder capable of handling one or the other.cs<|<00>kr8tjd||f<16><01>|}<00>|=|SdS(NsLThe "%s" argument to the BeautifulSoup constructor has been renamed to "%s."(twarningstwarntNone(told_nametnew_nametvalue(tkwargs(sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pytdeprecated_argumentys 
tparseOnlyTheset
parse_onlyt fromEncodingt from_encodingis2__init__() got an unexpected keyword argument '%s'sjCouldn't find a tree builder with the features you requested: %s. Do you need to install a parser library?t,treaditutf8sw"%s" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.ishttp:ishttps:t u s<>"%s" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client to get the document behind the URL, and feed that document to Beautiful Soup.N(%RRtlentkeystpopt TypeErrorRt
isinstancet
basestringtDEFAULT_BUILDER_FEATURESRtlookuptFeatureNotFoundtjointbuildertis_xmltsoupR!thasattrR%tunicodetostpathtsupports_unicode_filenamestencodetFalsetexistst Exceptiontbytestprepare_markuptmarkuptoriginal_encodingtdeclared_html_encodingtcontains_replacement_characterstresett_feedR( tselfR@tfeaturesR2R!R#RRtargt builder_classtpossible_filenametis_filete((RsOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt__init__Ps<> 
 
 
 
 

              1

  cCsT|jj<00>|jj|j<00>|j<00>x#|jj|jkrO|j<00>q-WdS(N( R2RDtfeedR@tendDatat
currentTagtnamet ROOT_TAG_NAMEtpopTag(RF((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyRE<00>s
 
cCsgtj|||j|j<00>d|_|jj<00>g|_d|_g|_ g|_
|j |<00>dS(Ni( RRMR2RRthiddenRDt current_dataRRPttagStacktpreserve_whitespace_tag_stacktpushTag(RF((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyRD<00>s      cKstd|j||||<00>S(s+Create a new tag associated with this soup.N(RRR2(RFRQt namespacetnsprefixtattrs((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pytnew_tag<61>scCs||<00>}|j<00>|S(s7Create a new NavigableString associated with this soup.(tsetup(RFtstsubclasst navigable((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt
new_string<6E>s 
cCstd<00><00>dS(Ns4BeautifulSoup objects don't support insert_before().(tNotImplementedError(RFt successor((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt insert_before<72>scCstd<00><00>dS(Ns3BeautifulSoup objects don't support insert_after().(Rb(RFRc((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt insert_after<65>scCs^|jj<00>}|jr;||jdkr;|jj<00>n|jrW|jd|_n|jS(Ni<4E><69><EFBFBD><EFBFBD>(RVR*RWRP(RFttag((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyRS<00>s  cCsk|jr|jjj|<00>n|jj|<00>|jd|_|j|jjkrg|jj|<00>ndS(Ni<4E><69><EFBFBD><EFBFBD>(RPtcontentstappendRVRQR2tpreserve_whitespace_tagsRW(RFRf((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyRX<00>s  cCs<>|jr<>dj|j<00>}|js{t}x'|D]}||jkr1t}Pq1q1W|r{d|krod}qxd}q{ng|_|jr<>t|j<00>dkr<>|jj s<>|jj
|<00> r<>dS||<00>}|j |<00>ndS(Nus
R'i( RUR1RWtTruet ASCII_SPACESR;R!R(RVttexttsearchtobject_was_parsed(RFtcontainerClassRUt
strippabletito((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyROs&         cCsc|p |j}|p|j}|j||<00>|dk rF||_n||_|jj|<00>dS(s Add an object to the parse tree.N(RPt_most_recent_elementR]Rt next_elementRgRh(RFRrtparenttmost_recent_element((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyRn"s   cCs<>||jkrdSd}t|j<00>}xnt|ddd<00>D]V}|j|}||jkr<>||jkr<>|r<>|j<00>}nPn|j<00>}q?W|S(s<>Pops the tag stack up to and including the most recent
instance of the given tag. If inclusivePop is false, pops the tag
stack up to but *not* including the most recent instqance of
the given tag.Niii<><69><EFBFBD><EFBFBD>(RRRR(RVtrangeRQtprefixRS(RFRQRZt inclusivePoptmost_recently_poppedt
stack_sizeRqtt((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt _popToTag-s c Cs<>|j<00>|jrNt|j<00>dkrN|jjsJ|jj||<00> rNdSt||j|||||j |j
<00>}|dkr<>|S|j
r<>||j
_ n||_
|j |<00>|S(sPush a start tag on to the stack.
If this method returns None, the tag was rejected by the
SoupStrainer. You should proceed as if the tag had not occured
in the document. For instance, if this was a self-closing tag,
don't call handle_endtag.
iN( ROR!R(RVRlt
search_tagRRR2RPRsRtRX(RFRQRYRZR[Rf((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pythandle_starttagDs
     cCs|j<00>|j||<00>dS(N(ROR}(RFRQRZ((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt handle_endtag_s
cCs|jj|<00>dS(N(RURh(RFtdata((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt handle_datadstminimalcCsp|jr5d}|dkr(d|}nd|}nd}|sJd}nd}|tt|<00>j|||<00>S(slReturns a string or Unicode representation of this document.
To get Unicode, pass None for encoding.Rs encoding="%s"u<?xml version="1.0"%s?>
uiN(R3RtsuperRtdecode(RFt pretty_printteventual_encodingt formattert encoding_partRxt indent_level((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyR<79>gs     N(t__name__t
__module__t__doc__RRR.RkRRMRERDR\R
RaRdReRSRXRORnRjR}RR<>R<>R;RR<>(((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyR2s.  }
        tBeautifulStoneSoupcBseZdZd<00>ZRS(s&Deprecated interface to an XML parser.cOs4d|d<tjd<00>tt|<00>j||<00>dS(NtxmlRGsxThe BeautifulStoneSoup class is deprecated. Instead of using it, pass features="xml" into the BeautifulSoup constructor.(RRR<>R<>RM(RFtargsR((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyRM<00>s
(R<>R<>R<>RM(((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyR<79><00>st StopParsingcBseZRS((R<>R<>(((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyR<79><00>sR0cBseZRS((R<>R<>(((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyR0<00>st__main__((R<>t
__author__t __version__t __copyright__t __license__t__all__R7treRR2RRtdammitRtelementRRRRR R
R R R RRt syntax_errorRt_st_soupR<70>R=R<>t
ValueErrorR0R<>tsyststdinR4tprettify(((sOe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\site-packages\bs4\__init__.pyt<module>s.    L<16>L