Prv8 Shell
Server : Apache
System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : matalashes ( 1004)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /proc/17567/root/usr/src/cloud-init/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/17567/root/usr/src/cloud-init/cloudinit/__pycache__/safeyaml.cpython-36.pyc
3

$%we��@s�ddlmZddlmZddlmZmZmZmZddl	Z	e	j
Z
edd�ZGd	d
�d
e	j�Z
dd�ZGd
d�de	j�Ze
jde
j�Gdd�de	jj�Zeeeeeffd�dd�Zdd�Zddd�ZdS)�)�
namedtuple)�chain)�Any�Dict�List�TupleN�SchemaPathMarks�path�
start_mark�end_markcseZdZ�fdd�Z�ZS)�_CustomSafeLoadercst�j|�S)N)�superZconstruct_scalar)�self�node)�	__class__��)/usr/src/cloud-init/cloudinit/safeyaml.py�construct_python_unicodesz*_CustomSafeLoader.construct_python_unicode)�__name__�
__module__�__qualname__r�
__classcell__rr)rrrsrcCs�g}xv|D]n}d|jkr$|j|�q
|jjdd�\}}||jkrn||jkrn|jt|jj||d�|j|j��q
|j|�q
W|S)N�.�)r	�append�rsplitr�replacer
r)Znew_key_path�marks�	new_marks�markZpath_prefixZ	_path_idxrrr�_fix_nested_map_indexs


r csNeZdZdZ�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�j|�i|_dS)N)r
�__init__�schemamarks_by_line)r�stream)rrrr"Osz#_CustomSafeLoaderWithMarks.__init__cCs�|jj|jkr*|j|jjdd�d�Sx�t|jj�dd�D]l\}}xb|ddd�D]P}|jj|jjkrV|jj|jjkrV|jj|jjkrV|jj|jjkrV|j�d�SqVWq>WdS)NrrT)�reverser����)r
�liner#�sorted�items�columnrr	)rrZ	_line_num�schema_marksrrrr�_get_nested_path_prefixSsz2_CustomSafeLoaderWithMarks._get_nested_path_prefixc	s|t�j|�}|j|�}x`|jD]V\}}|�|j��}|jj}t||j|j�}||jkrd|g|j|<q|j|j	|�qW|S)N)
r
�construct_mappingr-�valuer
r(rrr#r)	rr�mapping�nested_path_prefixZkey_nodeZ
value_node�
node_key_path�line_numr)rrrr.cs

z,_CustomSafeLoaderWithMarks.construct_mappingFc
	st�j|dd�}|j|�}x�t|j�D]�\}}|jj}|�|��}t||j|j�}	||j	krj|	g|j	|<q&||jjkr�|j	|j
|	�q&xtt||jj�D]b}
|
|j	kr�|j	|
}t||�}|
|kr�|dj
|kr�|jdt||dj|dj��||j	|
<q�Wq&W|S)NT)�deeprrr')r
�construct_sequencer-�	enumerater/r
r(rrr#r�ranger r	�insert)
rrr4�sequencer1�indexZ
sequence_itemr3r2rZ
inner_liner,r)rrrr5rs6



z-_CustomSafeLoaderWithMarks.construct_sequencecs8t�j�}t|t�r4tdd�t|jj��D��|d<|S)NcSsg|]}|j|jjdf�qS)r)r	r
r()�.0�vrrr�
<listcomp>�sz>_CustomSafeLoaderWithMarks.get_single_data.<locals>.<listcomp>�schemamarks)r
�get_single_data�
isinstance�dictrr#�values)r�data)rrrr?�s

z*_CustomSafeLoaderWithMarks.get_single_data)F)
rrr�__doc__r"r-r.r5r?rrr)rrr!1s&r!z tag:yaml.org,2002:python/unicodec@seZdZdZdd�ZdS)�NoAliasSafeDumperz>A class which avoids constructing anchors/aliases on yaml dumpcCsdS)NTr)rrCrrr�ignore_aliases�sz NoAliasSafeDumper.ignore_aliasesN)rrrrDrFrrrrrE�srE)�returncCs0tj|td�}t|t�si}n
|jd�}||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


    )�Loaderr>)�yaml�loadr!r@rA�pop)�blob�resultr>rrr�load_with_marks�s



rNcCstj|td�S)N)rH)rIrJr)rLrrrrJ�srJTFc	Cs$tj|dd||d|rtntjjd�S)z%Return data in nicely formatted yaml.�
�F)Z
line_break�indent�explicit_start�explicit_endZdefault_flow_styleZDumper)rI�dumprE�dumper�
SafeDumper)�objrRrSZnoaliasrrr�dumps�srX)r	r
r)TTF)�collectionsr�	itertoolsr�typingrrrrrI�	YAMLErrorrZ
SafeLoaderrr r!Zadd_constructorrrUrVrE�str�intrNrJrXrrrr�<module>s s

haha - 2025