+
    Ĝi%!                         R t ^ RIHt ]P                  t^ RIHt  ^ RIH	t
  ]  ]  ! R R4      t]! 4       tR#   ] d    R t
 L%i ; i  ] d    ]t L1i ; i  ] d    ]t L=i ; i)z9
The ``E`` Element factory for generating XML documents.
Npartial)GenericAliasc                 :    V P                    R VP                    R2# )[])__name__clsitems   &&U/Users/mibo/.openclaw/workspace/.venv-ak/lib/python3.14/site-packages/lxml/builder.py_GenericAliasr   4   s    ,,qq11    c                   @   a  ] tR t^Bt o RtRR ltR tR tR tRt	V t
R# )	ElementMakeraG  Element generator factory.

Unlike the ordinary Element factory, the E factory allows you to pass in
more than just a tag and some optional attributes; you can also pass in
text and other elements.  The text is added as either text or tail
attributes, and elements are inserted at the right spot.  Some small
examples::

    >>> from lxml import etree as ET
    >>> from lxml.builder import E

    >>> ET.tostring(E("tag"))
    '<tag/>'
    >>> ET.tostring(E("tag", "text"))
    '<tag>text</tag>'
    >>> ET.tostring(E("tag", "text", key="value"))
    '<tag key="value">text</tag>'
    >>> ET.tostring(E("tag", E("subtag", "text"), "tail"))
    '<tag><subtag>text</subtag>tail</tag>'

For simple tags, the factory also allows you to write ``E.tag(...)`` instead
of ``E('tag', ...)``::

    >>> ET.tostring(E.tag())
    '<tag/>'
    >>> ET.tostring(E.tag("text"))
    '<tag>text</tag>'
    >>> ET.tostring(E.tag(E.subtag("text"), "tail"))
    '<tag><subtag>text</subtag>tail</tag>'

Here's a somewhat larger example; this shows how to generate HTML
documents, using a mix of prepared factory functions for inline elements,
nested ``E.tag`` calls, and embedded XHTML fragments::

    # some common inline elements
    A = E.a
    I = E.i
    B = E.b

    def CLASS(v):
        # helper function, 'class' is a reserved word
        return {'class': v}

    page = (
        E.html(
            E.head(
                E.title("This is a sample document")
            ),
            E.body(
                E.h1("Hello!", CLASS("title")),
                E.p("This is a paragraph with ", B("bold"), " text in it!"),
                E.p("This is another paragraph, with a ",
                    A("link", href="http://www.python.org"), "."),
                E.p("Here are some reserved characters: <spam&egg>."),
                ET.XML("<p>And finally, here is an embedded XHTML fragment.</p>"),
            )
        )
    )

    print ET.tostring(page)

Here's a prettyprinted version of the output from the above script::

    <html>
      <head>
        <title>This is a sample document</title>
      </head>
      <body>
        <h1 class="title">Hello!</h1>
        <p>This is a paragraph with <b>bold</b> text in it!</p>
        <p>This is another paragraph, with <a href="http://www.python.org">link</a>.</p>
        <p>Here are some reserved characters: &lt;spam&amp;egg&gt;.</p>
        <p>And finally, here is an embedded XHTML fragment.</p>
      </body>
    </html>

For namespace support, you can pass a namespace map (``nsmap``)
and/or a specific target ``namespace`` to the ElementMaker class::

    >>> E = ElementMaker(namespace="http://my.ns/")
    >>> print(ET.tostring( E.test ))
    <test xmlns="http://my.ns/"/>

    >>> E = ElementMaker(namespace="http://my.ns/", nsmap={'p':'http://my.ns/'})
    >>> print(ET.tostring( E.test ))
    <p:test xmlns:p="http://my.ns/"/>
Nc                  a Ve   RV,           R,           MR V n         V'       d   \        V4      MR V n        Ve   \        V4      '       g   Q hVe   TM\        P
                  V n        S'       d   \        S4      M/ oR pR p\        S9  d
   VS\        &   \        S9  d
   VS\        &   \        P                  S9  d   VS\        P                  &   V3R lp\        S9  d
   VS\        &   SV n
        R # )N{}c                      V R,          pVP                   ;'       g    RV,           Vn         R#   \         d'    T P                  ;'       g    RT,           T n         R# i ; i)    N)tail
IndexErrortext)elemr   
last_childs   && r   add_text'ElementMaker.__init__.<locals>.add_text   sR    A!"X
 $.??#8#8bD"@
  5!YY__"4	5s   	/ A A A c                 n    V P                   '       d   \        R V P                   ,          4      hWn         R# )z<Can't add a CDATA section. Element already has some text: %rN)r   
ValueError)r   cdatas   &&r   	add_cdata(ElementMaker.__init__.<locals>.add_cdata   s(    yyy !_bfbkbk!kllIr   c                    < V P                   pVP                  4        F<  w  r4\        V\        4      '       d   WBV&   K!  S\	        V4      ,          ! R V4      W#&   K>  	  R # N)attribitems
isinstance
basestringtype)r   r   r&   kvtypemaps   &&   r   add_dict'ElementMaker.__init__.<locals>.add_dict   sI    [[F

a,, !1I 'Q 0q 9FI	 %r   )
_namespacedict_nsmapcallableETElement_makeelementstrunicodeCDATA_typemap)selfr-   	namespacensmapmakeelementr   r"   r.   s   &f&&&   r   __init__ElementMaker.__init__   s    3<3H#	/C/d%*d5k"h{&;&;;;+6+BK

 $+$w-	A	
 g#GCL'!'GG887" )GBHH	: w$GDMr   c                P   V P                   p\        V\        4      '       g$   \        V\        4      '       d   VP                  pM/V P
                  e"   V^ ,          R8w  d   V P
                  V,           pV P                  WP                  R7      pV'       d   V\        ,          ! WS4       V F  p\        V4      '       d   V! 4       pVP                  \        V4      4      pVf   \        P                  ! V4      '       d   VP                  V4       Kh  \        V4      P                   F  pVP                  V4      pVf   K   M)	  \!        R\        V4      P"                  : RV: R24      hV! WV4      p	V	'       g   K  VP                  \        V	4      4      ! WY4       K  	  V# )Nr   )r=   zbad argument type: ())r:   r(   r7   _QNamer   r0   r6   r2   r1   r3   getr*   r4   	iselementappend__mro__	TypeErrorr   )
r;   tagchildrenr&   r-   r   r   tbasetyper,   s
   &&*,      r   __call__ElementMaker.__call__   s@   -- #s##
3(?(?((C__(SVs]//C'C  KK 8DM$'D~~vDJ'Ay<<%%KK% $T
 2 2HH-A}	 !3 $%)$Z%8%8$%@ A A$AqDG$T-% ( r   c                    \        W4      # r%   r   )r;   rJ   s   &&r   __getattr__ElementMaker.__getattr__   s    t!!r   c                    \        W4      # r%   )r   r	   s   &&r   __class_getitem__ElementMaker.__class_getitem__   s    S''r   )r6   r0   r2   r:   )NNNN)r   
__module____qualname____firstlineno____doc__r?   rN   rQ   rT   __static_attributes____classdictcell__)__classdict__s   @r   r   r   B   s'     Vp* X!F"( (r   r   )rY   
lxml.etreeetreer4   QNamerD   	functoolsr   typesr   r   ImportErrorr)   	NameErrorr7   r8   r   E r   r   <module>rf      s   L
 	 23
m( m(b NC  222  J
  Gs1   ; A A 
AA	AA	A&%A&