HEX
Server: LiteSpeed
System: Linux br-asc-web1845.main-hosting.eu 5.14.0-611.42.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 24 05:30:20 EDT 2026 x86_64
User: u790421558 (790421558)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/markdown_it/__pycache__/tree.cpython-311.pyc
�

Z�Zg�,���dZddlmZddlmZmZddlZddlmZm	Z	m
Z
mZddlm
Z
Gd�d	e	��Ze
d
d���ZGd
�d��Zdd�ZdS)zyA tree representation of a linear markdown-it token stream.

This module is not part of upstream JavaScript markdown-it.
�)�annotations)�	Generator�SequenceN)�Any�
NamedTuple�TypeVar�overload�)�Tokenc�$�eZdZUded<ded<dS)�
_NesterTokensr�opening�closingN)�__name__�
__module__�__qualname__�__annotations__���C/opt/alt/python311/lib/python3.11/site-packages/markdown_it/tree.pyr
r
s"��������N�N�N��N�N�N�N�Nrr
�	_NodeType�SyntaxTreeNode)�boundc��eZdZdZ	dIdd�dJd�ZdKd
�ZedLd���ZedMd���ZdNd�ZdOd�Ze	dPd���Z
e
jdQd���Z
e	dRd���ZejdSd ���Ze	dTd!���Z
e	dTd"���Ze	dUd$���Ze	dKd%���Ze	dRd&���Ze	dRd'���ZdVd(�ZdVd)�Zd*d+d,d-�dWd1�Zdd2�dXd5�ZdYd7�Ze	dKd8���Ze	dZd:���Zd[d=�Ze	d\d?���Ze	d]d@���Ze	dKdA���Ze	dKdB���Ze	dKdC���Ze	d^dE���Z e	dTdF���Z!e	dTdG���Z"dHS)_raeA Markdown syntax tree node.

    A class that can be used to construct a tree representation of a linear
    `markdown-it-py` token stream.

    Each node in the tree represents either:
      - root of the Markdown document
      - a single unnested `Token`
      - a `Token` "_open" and "_close" token pair, and the tokens nested in
          between
    rT��create_root�tokens�Sequence[Token]r�bool�return�Nonec���d|_d|_d|_g|_|r|�|��dS|std���t
|��dkrJ|d}|jrtd���||_|jr|�|j��dSdSt|d|d��|_|�|dd���dS)z�Initialize a `SyntaxTreeNode` from a token stream.

        If `create_root` is True, create a root node for the document.
        NzGCan only create root from empty token sequence. Set `create_root=True`.r
rz;Unequal nesting level at the start and end of token stream.���)
�token�
nester_tokens�_parent�	_children�_set_children_from_tokens�
ValueError�len�nesting�childrenr
)�selfrr�inline_tokens    r�__init__zSyntaxTreeNode.__init__#s��$(��
�48���!���%'����	��*�*�6�2�2�2��F��	9��+���
���[�[�A�
�
�!�!�9�L��#�
� �Q����&�D�J��$�
F��.�.�|�/D�E�E�E�E�E�
F�
F�"/�v�a�y�&��*�!E�!E�D���*�*�6�!�B�$�<�8�8�8�8�8r�strc�@�t|��j�d|j�d�S)N�(�))�typer�r-s r�__repr__zSyntaxTreeNode.__repr__Ms$���t�*�*�%�4�4��	�4�4�4�4rr-r�item�intc��dS�Nr�r-r7s  r�__getitem__zSyntaxTreeNode.__getitem__P����r�slice�list[_NodeType]c��dSr:rr;s  rr<zSyntaxTreeNode.__getitem__Tr=r�int | slice�_NodeType | list[_NodeType]c��|j|Sr:)r,r;s  rr<zSyntaxTreeNode.__getitem__Xs���}�T�"�"r�list[Token]c�0��d�fd��g}�||��|S)	z Recover the linear token stream.�noder�
token_listrDr r!c�N��|jdkr|jD]}�||���dS|jr|�|j��dS|jsJ�|�|jj��|jD]}�||���|�|jj��dS)N�root)r4r,r$�appendr%rr)rFrG�child�recursive_collect_tokenss   �rrLz:SyntaxTreeNode.to_tokens.<locals>.recursive_collect_tokens^s�����y�F�"�"�!�]�@�@�E�,�,�U�J�?�?�?�?�@�@���
>��!�!�$�*�-�-�-�-�-��)�)�)�)��!�!�$�"4�"<�=�=�=�!�]�@�@�E�,�,�U�J�?�?�?�?��!�!�$�"4�"<�=�=�=�=�=r)rFrrGrDr r!r)r-rrLs  @r�	to_tokenszSyntaxTreeNode.to_tokens[s@���	>�	>�	>�	>�	>�	>�!�� � ��v�.�.�.��
rc��|jSr:�r'r5s rr,zSyntaxTreeNode.childrenos
���~�r�valuec��||_dSr:rO�r-rPs  rr,zSyntaxTreeNode.childrenss
������r�_NodeType | Nonec��|jSr:�r&r5s r�parentzSyntaxTreeNode.parentws
���|�rc��||_dSr:rUrRs  rrVzSyntaxTreeNode.parent{s
������rc� �|jp|jS)z Is the node a special root node?)r$r%r5s r�is_rootzSyntaxTreeNode.is_roots���J�4�$�"4�5�5rc�*�t|j��S)z�Is this node nested?.

        Returns `True` if the node represents a `Token` pair and tokens in the
        sequence between them, where `Token.nesting` of the first `Token` in
        the pair is 1 and nesting of the other `Token` is -1.
        )rr%r5s r�	is_nestedzSyntaxTreeNode.is_nested�s���D�&�'�'�'r�Sequence[_NodeType]c�.�|js|gS|jjS)z]Get siblings of the node.

        Gets the whole group of siblings, including self.
        )rVr,r5s r�siblingszSyntaxTreeNode.siblings�s ���{�	��6�M��{�#�#rc��|jrdS|jr|jjS|jsJ�t	|jjjd��S)aGet a string type of the represented syntax.

        - "root" for root nodes
        - `Token.type` if the node represents an unnested token
        - `Token.type` of the opening token, with "_open" suffix stripped, if
            the node represents a nester token pair
        rI�_open)rYr$r4r%�
_removesuffixrr5s rr4zSyntaxTreeNode.type�sO���<�	��6��:�	#��:�?�"��!�!�!�!��T�/�7�<�g�F�F�Frc��|j�|��}|dzt|j��kr|j|dzSdS)zlGet the next node in the sequence of siblings.

        Returns `None` if this is the last sibling.
        r
N)r^�indexr*�r-�
self_indexs  r�next_siblingzSyntaxTreeNode.next_sibling�sH���]�(�(��.�.�
���>�C��
�.�.�.�.��=��a��0�0��trc�l�|j�|��}|dz
dkr|j|dz
SdS)zqGet the previous node in the sequence of siblings.

        Returns `None` if this is the first sibling.
        r
