+
    	i,5                     Z    ^ RI Ht ^ RIHt ^ RIHt ^RIHtHt  ! R R4      t	R t
R tR	# )
    )cached_property)warn)ascii_lower)compile_selector_listsplit_whitespacec                   X  a  ] tR t^	t o Rt]RR l4       t]RR l4       t]R R l4       tRR lt	R t
R tR	 tR
 t]R 4       t]R 4       tR tR tR tR tR tR t]R 4       tR tR tR t]R 4       t]R 4       t]R 4       t]R 4       t ]R 4       t!]R 4       t"]R 4       t#Rt$V t%R# )!ElementWrappera  Wrapper of :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.

Nc                (    V P                  WRR7      # )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clsrootcontent_languages   &&&U/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/cssselect2/tree.pyfrom_xml_rootElementWrapper.from_xml_root   s    " ~~du~MM    c                (    V P                  WRR7      # )zSame as :meth:`from_xml_root` with case-insensitive attribute names.

Useful for documents parsed with an HTML parser like html5lib, which
should be the case of documents with the ``text/html`` MIME type.

Tr   r   r   s   &&&r   from_html_rootElementWrapper.from_html_root(   s     ~~dt~LLr   c           	     `    \        VR 4      '       d   VP                  4       pV ! VR^ RW2R7      # )getrootN)parentindexpreviousr   r   )hasattrr   )r   r   r   r   s   &&&&r   r   ElementWrapper._from_root2   s5    4##<<>DQ-R 	Rr   c                    Wn         W n        W@n        Ve   VP                  V n        MV.V n        W0n        WPn        W`n        R V n        R V n	        R # N)
etree_elementr   r   etree_childrenetree_siblingsr   r   transport_content_language
_ancestors_previous_siblings)selfr#   r   r   r   r   r   s   &&&&&&&r   __init__ElementWrapper.__init__:   s\     +  !
 #)"7"7D#0/D 
 0*:' "&r   c                p    \        V 4      \        V4      J ;'       d    V P                  VP                  8H  # r"   )typer#   r)   others   &&r   __eq__ElementWrapper.__eq__V   s5    J$u+% 6 6%"5"55	7r   c                    W8X  * # r"    r.   s   &&r   __ne__ElementWrapper.__ne__[   s    ""r   c                B    \        \        V 4      V P                  34      # r"   )hashr-   r#   r)   s   &r   __hash__ElementWrapper.__hash__^   s    T$Z!3!3455r   c              #  B   "   V P                  4        R j  xL
  R #  L5ir"   )iter_childrenr8   s   &r   __iter__ElementWrapper.__iter__a   s     %%'''s   c                    V P                   f;   V P                  f   RM$. V P                  P                  OV P                  N5V n         V P                   # )u   Tuple of existing ancestors.

Tuple of existing :class:`ElementWrapper` objects for this element’s
ancestors, in reversed tree order, from :attr:`parent` to the root.

r3   )r'   r   	ancestorsr8   s   &r   r@   ElementWrapper.ancestorsd   sF     ??"kk)/T1F1F/T/T Or   c                    V P                   f;   V P                  f   RM$. V P                  P                  OV P                  N5V n         V P                   # )u   Tuple of previous siblings.

Tuple of existing :class:`ElementWrapper` objects for this element’s
previous siblings, in reversed tree order.

r3   )r(   r   previous_siblingsr8   s   &r   rC    ElementWrapper.previous_siblingsq   sM     ""*mm+A$--11A4==A # &&&r   c              #  Z   "   \        R\        4       V P                   Rj  xL
  R#  L5i)uh  Iterate over ancestors.

Return 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.

This method is deprecated and will be removed in version 0.7.0. Use
:attr:`ancestors` instead.

zfThis method is deprecated and will be removed in version 0.7.0. Use the "ancestors" attribute instead.N)r   DeprecationWarningr@   r8   s   &r   iter_ancestorsElementWrapper.iter_ancestors   s&      	5	  >>!!    +)+c              #  Z   "   \        R\        4       V P                   Rj  xL
  R#  L5i)uo  Iterate over previous siblings.

Return 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.

This method is deprecated and will be removed in version 0.7.0. Use
:attr:`previous_siblings` instead.

znThis method is deprecated and will be removed in version 0.7.0. Use the "previous_siblings" attribute instead.N)r   rF   rC   r8   s   &r   iter_previous_siblings%ElementWrapper.iter_previous_siblings   s(      	=	  ))))rI   c              #  ~   "   V P                   f   V x  R# V P                   P                  4        Rj  xL
  R#  L5i)u   Iterate over siblings.

