Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Cj0@sPddlmZddlmZmZGdddeZGdddeZdd Zd d Z d S) ) ascii_lower)compile_selector_listsplit_whitespacec@s&eZdZdddZdefddZdS)cached_propertyNcCs*|p|j|_|j|_|p|j|_||_dS)N)__name__ __module____doc__func)selfr namedocr5/tmp/pip-build-_d5lkt3n/cssselect2/cssselect2/tree.py__init__ s  zcached_property.__init__cCs>|dkr |S|jj|j|}||kr:|j|}||j|j<|S)N)__dict__getrr )r objtypeZ_cached_property__missingvaluerrr__get__s  zcached_property.__get__)NN)rr __qualname__robjectrrrrrrs rc@seZdZdZed2ddZed3ddZed4dd Zd5d d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZeddZddZd d!Zd"d#Zed$d%Zed&d'Zed(d)Zed*d+Zed,d-Zed.d/Zed0d1ZdS)6ElementWrappera  A wrapper for an ElementTree :class:`xml.etree.ElementTree.Element` for Selector matching. This class should not be instanciated directly. :meth:`from_xml_root` or :meth:`from_html_root` should be used for the root element of a document, and other elements should be accessed (and wrappers generated) using methods such as :meth:`iter_children` and :meth:`iter_subtree`. :class:`ElementWrapper` objects compare equal if their underlying :class:`xml.etree.ElementTree.Element` do. NcCs|j||ddS)a.Wrap for selector matching the root of an XML or XHTML document. :param root: An ElementTree :class:`xml.etree.ElementTree.Element` for the root element of a document. If the given element is not the root, selector matching will behave is if it were. In other words, selectors will be not be `scoped`_ to the subtree rooted at that element. :returns: A new :class:`ElementWrapper` .. _scoped: https://drafts.csswg.org/selectors-4/#scoping F)in_html_document) _from_root)clsrootcontent_languagerrr from_xml_root)szElementWrapper.from_xml_rootcCs|j||ddS)a2Same as :meth:`from_xml_root`, but for documents parsed with an HTML parser like html5lib, which should be the case of documents with the ``text/html`` MIME type. Compared to :meth:`from_xml_root`, this makes element attribute names in Selectors case-insensitive. T)r)r)rrrrrrfrom_html_root<s zElementWrapper.from_html_rootTcCs&t|dr|j}||ddd||dS)Ngetrootr)parentindexpreviousrr)hasattrr!)rrrrrrrrHs   zElementWrapper._from_rootcCsB||_||_||_|dk r$|j|_n|g|_||_||_||_dS)N) etree_elementr"r$etree_childrenZetree_siblingsr#rtransport_content_language)r r&r"r#r$rrrrrrPs zElementWrapper.__init__cCst|t|ko|j|jkS)N)rr&)r otherrrr__eq__hszElementWrapper.__eq__cCs ||k S)Nr)r r)rrr__ne__lszElementWrapper.__ne__cCstt||jfS)N)hashrr&)r rrr__hash__oszElementWrapper.__hash__ccsx|jD] }|Vq WdS)N) iter_children)r elementrrr__iter__rszElementWrapper.__iter__ccs$|}x|jdk r|j}|VqWdS)uReturn an iterator of existing :class:`ElementWrapper` objects for this element’s ancestors, in reversed tree order (from :attr:`parent` to the root) The element itself is not included, this is an empty sequence for the root element. N)r")r r/rrriter_ancestorsvs  zElementWrapper.iter_ancestorsccs$|}x|jdk r|j}|VqWdS)uReturn an iterator of existing :class:`ElementWrapper` objects for this element’s previous siblings, in reversed tree order. The element itself is not included, this is an empty sequence for a first child or the root element. N)r$)r r/rrriter_previous_siblingss  z%ElementWrapper.iter_previous_siblingsccs>d}x4t|jD]&\}}t||||||jd}|VqWdS)uReturn an iterator of newly-created :class:`ElementWrapper` objects for this element’s child elements, in tree order. N)r"r#r$r) enumerater'rr)r childiZ etree_childrrrr.s zElementWrapper.iter_childrenccsNt|gg}x<|rHt|dd}|dkr2|jq|V|j|jqWdS)aReturn an iterator of newly-created :class:`ElementWrapper` objects for the entire subtree rooted at this element, in tree order. Unlike in other methods, the element itself *is* included. This loops over an entire document: .. code-block:: python for element in ElementWrapper.from_root(root_etree).iter_subtree(): ... rN)iternextpopappendr.)r stackr/rrr iter_subtrees  zElementWrapper.iter_subtreecCsdd|DS)NcSsBg|]:}t|dr|gnt|D]}|jdkr |j r |jq qS)testN)r%rZpseudo_elementZ never_matchesr=).0selectorZcompiled_selectorrrr s   z+ElementWrapper._compile..r) selectorsrrr_compileszElementWrapper._compilecstfddj|DS)zReturn wether this elememt matches any of the given selectors. :param selectors: Each given selector is either a :class:`compiler.CompiledSelector`, or an argument to :func:`compile_selector_list`. c3s|]}|VqdS)Nr)r>r=)r rr sz)ElementWrapper.matches..)anyrB)r rAr)r rmatchesszElementWrapper.matchescsN|j|tdkr(td|jS|rBfdd|jDStfSdS)a Return elements, in tree order, that match any of the given selectors. Selectors are `scoped`_ to the subtree rooted at this element. .. _scoped: https://drafts.csswg.org/selectors-4/#scoping :param selectors: Each given selector is either a :class:`compiler.CompiledSelector`, or an argument to :func:`compile_selector_list`. :returns: An iterator of newly-created :class:`ElementWrapper` objects. rrc3s(|] tfddDrVqdS)c3s|]}|VqdS)Nr)r>r=)r/rrrCsz5ElementWrapper.query_all...N)rD)r>)tests)r/rrCsz+ElementWrapper.query_all..N)rBlenfilterr<r7)r rAr)rFr query_alls    zElementWrapper.query_allcGst|j|dS)aReturn the first element (in tree order) that matches any of the given selectors. :param selectors: Each given selector is either a :class:`compiler.CompiledSelector`, or an argument to :func:`compile_selector_list`. :returns: A newly-created :class:`ElementWrapper` object, or :obj:`None` if there is no match. N)r8rI)r rArrrquerys zElementWrapper.querycCsdd|jDS)uKThis element’s children, as a list of ElementTree :class:`xml.etree.ElementTree.Element`. Other ElementTree nodes such as :func:`comments ` and :func:`processing instructions ` are not included. cSsg|]}t|jtr|qSr) isinstancetagstr)r>crrrr@sz1ElementWrapper.etree_children..)r&)r rrrr's zElementWrapper.etree_childrencCs"t|jj\}}||jtd<|S)z,The local name of this element, as a string. namespace_url)_split_etree_tagr&rLrrM)r rO local_namerrrrQ szElementWrapper.local_namecCs"t|jj\}}||jtd<|S)z/The namespace URL of this element, as a string.rQ)rPr&rLrrM)r rOrQrrrrOszElementWrapper.namespace_urlcCs |jjdS)z$The ID of this element, as a string.id)r&r)r rrrrRszElementWrapper.idcCstt|jjddS)z:The classes of this element, as a :class:`set` of strings.class)setrr&r)r rrrclassesszElementWrapper.classescCs|jjd}|dk rt|S|jp*|jdk}|rL|jjd}|dk rLt|S|jdk r^|jjS|rd}|jjd}x2|D]*}|jdd}t|dkrxt|jd }qxW|dk rt|St|j pdS) z*The language of this element, as a string.z*{http://www.w3.org/XML/1998/namespace}langNzhttp://www.w3.org/1999/xhtmllangz"{http://www.w3.org/1999/xhtml}metaz http-equivrTzcontent-languagecontent) r&rrrrOr"rWr7_parse_content_languager()r Zxml_langZis_htmlrWriteratormetaZ http_equivrrrrW!s0      zElementWrapper.langcCs\|jdkrdS|jjjdkrT|jjjddk rT|jjdksPtdd|jDrTdS|jjS)NFz&{http://www.w3.org/1999/xhtml}fieldsetdisabledz${http://www.w3.org/1999/xhtml}legendcss|]}|jjdkVqdS)z${http://www.w3.org/1999/xhtml}legendN)r&rL)r>srrrrCJsz6ElementWrapper.in_disabled_fieldset..T)r"r&rLrrDr2in_disabled_fieldset)r rrrr^As z#ElementWrapper.in_disabled_fieldset)N)N)T)N)rrrr classmethodrr rrr*r+r-r0r1r2r.r< staticmethodrBrErIrJrr'rQrOrRrVrWr^rrrrrs6            rcCsJ|jd}|dkrd|fS|ddks*t|d|||ddfSdS)N}rrTr{r6)rfindAssertionError)rLposrrrrPQs  rPcCs0|dk r,d|kr,t|}t|dkr,|dSdS)N,rr)rrG)rpartsrrrrYZs rYN) webencodingsrcompilerrrrrrrPrYrrrrs 9