/usr/lib/python3/dist-packages/lxml/html/__pycache__
NameSizeModeActions
builder.cpython-310.pyc29170644editdlrm
clean.cpython-310.pyc176780644editdlrm
defs.cpython-310.pyc27910644editdlrm
diff.cpython-310.pyc240530644editdlrm
ElementSoup.cpython-310.pyc4900644editdlrm
formfill.cpython-310.pyc73630644editdlrm
html5parser.cpython-310.pyc63930644editdlrm
soupparser.cpython-310.pyc79930644editdlrm
usedoctest.cpython-310.pyc4160644editdlrm
_diffcommand.cpython-310.pyc22760644editdlrm
_html5builder.cpython-310.pyc35820644editdlrm
_setmixin.cpython-310.pyc20750644editdlrm
__init__.cpython-310.pyc564330644editdlrm
Edit: /usr/lib/python3/dist-packages/lxml/html/__pycache__/html5parser.cpython-310.pyc (6393B)
o ;/b!@sndZddlZddlZddlmZddlmZddlm Z ddl m Z m Z m Z zeZWn ey7eefZYnwzddlmZWneyOddlmZYnwzddlmZWneygddlmZYnwGd d d eZzdd lmZWn eyYn wGd d d eZeZddZdddZ  dddZ  dddZdddZ dddZ!ddZ"eZ#dS)z? An interface to html5lib that mimics the lxml.html interface. N) HTMLParser) TreeBuilder)etree)ElementXHTML_NAMESPACE_contains_block_level_tag)urlopen)urlparsec@eZdZdZdddZdS)rz*An html5lib HTML parser with lxml as tree.FcKtj|f|td|dSN)stricttree) _HTMLParser__init__rselfr kwargsr7/usr/lib/python3/dist-packages/lxml/html/html5parser.pyrzHTMLParser.__init__NF__name__ __module__ __qualname____doc__rrrrrrr) XHTMLParserc@r )rz+An html5lib XHTML Parser with lxml as tree.FcKr r ) _XHTMLParserrrrrrrr*rzXHTMLParser.__init__Nrrrrrrr'rrcCs(||}|dur |S|dt|fS)Nz{%s}%s)findr)rtagelemrrr _find_tag0s r#cCs^t|ts td|durt}i}|durt|trd}|dur$||d<|j|fi|S)z Parse a whole document into a string. If `guess_charset` is true, or if the input is not Unicode but a byte string, the `chardet` library will perform charset guessing on the string. string requiredNT useChardet) isinstance_strings TypeError html_parserbytesparsegetroot)html guess_charsetparseroptionsrrrdocument_fromstring7s r1FcCst|ts td|durt}i}|durt|trd}|dur$||d<|j|dfi|}|rKt|dtrK|rK|drHtd|d|d=|S)a`Parses several HTML elements, returning a list of elements. The first item in the list may be a string. If no_leading_text is true, then it will be an error if there is leading text, and it will always be a list of only elements. If `guess_charset` is true, the `chardet` library will perform charset guessing on the string. r$NFr%divrzThere is leading text: %r) r&r'r(r)r* parseFragmentstripr ParserError)r-no_leading_textr.r/r0childrenrrrfragments_fromstringOs$  r8cCst|ts tdt|}t|||| d}|r;t|tsd}t|}|r9t|dtr4|d|_|d=|||S|sBt dt |dkrMt d|d}|j ra|j rat d|j d |_ |S) aParses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If 'create_parent' is true (or is a tag name) then a parent node will be created to encapsulate the HTML in a single element. In this case, leading or trailing text is allowed. If `guess_charset` is true, the `chardet` library will perform charset guessing on the string. r$)r.r/r6r2rzNo elements foundzMultiple elements foundzElement followed by text: %rN) r&r'r(boolr8rtextextendrr5lentailr4)r- create_parentr.r/accept_leading_textelementsnew_rootresultrrrfragment_fromstringqs4       rDcCst|ts tdt|||d}|dd}t|tr!|dd}|}|ds1|dr3|St |d }t |r>|St |d }t |d kra|j rQ|j sa|d j r]|d j sa|d St|rjd|_|Sd|_|S)aParse the html, returning a single element/document. This tries to minimally parse the chunk of text, without knowing if it is a fragment or a document. 'base_url' will set the document's base_url attribute (and the tree's docinfo.URL) If `guess_charset` is true, or if the input is not Unicode but a byte string, the `chardet` library will perform charset guessing on the string. r$)r/r.N2asciireplacezrr!)r-r.r/docstartrHrIrrr fromstrings4        rRcCs~|durt}t|ts|}|durd}nt|r#t|}|dur"d}n t|d}|dur.d}i}|r6||d<|j|fi|S)a*Parse a filename, URL, or file-like object into an HTML document tree. Note: this returns a tree, not an element. Use ``parse(...).getroot()`` to get the document root. If ``guess_charset`` is true, the ``useChardet`` option is passed into html5lib to enable character detection. This option is on by default when parsing from URLs, off by default when parsing from file(-like) objects (which tend to return Unicode more often than not), and on by default when parsing from a file path (which is read in binary mode). NFTrbr%)r)r&r'_looks_like_urlropenr+)filename_url_or_filer.r/fpr0rrrr+s&   r+cCs<t|d}|s dStjdkr|tjvrt|dkrdSdS)NrFwin32r9T)r sysplatformstring ascii_lettersr=)strschemerrrrTs    rT)NN)FNN)$rrYr[html5librr html5lib.treebuilders.etree_lxmlrlxmlr lxml.htmlrrr basestringr' NameErrorr*r]urllib2r ImportErrorurllib.requestr urllib.parserr xhtml_parserr#r1r8rDrRr+rTr)rrrrsT          " , 6$