rN)r^rcrds  r�previous_siblingzSyntaxTreeNode.previous_sibling�s>���]�(�(��.�.�
���>�Q����=��a��0�0��trc�|�t|��|d���}||_|j�|��dS)zMake a child node for `self`.FrN)r4rVr,rJ)r-rrKs   r�
_add_childzSyntaxTreeNode._add_child�sA��
��T�
�
�6�u�5�5�5������
���U�#�#�#�#�#rc��tt|����}|r�|���}|js|�|g���4|jdkrtd���|g}d}|r9|r7|���}|�|��||jz
}|r|�7|rtd|d�����|�|��|��dSdS)zgConvert the token stream to a tree structure and set the resulting
        nodes as children of `self`.r
zInvalid token nestingzunclosed tokens starting rN)�list�reversed�popr+rjr)rJ)r-r�reversed_tokensr$�
nested_tokensr+s      rr(z(SyntaxTreeNode._set_children_from_tokens�s#���x��/�/�0�0���	+�#�'�'�)�)�E��=�
������(�(�(���}��!�!� �!8�9�9�9�"�G�M��G�!�
)�g�
)�'�+�+�-�-���$�$�U�+�+�+��5�=�(��"�
)�g�
)��
Q� �!O�]�1�=M�!O�!O�P�P�P��O�O�M�*�*�*�%�	+�	+�	+�	+�	+r�Fr��indent�	show_text�_currentrsrtruc	��d|z}|d|j��z}|jsC|jr<|dd�d�|j���D����zz
}|dz
}|r=|js6|jdvr-|jr&|dt
j|j|d|zz��zz
}|jD]#}|d|�	||||z���zz
}�$|S)z'Create an XML style string of the tree.� �<c3�*K�|]\}}|�d|��V��dS)�=Nr)�.0�k�vs   r�	<genexpr>z(SyntaxTreeNode.pretty.<locals>.<genexpr>�s0����"O�"O�D�A�q�a�<�<�!�<�<�"O�"O�"O�"O�"O�"Or�>)�text�text_special�
rr)
r4rY�attrs�join�items�content�textwraprsr,�pretty)r-rsrtru�prefixr�rKs       rr�zSyntaxTreeNode.pretty�s���x�����D�I���'���|�	P��
�	P��C�#�(�(�"O�"O�D�J�<L�<L�<N�<N�"O�"O�"O�O�O�O�O�D������	P��L�	P��	�5�5�5���6�
�D�8�?�4�<��#��,�9N�O�O�O�O�D��]�	�	�E��D�5�<�<���X��=N�(����
�D�D��r��include_selfr�� Generator[_NodeType, None, None]c#�bK�|r|V�|jD]}|�d���Ed{V���dS)z�Recursively yield all descendant nodes in the tree starting at self.

        The order mimics the order of the underlying linear token
        stream (i.e. depth first).
        Tr�N)r,�walk)r-r�rKs   rr�zSyntaxTreeNode.walk�s]�����	��J�J�J��]�	5�	5�E��z�z�t�z�4�4�4�4�4�4�4�4�4�4�	5�	5rrc�b�|jr|jS|jr|jjStd���)z\Return the `Token` that is used as the data source for the
        properties defined below.z.Root node does not have the accessed attribute)r$r%r�AttributeErrorr5s r�_attribute_tokenzSyntaxTreeNode._attribute_tokens<���:�	��:����	.��%�-�-��M�N�N�Nrc�4�|���jS)zhtml tag name, e.g. "p" )r��tagr5s rr�zSyntaxTreeNode.tags���$�$�&�&�*�*r�dict[str, str | int | float]c�4�|���jS)zHtml attributes.)r�r�r5s rr�zSyntaxTreeNode.attrs����$�$�&�&�,�,r�name�None | str | int | floatc�P�|����|��S)z@Get the value of attribute `name`, or null if it does not exist.)r��attrGet)r-r�s  rr�zSyntaxTreeNode.attrGets"���$�$�&�&�.�.�t�4�4�4r�tuple[int, int] | Nonec�Z�|���j}|rt|��SdS)z8Source map info. Format: `tuple[ line_begin, line_end ]`N)r��map�tuple)r-�map_s  rr�zSyntaxTreeNode.map"s1���$�$�&�&�*���	���;�;���trc�4�|���jS)z(nesting level, the same as `state.level`)r��levelr5s rr�zSyntaxTreeNode.level+r�rc�4�|���jS)z]In a case of self-closing tag (code, html, fence, etc.), it
        has contents of this tag.)r�r�r5s rr�zSyntaxTreeNode.content0s���$�$�&�&�.�.rc�4�|���jS)z5'*' or '_' for emphasis, fence string for fence, etc.)r��markupr5s rr�zSyntaxTreeNode.markup6s���$�$�&�&�-�-rc�4�|���jS)zfence infostring)r��infor5s rr�zSyntaxTreeNode.info;����$�$�&�&�+�+r�dict[Any, Any]c�4�|���jS)z/A place for plugins to store an arbitrary data.)r��metar5s rr�zSyntaxTreeNode.meta@r�rc�4�|���jS)z5True for block-level tokens, false for inline tokens.)r��blockr5s rr�zSyntaxTreeNode.blockEr�rc�4�|���jS)zbIf it's true, ignore this element when rendering.
        Used for tight lists to hide paragraphs.)r��hiddenr5s rr�zSyntaxTreeNode.hiddenJs���$�$�&�&�-�-rN)r)rrrrr r!)r r0)r-rr7r8r r)r-rr7r>r r?)r-rr7rAr rB)r-rr rD)r-rr r?)r-rrPr?r r!)r-rr rS)r-rrPrSr r!)r r)r-rr r\)rrr r!)rsr8rtrrur8r r0)r-rr�rr r�)r r)r r�)r�r0r r�)r r�)r r8)r r�)#rrr�__doc__r/r6r	r<rM�propertyr,�setterrVrYr[r^r4rfrhrjr(r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�������
�
�)+�(9�CG�(9�(9�(9�(9�(9�(9�T5�5�5�5������X�������X��#�#�#�#�����(�����X���_�����_�������X���]�����]���6�6�6��X�6��(�(�(��X�(��$�$�$��X�$��
G�
G�
G��X�
G������X�������X��$�$�$�$�+�+�+�+�2 !�E�1�������.26�5�5�5�5�5�5�,O�O�O�O��+�+�+��X�+��-�-�-��X�-�5�5�5�5������X���-�-�-��X�-��/�/�/��X�/�
�.�.�.��X�.��,�,�,��X�,��,�,�,��X�,��-�-�-��X�-��.�.�.��X�.�.�.r�stringr0�suffixr c�d�|r-|�|��r|dt|���S|S)z�Remove a suffix from a string.

    Replace this with str.removesuffix() from stdlib when minimum Python
    version is 3.9.
    N)�endswithr*)r�r�s  rraraQs;���&�&�/�/�&�)�)�&��n��V����n�%�%��Mr)r�r0r�r0r r0)r��
__future__r�collections.abcrrr��typingrrrr	r$rr
rrrarrr�<module>r�s
����#�"�"�"�"�"�/�/�/�/�/�/�/�/�����5�5�5�5�5�5�5�5�5�5�5�5������������J����

�G�K�'7�8�8�8�	�x.�x.�x.�x.�x.�x.�x.�x.�v	�����r