Return an iterator of newly-created :class:`ElementWrapper` objects for
this element’s siblings, in tree order.

N)r   r<   r8   s   &r   iter_siblingsElementWrapper.iter_siblings   s,      ;;J{{00222s   2=;=c              #  l   "   RpV P                  4        F  pV'       d   Vx  W 8X  g   K  RpK  	  R# 5i)u   Iterate over next siblings.

Return an iterator of newly-created :class:`ElementWrapper` objects for
this element’s next siblings, in tree order.

FTN)rN   )r)   foundsiblings   &  r   iter_next_siblings!ElementWrapper.iter_next_siblings   s1      ))+G	 ,s   %44c           	   #     "   Rp\        V P                  4       F'  w  r#\        V 4      ! W0W!V P                  R7      pVx  K)  	  R# 5i)u   Iterate over children.

Return an iterator of newly-created :class:`ElementWrapper` objects for
this element’s child elements, in tree order.

N)r   r   r   r   )	enumerater$   r-   r   )r)   childietree_childs   &   r   r<   ElementWrapper.iter_children   sF      '(;(;<NAJ!%!6!68E K	 =s   AAc              #     "   \        V .4      .pV'       dO   \        VR,          R4      pVf   VP                  4        K1  Vx  VP                  VP	                  4       4       KV  R# 5i)ah  Iterate over subtree.

Return 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():
        ...

N)iternextpopappendr<   )r)   stackelements   &  r   iter_subtreeElementWrapper.iter_subtree   sT       tf59d+G		W2245 s   A(AA(c                    V  UUu. uFZ  p\        VR 4      '       d   V.M
\        V4       F3  pVP                  e   K  VP                  '       d   K'  VP                  NK5  	  K\  	  upp# u uppi )test)r   r   pseudo_elementnever_matchesrf   )	selectorsselectorcompiled_selectors   &  r   _compileElementWrapper._compile   sz     &1%%h77
*845 " !// # "// #""5 #%1 	1 1s   3A*A*A*c                   a  \         ;QJ d.    V 3R lS P                  V4       4       F  '       g   K   R# 	  R# ! V 3R lS P                  V4       4       4      # )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`.

c              3   2   <"   T F  q! S4      x  K  	  R # 5ir"   r3   ).0rf   r)   s   & r   	<genexpr>)ElementWrapper.matches.<locals>.<genexpr>   s     C*B$4::*B   TF)anyrl   r)   ri   s   f*r   matchesElementWrapper.matches   s@     sC$--	*BCssCsCsC$--	*BCCCr   c                   a V P                  V4      o\        S4      ^8X  d"   \        S^ ,          V P                  4       4      # V'       d   V3R lV P                  4        4       # \	        R4      # )a  Return elements, in tree order, that match any of 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.

c              3      <a"   T FI  o\         ;QJ d    V3R  lS 4       F  '       g   K   RM	  RM! V3R  lS 4       4      '       g   KE  Sx  KK  	  R# 5i)c              3   2   <"   T F  q! S4      x  K  	  R # 5ir"   r3   )rp   rf   rb   s   & r   rq   5ElementWrapper.query_all.<locals>.<genexpr>.<genexpr>  s     7tG}}rs   TFN)rt   )rp   rb   testss   &@r   rq   +ElementWrapper.query_all.<locals>.<genexpr>  s8      9':G377333777 ':s   AAA
Ar3   )rl   lenfilterrc   r]   )r)   ri   r|   s   &*@r   	query_allElementWrapper.query_all   sa     i(u:?%(D$5$5$7889'+'8'8':9 9 8Or   c                6    \        V P                  ! V!  R4      # )a2  Return first element that matches any of 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)r^   r   ru   s   &*r   queryElementWrapper.query  s     DNNI.55r   c                    V P                    Uu. uF'  p\        VP                  \        4      '       g   K%  VNK)  	  up# u upi )zChildren as a list of :class:`xml.etree.ElementTree.Element`.

Other ElementTree nodes such as
:func:`comments <xml.etree.ElementTree.Comment>` and
:func:`processing instructions
<xml.etree.ElementTree.ProcessingInstruction>`
are not included.

)r#   
isinstancetagstr)r)   rb   s   & r   r$   ElementWrapper.etree_children!  s?     $(#5#5-#5'++s+ G#5- 	- -s   "??c                d    \        V P                  P                  4      w  rWP                  R&   V# )z,The local name of this element, as a string.namespace_url_split_etree_tagr#   r   __dict__r)   r   
local_names   &  r   r   ElementWrapper.local_name0  s/     %5T5G5G5K5K$L!)6o&r   c                d    \        V P                  P                  4      w  rW P                  R&   V# )z/The namespace URL of this element, as a string.r   r   r   s   &  r   r   ElementWrapper.namespace_url7  s/     %5T5G5G5K5K$L!&0l#r   c                8    V P                   P                  R4      # )z$The ID of this element, as a string.id)r#   getr8   s   &r   r   ElementWrapper.id>  s     !!%%d++r   c                ^    \        \        V P                  P                  RR4      4      4      # )z:The classes of this element, as a :class:`set` of strings.class )setr   r#   r   r8   s   &r   classesElementWrapper.classesC  s(     #D$6$6$:$:7B$GHIIr   c                |   V P                   P                  R4      pVe   \        V4      # V P                  ;'       g    V P                  R8H  pV'       d+   V P                   P                  R4      pVe   \        V4      # V P
                  e   V P
                  P                  # V'       dt   RpV P                   P                  R4      pV FA  pVP                  RR4      p\        V4      R8X  g   K'  \        VP                  R	4      4      pKC  	  Ve   \        V4      # \        V P                  4      ;'       g    R# )
