Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/__pycache__/safeyaml.cpython-310.pyc
o

}��f�'�@s�ddlmZddlmZddlmZmZmZmZddl	Z	Gdd�d�Z
dd�Zd	ee
fd
d�Zde
d
ee
dee
fdd�Z
Gdd�de	j�ZGdd�de	jj�Zdeeeeefffdd�Zddd�ZdS)�)�defaultdict)�chain)�Any�Dict�List�TupleNc@s6eZdZdedejdejfdd�Zdd�Zdd	�Zd
S)�SchemaPathMarks�path�
start_mark�end_markcCs||_||_||_dS�N)r	r
r)�selfr	r
r�r�4/usr/lib/python3/dist-packages/cloudinit/safeyaml.py�__init__s
zSchemaPathMarks.__init__cCsp|jj|jjks|jj|jjkrdS|jj|jjkr$|jj|jjkr$dS|jj|jjkr6|jj|jjkr6dSdS)z;Return whether other start/end marks are within self marks.FT)r
�liner�column�r
�otherrrr�__contains__szSchemaPathMarks.__contains__cCs@|jj|jjko|jj|jjko|jj|jjko|jj|jjkSr)r
rrrrrrr�__eq__*s���zSchemaPathMarks.__eq__N)	�__name__�
__module__�__qualname__�str�yaml�MarkrrrrrrrrsrcCs0|ddd�D]}||vr||ks|SqdS)N���r)�
child_mark�marks�markrrr�_find_closest_parent3s
�r!�
line_markscCs\|D])}t||�}|r+|j�dd�\}}|j|jks!|j�|j�s+|j�||jd�|_qdS)zP
    Update any SchemaPathMarks.path for items not under the proper parent.
    �.�N)r!r	�rsplit�
startswith�replace)r"r �parent�path_prefix�	_path_idxrrr�_reparent_schema_mark_children:s
���r+�new_markr�returncCsdg}d}|D]}||vr|�|�q||vrd}|�|�|�|�q|r+t|�|S|�|�|S)a=Insert new_mark into marks, ordering ancestors first.

    Reparent existing SchemaPathMarks.path when new_mark is a parent of
    an existing mark item.

    Because schema processing is depth first, leaf/child mappings and
    sequences may be processed for SchemaPathMarks before their parents.
    This leads to SchemaPathMarks.path of 'grandchildren' being incorrectly
    parented by the root dictionary instead of an intermediary parents below
    root.

    Walk through the list of existing marks and reparent marks that are
    contained within the new_mark.
    FT)�appendr+)r,r�	new_marks�reparent_pathsr rrr�_add_mark_and_reparent_marksIs


�r1csNeZdZdZ�fdd�Zdd�Z�fdd�Zd
�fd	d
�	Z�fdd�Z�Z	S)�_CustomSafeLoaderWithMarksa�A loader which provides line and column start and end marks for YAML.

    If the YAML loaded represents a dictionary, get_single_data will inject
    a top-level "schemamarks" key in that dictionary which can be used at
    call-sites to process YAML paths schemamark metadata when annotating
    YAML files for errors.

    The schemamarks key is dictionary where each key is a dot-delimited path
    into the YAML object. Each dot represents an element that is nested under
    a parent and list items are represented with the format
    `<parent>.<list-index>`.

    The values in schemamarks will be the line number in the original content
    where YAML element begins to aid in annotation when encountering schema
    errors.

    The example YAML shows expected schemamarks for both dicts and lists:

      one: val1
      two:
        subtwo: val2
      three: [val3, val4]

    schemamarks == {
        "one": 1, "two": 2, "two.subtwo": 3, "three": 4, "three.0": 4,
        "three.1": 4
    }
    cst��|�tt�|_dSr)�superrr�list�schemamarks_by_line)r
�stream��	__class__rrr�s�z#_CustomSafeLoaderWithMarks.__init__cCs�|jj|jvr1|j|jjd}|j|jjdd�D]}||vr'||vr'|}q||vr1|jdSt|j��dd�D]\}}|ddd�D]}||vrU|j�d�SqEq:dS)Nrr$r#T)�reverser�)r
rr5r	�sorted�items)r
�node�most_specific_mark�	path_mark�	_line_num�schema_marksr rrr�_get_nested_path_prefix�s.����

���z2_CustomSafeLoaderWithMarks._get_nested_path_prefixcsnt��|�}|�|�}|jD]&\}}|�|j��}|jj}t||j|j�}|j|}	t	||	�}
|
|j|<q|Sr)
r3�construct_mappingrB�valuer
rrrr5r1)r
r=�mapping�nested_path_prefix�key_node�
value_node�
node_key_path�line_numr,rAr/r7rrrC�s

�

z,_CustomSafeLoaderWithMarks.construct_mappingFc

st�j|dd�}|�|�}t|j�D]q\}}|jj}|�|��}t||j|j�}	||j	vr4|	g|j	|<q||jjkrJ|j	|}
t
|	|
�}||j	|<qt||jj�D]1}||j	vr�|j	|}
t
|	|
�}||kr}|
dj|kr}|�
dt||
dj|
dj��||j	|<qQq|S)NT)�deeprr)r3�construct_sequencerB�	enumeraterDr
rrrr5r1�ranger	�insert)
r
r=rK�sequencerF�index�
sequence_itemrJrIr,rAr/�
inner_liner7rrrL�sL

�

��

���
��z-_CustomSafeLoaderWithMarks.construct_sequencecs8t���}t|t�rtdd�t|j���D��|d<|S)NcSsg|]}|j|jjdf�qS)r$)r	r
r)�.0�vrrr�
<listcomp>�s��z>_CustomSafeLoaderWithMarks.get_single_data.<locals>.<listcomp>�schemamarks)r3�get_single_data�
isinstance�dictrr5�values�r
�datar7rrrX�s

��z*_CustomSafeLoaderWithMarks.get_single_data)F)
rrr�__doc__rrBrCrLrX�
__classcell__rrr7rr2ls*r2c@seZdZdZdd�ZdS)�NoAliasSafeDumperz>A class which avoids constructing anchors/aliases on yaml dumpcCsdS)NTrr\rrr�ignore_aliases�sz NoAliasSafeDumper.ignore_aliasesN)rrrr^rarrrrr`�sr`cCs6tj|td�}t|t�si}||fS|�d�}||fS)a�Perform YAML SafeLoad and track start and end marks during parse.

    JSON schema errors come with an encoded object path such as:
        <key1>.<key2>.<list_item_index>

    YAML loader needs to preserve a mapping of schema path to line and column
    marks to annotate original content with JSON schema error marks for the
    command:
        cloud-init devel schema --annotate


    )�LoaderrW)r�loadr2rYrZ�pop)�blob�resultrWrrr�load_with_marks�s

�rgTFc	Cs(tj|dd||d|rtd�Stjjd�S)z%Return data in nicely formatted yaml.�
�F)�
line_break�indent�explicit_start�explicit_end�default_flow_style�Dumper)r�dumpr`�dumper�
SafeDumper)�objrlrm�noaliasrrr�dumpss��ru)TTF)�collectionsr�	itertoolsr�typingrrrrrrr!r+r1�
SafeLoaderr2rqrrr`r�intrgrurrrr�<module>s$"��
�#}

Spamworldpro Mini