HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/markdown_it/__pycache__/token.cpython-310.pyc
o

;j'�@stddlmZddlmZmZddlZddlmZm	Z	ddl
Z
ddlmZd
d	d
�Z
ejdie��Gdd�d��ZdS)�)�annotations)�Callable�MutableMappingN)�Any�Literal)�DATACLASS_KWARGS�valuer�returncCs|siSt|t�r
t|�S|S)z�Convert Token.attrs set as ``None`` or ``[[key, value], ...]`` to a dict.

    This improves compatibility with upstream markdown-it.
    )�
isinstance�list�dict)r�r
�E/opt/saltstack/salt/lib/python3.10/site-packages/markdown_it/token.py�
convert_attrss

rc@s>eZdZUded<	ded<	ded<	ejed�Zded<	d	Zd
ed<	dZ	d
ed<	d	Z
ded<	dZded<	dZded<	dZ
ded<	ejed�Zded<	dZded<	dZded<	dEdd�ZdFd d!�ZdGd#d$�ZdHd'd(�ZdId+d,�ZdJd.d/�ZdKd0d1�ZdLd4d5�Zd6d6d	d	ed7�dMd@dA�ZedNdCdD��Zd	S)O�Token�str�type�tagzLiteral[-1, 0, 1]Znesting)�default_factoryzdict[str, str | int | float]�attrsNzlist[int] | None�mapr�int�levelzlist[Token] | None�children��content�markup�infozdict[Any, Any]�metaF�bool�block�hiddenr	�NonecCst|j�|_dS�N)rr��selfr
r
r�
__post_init__OszToken.__post_init__�namecCs.t�dt�||jvr
dSt|j����|�S)NzEToken.attrIndex should not be used, since Token.attrs is a dictionary���)�warnings�warn�UserWarningrr�keys�index�r%r'r
r
r�	attrIndexRs�
zToken.attrIndex�#list[tuple[str, str | int | float]]cCst|j���S)zGet (key, value) list of attrs.)rr�itemsr$r
r
r�	attrItems[�zToken.attrItems�attrData�tuple[str, str | int | float]cCs|\}}|�||�dS)zAAdd `[ name, value ]` attribute to list. Init attrs if necessary.N)�attrSet)r%r4r'rr
r
r�attrPush_szToken.attrPushr�str | int | floatcCs||j|<dS)z>Set `name` attribute to `value`. Override old value if exists.N)r)r%r'rr
r
rr6dr3z
Token.attrSet�None | str | int | floatcCs|j�|d�S)z@Get the value of attribute `name`, or null if it does not exist.N)r�getr.r
r
r�attrGethr3z
Token.attrGetcCsX||jvr%|j|}t|t�std|j|����|�d|��|j|<dS||j|<dS)z�Join value to existing attribute via space.
        Or create new attribute if not exists.
        Useful to operate with token classes.
        z#existing attr 'name' is not a str: � N)rr
r�	TypeError)r%r'r�currentr
r
r�attrJoinls


�zToken.attrJoin�changesrcKstj|fi|��S)z&Return a shallow copy of the instance.)�dc�replace)r%r@r
r
r�copy{sz
Token.copyT)r�as_upstream�meta_serializer�filter�dict_factoryrDrE�&Callable[[dict[Any, Any]], Any] | NonerF�!Callable[[str, Any], bool] | NonerG�'Callable[..., MutableMapping[str, Any]]�MutableMapping[str, Any]cs���fdd�t���D��}�r��fdd�|��D��}�r6d|vr6|ds)dn
dd�|d��D�|d<�rDd|vrD�|d�|d<�r]|�d	d�r]�����fd
d�|d	D�|d	<|S)a�Return the token as a dictionary.

        :param children: Also convert children to dicts
        :param as_upstream: Ensure the output dictionary is equal to that created by markdown-it
            For example, attrs are converted to null or lists
        :param meta_serializer: hook for serializing ``Token.meta``
        :param filter: A callable whose return code determines whether an
            attribute or element is included (``True``) or dropped (``False``).
            Is called with the (key, value) pair.
        :param dict_factory: A callable to produce dictionaries from.
            For example, to produce ordered dictionaries instead of normal Python
            dictionaries, pass in ``collections.OrderedDict``.

        c3s"�|]}|jt�|j�fVqdSr#)r'�getattr)�.0�fr$r
r�	<genexpr>�s� z Token.as_dict.<locals>.<genexpr>c3s&�|]\}}�||�r||fVqdSr#r
�rM�k�v)rFr
rrO�s�$rNcSsg|]\}}||g�qSr
r
rPr
r
r�
<listcomp>�sz!Token.as_dict.<locals>.<listcomp>rrc	s g|]}|j�����d��qS))rrFrGrDrE)�as_dict)rM�child)rDrrGrFrEr
rrS�s���)rA�fieldsr1r:)r%rrDrErFrG�mappingr
)rDrrGrFrEr%rrTs��
�
z
Token.as_dict�dctcs.�di|��}|jr�fdd�|jD�|_|S)zConvert a dict to a Token.csg|]}��|��qSr
)�	from_dict)rM�c��clsr
rrS�sz#Token.from_dict.<locals>.<listcomp>Nr
)r)r\rX�tokenr
r[rrY�szToken.from_dict)r	r")r'rr	r)r	r0)r4r5r	r")r'rrr8r	r")r'rr	r9)r'rrrr	r")r@rr	r)rrrDrrErHrFrIrGrJr	rK)rXrKr	r)�__name__�
__module__�__qualname__�__annotations__rA�fieldrrrrrrrrrr r!r&r/r2r7r6r;r?rCrT�classmethodrYr
r
r
rrsV



	




�/r)rrr	rr
)�
__future__r�collections.abcrrZdataclassesrA�typingrrr)Zmarkdown_it._compatrrZ	dataclassrr
r
r
r�<module>s