Files
wg-backend-django/dell-env/lib/python3.11/site-packages/lxml/__pycache__/builder.cpython-311.pyc

121 lines
8.0 KiB
Plaintext
Raw Normal View History

2023-10-30 14:40:43 +07:00
<EFBFBD>
<06>]d<><00><00><><00>dZddlmZddlmZejZddlm Z  e
n #e $re Z
YnwxYw e n #e $re Z YnwxYwGd<05>de<0E><00>Ze<0F><00>ZdS)z9
The ``E`` Element factory for generating XML documents.
<EFBFBD>)<01>absolute_importN<74><01>partialc<00>*<00>eZdZdZ dd<03>Zd<04>Zd<05>ZdS)<07> ElementMakerac 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<00><><00><01>|<02>d|zdznd|_|rt|<03><00>nd|_|<04>t|<04><00>sJ<00>|<04>|n tj|_<00>rt<00><01><00>ni<00>d<03>}d<04>}t<00>vr
|<05>t<t<00>vr
|<05>t<tj <00>vr|<06>tj <<00>fd<05>}t<00>vr
|<07>t<<00>|_
dS)N<>{<7B>}c<00>~<00> |d}|jpd|z|_dS#t$r|jpd|z|_YdSwxYw)N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<03>tail<69>
IndexError<EFBFBD>text)<03>elem<65>item<65>
last_childs <20>g/home/infidel/Sync/TIP/WireGuard/ocp-wg-backend/dell-env/lib64/python3.11/site-packages/lxml/builder.py<70>add_textz'ElementMaker.__init__.<locals>.add_text<78>s_<00><00> A<01>!<21>"<22>X<EFBFBD>
<EFBFBD>$.<2E>?<3F>#8<>b<EFBFBD>D<EFBFBD>"@<40>
<EFBFBD><0F><0F><0F><><1E> 5<> 5<> 5<>!<21>Y<EFBFBD>_<EFBFBD>"<22><04>4<><04> <09> <09> <09> <09> 5<><35><EFBFBD>s <00><00><<03><c<00>P<00>|jrtd|jz<00><00><00>||_dS)Nz<Can't add a CDATA section. Element already has some text: %r)r<00>
ValueError)r<00>cdatas r<00> add_cdataz(ElementMaker.__init__.<locals>.add_cdata<74>s0<00><00><13>y<EFBFBD> m<01> <20>!_<>bf<62>bk<62>!k<>l<>l<>l<><1D>D<EFBFBD>I<EFBFBD>I<EFBFBD>I<EFBFBD>c<00><><00><01>|j}|<01><00><00>D]B\}}t|t<00><00>r|||<<00> <00>t |<04><00>d|<04><00>||<<00>CdS<00>N)<05>attrib<69>items<6D>
isinstance<EFBFBD>
basestring<EFBFBD>type)rrr<00>k<>v<>typemaps <20>r<00>add_dictz'ElementMaker.__init__.<locals>.add_dict<63>sn<00><><00><19>[<5B>F<EFBFBD><1C>
<EFBFBD>
<EFBFBD> <0C> <0C> :<3A> :<3A><04><01>1<EFBFBD><1D>a<EFBFBD><1A>,<2C>,<2C>:<3A> !<21>F<EFBFBD>1<EFBFBD>I<EFBFBD>I<EFBFBD> 0<><07><04>Q<EFBFBD><07><07> 0<><14>q<EFBFBD> 9<> 9<>F<EFBFBD>1<EFBFBD>I<EFBFBD>I<EFBFBD>  :<3A> :r) <0B>
_namespace<EFBFBD>dict<63>_nsmap<61>callable<6C>ET<45>Element<6E> _makeelement<6E>str<74>unicode<64>CDATA<54>_typemap)<08>selfr$<00> namespace<63>nsmap<61> makeelementrrr%s ` r<00>__init__zElementMaker.__init__<5F>s<00><><00>3<<3C>3H<33>#<23> <09>/<2F>C<EFBFBD>/<2F>/<2F>d<EFBFBD><04><0F>%*<2A>4<>d<EFBFBD>5<EFBFBD>k<EFBFBD>k<EFBFBD>k<EFBFBD><04><04> <0B><1A>"<22>h<EFBFBD>{<7B>&;<3B>&;<3B>"<22>"<22>"<22>+6<>+B<>K<EFBFBD>K<EFBFBD><02>
<EFBFBD><04><19>$+<2B>2<>$<24>w<EFBFBD>-<2D>-<2D>-<2D><02><07> A<01> A<01> A<01> <1E> <1E> <1E>
<0F>g<EFBFBD> <1D> <1D>#<23>G<EFBFBD>C<EFBFBD>L<EFBFBD> <12>'<27> !<21> !<21>'<27>G<EFBFBD>G<EFBFBD> <1C> <0A>8<EFBFBD>7<EFBFBD> "<22> "<22> )<29>G<EFBFBD>B<EFBFBD>H<EFBFBD> <1D> :<3A> :<3A> :<3A> :<3A> :<3A> <10>w<EFBFBD> <1E> <1E>$<24>G<EFBFBD>D<EFBFBD>M<EFBFBD><1F><04> <0A> <0A> rc<00><00>|j}t|t<00><00>st|t<00><00>r|j}n|j<00>|ddkr
|j|z}|<00>||j<00><03><00>}|r|t||<03><00>|D]<5D>}t|<06><00>r
|<06><00>}|<04>
t|<06><00><00><00>}|<07><>tj |<06><00>r|<05>|<06><00><00>it|<06><00>jD]}|<04>
|<08><00>}|<07>n)<29>t!dt|<06><00>j<00>d|<06>d<06><05><00><00>|||<06><00>} | r,|<04>
t| <09><00><00><00>|| <09><00><00><>|S)Nrr )r3zbad argument type: <20>(<28>))r0rr-<00>_QNamerr&r,r(r'r)<00>getr!r*<00> iselement<6E>append<6E>__mro__<5F> TypeError<6F>__name__)
r1<00>tag<61>childrenrr$rr<00>t<>basetyper#s
r<00>__call__zElementMaker.__call__<5F>s<><00><00><16>-<2D><07><1A>#<23>s<EFBFBD>#<23>#<23> (<28>
<EFBFBD>3<EFBFBD><06>(?<3F>(?<3F> (<28><15>(<28>C<EFBFBD>C<EFBFBD> <11>_<EFBFBD> (<28>S<EFBFBD><11>V<EFBFBD>s<EFBFBD>]<5D>]<5D><16>/<2F>C<EFBFBD>'<27>C<EFBFBD><13> <20> <20><13>D<EFBFBD>K<EFBFBD> <20>8<>8<><04> <11> (<28> <19>G<EFBFBD>D<EFBFBD>M<EFBFBD>$<24><06> '<27> '<27> '<27><1C> .<2E> .<2E>D<EFBFBD><17><04>~<7E>~<7E> <1E><1B>t<EFBFBD>v<EFBFBD>v<EFBFBD><04><17> <0B> <0B>D<EFBFBD><14>J<EFBFBD>J<EFBFBD>'<27>'<27>A<EFBFBD><10>y<EFBFBD><15><<3C><04>%<25>%<25><1D><18>K<EFBFBD>K<EFBFBD><04>%<25>%<25>%<25><1C> $<24>T<EFBFBD>
<EFBFBD>
<EFBFBD> 2<>A<01>A<01>H<EFBFBD><1F> <0B> <0B>H<EFBFBD>-<2D>-<2D>A<EFBFBD><18>}<7D><1D><05>%<25>$<24>)<29>%)<29>$<24>Z<EFBFBD>Z<EFBFBD>%8<>%8<>%8<>$<24>$<24>$<24>%@<01>A<01>A<01>A<01><11><01>$<24><04> <0A> <0A>A<EFBFBD><10> .<2E>$<24><07> <0B> <0B>D<EFBFBD><11>G<EFBFBD>G<EFBFBD>$<24>$<24>T<EFBFBD>1<EFBFBD>-<2D>-<2D>-<2D><><13> rc<00>"<00>t||<01><00>Srr)r1r@s r<00> __getattr__zElementMaker.__getattr__<5F>s<00><00><16>t<EFBFBD>S<EFBFBD>!<21>!<21>!r)NNNN)r?<00>
__module__<EFBFBD> __qualname__<5F>__doc__r5rDrF<00>rrrr<s]<00><00><00><00><00><00>V<08>V<08>p $<24>9=<3D>* <20>* <20>* <20>* <20>X!<14>!<14>!<14>F"<22>"<22>"<22>"<22>"rr)rI<00>
__future__r<00>
lxml.etree<65>etreer*<00>QNamer9<00> functoolsrr <00> NameErrorr-r.<00>objectr<00>ErJrr<00><module>rSs<><00><01>L<04><04>'<27>&<26>&<26>&<26>&<26>&<26><17><17><17><17><17><17> <0B><18><06><1D><1D><1D><1D><1D><1D><15><0E>J<EFBFBD>J<EFBFBD><4A><10><15><15><15><14>J<EFBFBD>J<EFBFBD>J<EFBFBD><15><><EFBFBD><EFBFBD><12> <0B>G<EFBFBD>G<EFBFBD><47><10><12><12><12><11>G<EFBFBD>G<EFBFBD>G<EFBFBD><12><><EFBFBD><EFBFBD>i"<22>i"<22>i"<22>i"<22>i"<22>6<EFBFBD>i"<22>i"<22>i"<22>Z<11>L<EFBFBD>N<EFBFBD>N<EFBFBD><01><01>s<00> <00>*<03>*<03>1<00>;<03>;