%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/web/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/web/__pycache__/_stan.cpython-312.pyc

�

Ϫ�f�*���dZddlmZmZddlmZmZmZmZm	Z	ddl
mZddlZerddl
mZejddd�	�Gd
�d��Zejdddd��Gd
�d��ZdZejdddd��Gd�d��Zejdddd��Gd�d��Zejdddd��Gd�d��Zy)aC
An s-expression-like syntax for expressing xml in pure python.

Stan tags allow you to build XML documents using Python.

Stan is a DOM, or Document Object Model, implemented using basic Python types
and functions called "flatteners". A flattener is a function that knows how to
turn an object of a specific type into something that is closer to an HTML
string. Stan differs from the W3C DOM by not being as cumbersome and heavy
weight. Since the object model is built using simple python types such as lists,
strings, and dictionaries, the API is simpler and constructing a DOM less
cumbersome.

@var voidElements: the names of HTML 'U{void
    elements<http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#void-elements>}';
    those which can't have contents and can therefore be self-closing in the
    output.
�)�iscoroutine�isgenerator)�
TYPE_CHECKING�Dict�List�Optional�Union)�warnN)�FlattenableFT)�hash�eq�auto_attribsc��eZdZUdZeed<	ejde��Z	e
ded<	dZeded	<	dZ
eeed
<	dZeeed<	dZeeed<y)
�slotz4
    Marker for markup insertion in a template.
    �nameF)�init�factory�Tag�childrenNr�default�filename�
lineNumber�columnNumber)�__name__�
__module__�__qualname__�__doc__�str�__annotations__�attr�ib�listrrrrrr�intr���3/usr/lib/python3/dist-packages/twisted/web/_stan.pyrr#s�����I��$�D�G�G���=�H�d�5�k�=��(,�G�X�m�
$�+��#�H�h�s�m�"��!%�J���
�$��#'�L�(�3�-�&�r%r)rr
�reprrc��eZdZUdZeeefed<	eje
��Zeeeefdfed<	eje
��Zeded<	dZeeed<	dZeeed	<	dZeeed
<	dZeeed<	ejdd�
�Zeeedfed<	dd�Zdd�Zdddeddfd�Zddeddfd�Zdd�Zdefd�Zy)ra^
    A L{Tag} represents an XML tags with a tag name, attributes, and children.
    A L{Tag} can be constructed using the special L{twisted.web.template.tags}
    object, or it may be constructed directly with a tag name. L{Tag}s have a
    special method, C{__call__}, which makes representing trees of XML natural
    using pure python syntax.
    �tagName)rr�
attributesrN�renderrrrF)rr�slotData�returnc�b�|j�i|_|jj|�|S)a@
        Remember the slots provided at this position in the DOM.

        During the rendering of children of this node, slots with names in
        C{slots} will be rendered as their corresponding values.

        @return: C{self}. This enables the idiom C{return tag.fillSlots(...)} in
            renderers.
        )r,�update)�self�slotss  r&�	fillSlotsz
Tag.fillSlots�s,���=�=� ��D�M��
�
���U�#��r%c��|jj|�|j�D]L\}}|ddk(r|dd}|dk(r&t|t�std|����||_�>||j|<�N|S)a�
        Add children and change attributes on this tag.

        This is implemented using __call__ because it then allows the natural
        syntax::

          table(tr1, tr2, width="100%", height="50%", border="1")

        Children may be other tag instances, strings, functions, or any other
        object which has a registered flatten.

        Attributes may be 'transparent' tag instances (so that
        C{a(href=transparent(data="foo", render=myhrefrenderer))} works),
        strings, functions, or any other object which has a registered
        flattener.

        If the attribute is a python keyword, such as 'class', you can add an
        underscore to the name, like 'class_'.

        There is one special keyword argument, 'render', which will be used as
        the name of the renderer and saved as the 'render' attribute of this
        instance, rather than the DOM 'render' attribute in the attributes
        dictionary.
        ����_Nr+z.Value for "render" attribute must be str, got )r�extend�items�
isinstancer�	TypeErrorr+r*)r0r�kw�k�vs     r&�__call__zTag.__call__�s���2	
�
�
���X�&��H�H�J�	'�D�A�q���u��|��c�r�F���H�}�!�!�S�)�#�H���N��� ���%&�����"�	'��r%�obj�deepc�*�t|d�r|j|�St|ttf�r |D�cgc]}|j||���c}St
|�rtdt�|St|�rtdt�|S|Scc}w)a�
        Clone a C{Flattenable} object; used by L{Tag.clone}.

        Note that both lists and tuples are cloned into lists.

        @param obj: an object with a clone method, a list or tuple, or something
            which should be immutable.

        @param deep: whether to continue cloning child objects; i.e. the
            contents of lists, the sub-tags within a tag.

        @return: a clone of C{obj}.
        �clonez�Cloning a Tag which contains a generator is unsafe, since the generator can be consumed only once; this is deprecated since Twisted 21.7.0 and will raise an exception in the futurez�Cloning a Tag which contains a coroutine is unsafe, since the coroutine can run only once; this is deprecated since Twisted 21.7.0 and will raise an exception in the future)