z*The language of this element, as a string.z*{http://www.w3.org/XML/1998/namespace}langNzhttp://www.w3.org/1999/xhtmllangz"{http://www.w3.org/1999/xhtml}metaz
http-equivr   zcontent-languagecontent)
r#   r   r   r   r   r   r   r]   _parse_content_languager&   )r)   xml_langis_htmlr   r   iteratormeta
http_equivs   &       r   r   ElementWrapper.langH  s$    %%))*VWx((!! A A"@@ 	 %%))&1D"4((;;";;####))../STH !XXlB7
z*.@@'>txx	?R'S$ !  +"#344&t'F'FGMM2Mr   c                  a V P                   f   R# RpRoV P                   P                  P                  V8H  ;'       d    V P                   P                  P                  R4      R J;'       dx    V P                  P                  S8g  ;'       gW    \        ;QJ d-    V3R lV P                  4        4       F  '       g   K   RM"	  RM! V3R lV P                  4        4       4      pT;'       g    V P                   P                  # )NFz&{http://www.w3.org/1999/xhtml}fieldsetz${http://www.w3.org/1999/xhtml}legenddisabledc              3   V   <"   T F  pVP                   P                  S8H  x  K   	  R # 5ir"   )r#   r   )rp   rR   legends   & r   rq   6ElementWrapper.in_disabled_fieldset.<locals>.<genexpr>n  s*      8B#@ ))--7#@s   &)T)r   r#   r   r   rt   rK   in_disabled_fieldset)r)   fieldsetdisabled_fieldsetr   s   &  @r   r   #ElementWrapper.in_disabled_fieldsete  s    ;;;7KK%%))X5 C CKK%%))*5TAC C""&&&0 B BCC 8B#'#>#>#@8BCCC 8B#'#>#>#@8B 5B 	 !DDDKK$D$DDr   )	r'   r(   r#   r%   r   r   r   r   r&   r"   )T)&__name__
__module____qualname____firstlineno____doc__classmethodr   r   r   r*   r0   r4   r9   r=   propertyr@   rC   rG   rK   rN   rS   r<   rc   staticmethodrl   rv   r   r   r   r$   r   r   r   r   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r	   r	   	   sa    
 N N$ M M R R'87
#6( 
 
 ' '"(*&
362 1 1D06 - -     , , J J N N8 E Er   r	   c                 v    V P                  R 4      pVR8X  g   V ^ ,          R8w  d   RV 3# V ^V W^,           R 3# )}{r   Nr\   )rfind)r   positions   & r   r   r   t  sC    yy~H2~Q33w1XQJK 000r   c                 l    V e0   RV 9  d'   \        V 4      p\        V4      ^8X  d
   V^ ,          # R # R # R # )N,)r   r~   )valuepartss   & r   r   r   |  s:    S- 'u:?8O  .r   N)	functoolsr   warningsr   webencodingsr   compilerr   r   r	   r   r   r3   r   r   <module>r      s*    %  $ =hE hEV1r   