�hasattrrAr8r"�tuple�_clonerr
�DeprecationWarningr)r0r>r?�xs    r&rDz
Tag._clone�s����3�� ��9�9�T�?�"�
��d�E�]�
+�25�6�Q�D�K�K��4�(�6�6�
��
��-�#�
��J�
��
��-�#�
��J��J��)7s�Bc	�8�|r*|jD�cgc]}|j|d���}}n|jdd}|jj�}|j	�D]}|j||d�||<�d}|j
r9|j
j�}|D]}|j||d�||<�t
|j|||j|j|j|j��}||_|Scc}w)z�
        Return a clone of this tag. If deep is True, clone all of this tag's
        children. Otherwise, just shallow copy the children list without copying
        the children themselves.
        TN)r*rr+rrr)rrDr*�copy�keysr,rr)r+rrr)r0r?rF�newchildren�newattrs�key�newslotdata�newtags        r&rAz	Tag.clone�s���9=���G�A�4�;�;�q�$�/�G�K�G��-�-��*�K��?�?�'�'�)���=�=�?�	=�C� �K�K���
�t�<�H�S�M�	=����=�=��-�-�,�,�.�K�"�
G��#'�;�;�{�3�/?��#F��C� �
G���L�L�� ��;�;��]�]�����*�*�
��&����
��1Hs�Dc��g|_|S)z<
        Clear any existing children from this tag.
        )r�r0s r&�clearz	Tag.clears����
��r%c��d}|jr|d|jzz
}|jr|d|jzz
}d|j�|�d�S)N�z, attributes=%rz
, children=%rzTag(�))r*rr))r0�rstrs  r&�__repr__zTag.__repr__sT�����?�?��%����7�7�D��=�=��O�d�m�m�3�3�D��d�l�l�%�d�V�1�-�-r%)r1rr-r)rrr:rr-r)T)r-r)rrrrr	�bytesrrr r!�dictr*rr"rrr+rrrr#rr,r2r=�boolrDrArQrVr$r%r&rrUs2����5�#�:�
���:A�����9N�J��U�5�#�:�&�
�5�6�N�(�$+�D�G�G�D�$9�H�d�=�!�9�&� �F�H�S�M� ��#�H�h�s�m�"��!%�J���
�$��#'�L�(�3�-�&��4;�4�7�7��t�3T�H�h�t�C��.�/�0�T��
�'�R%�-�%�t�%�
�%�N�$��%��B�.�#�.r%r)�img�br�hr�base�meta�link�param�area�input�col�basefont�isindex�frame�command�embed�keygen�source�track�wbsc�*�eZdZUdZeed<	defd�Zy)�CDATAz�
    A C{<![CDATA[]]>} block from a template.  Given a separate representation in
    the DOM so that they may be round-tripped through rendering without losing
    information.
    �datar-c�"�d|j�d�S)NzCDATA(rT�rorPs r&rVzCDATA.__repr__Hs����	�	�}�A�&�&r%N�rrrrrrrVr$r%r&rnrn=s����I�7�'�#�'r%rnc�*�eZdZUdZeed<	defd�Zy)�Commentz�
    A C{<!-- -->} comment from a template.  Given a separate representation in
    the DOM so that they may be round-tripped through rendering without losing
    information.
    ror-c�"�d|j�d�S)NzComment(rTrqrPs r&rVzComment.__repr__Ws���$�)�)��a�(�(r%Nrrr$r%r&rtrtLs����I�2�)�#�)r%rtc�*�eZdZUdZeed<	defd�Zy)�CharRefz�
    A numeric character reference.  Given a separate representation in the DOM
    so that non-ASCII characters may be output as pure ASCII.

    @since: 12.0
    �ordinalr-c�"�d|jfzS)NzCharRef(%d))rxrPs r&rVzCharRef.__repr__gs�������.�.r%N)rrrrr#rrrVr$r%r&rwrw[s����L�Q�/�#�/r%rw)r�inspectrr�typingrrrrr	�warningsr
r �twisted.web.templater�srr�voidElementsrnrtrwr$r%r&�<module>r�s���
�(-�=�=����0�����U�u�4�0�.�.�1�.�b����U�u�5�t�<�M.�M.�=�M.�`��.����U�u�5�t�<�'�'�=�'�����U�u�5�t�<�)�)�=�)�����U�u�5�t�<�/�/�=�/r%

Zerion Mini Shell 1.0