HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991109/root/usr/lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Current File : //proc/1991109/root/usr/lib/python3/dist-packages/cloudinit/__pycache__/safeyaml.cpython-311.pyc
�

܍~c\��P�ddlmZddlmZddlmZmZmZmZddl	Z	e	j
Z
edd��ZGd�de	j��Z
Gd	�d
e	j��Ze
�de
j��Gd�d
e	jj��Zdeeeeefffd�Zd�Zdd�ZdS)�)�
namedtuple)�chain)�Any�Dict�List�TupleN�SchemaPathMarks)�path�
start_mark�end_markc���eZdZ�fd�Z�xZS)�_CustomSafeLoaderc�F��t���|��S�N)�super�construct_scalar)�self�node�	__class__s  ��4/usr/lib/python3/dist-packages/cloudinit/safeyaml.py�construct_python_unicodez*_CustomSafeLoader.construct_python_unicodes����w�w�'�'��-�-�-�)�__name__�
__module__�__qualname__r�
__classcell__�rs@rrrs8�������.�.�.�.�.�.�.�.�.rrc�H��eZdZdZ�fd�Zd�Z�fd�Zd�fd�	Z�fd�Z�xZ	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
    }
    c�X��t���|��i|_dSr)r�__init__�schemamarks_by_line)r�streamrs  �rr!z#_CustomSafeLoaderWithMarks.__init__:s)���
������ � � �EG�� � � rc���|jj|jvr&|j|jjdd�d�St|j���d���D]�\}}|ddd�D]x}|jj|jjkr\|jj|jjkrB|jj|jjkr(|jj|jjkr|j�d�ccS�y��dS)Nr�.T)�reverse����)r�liner"�sorted�items�columnrr
)rr�	_line_num�schema_marks�marks     r�_get_nested_path_prefixz2_CustomSafeLoaderWithMarks._get_nested_path_prefix>s	���?��4�#;�;�;��.�t��/C�D�Q�G��J�M�M�M�M�'-��$�*�*�,�,�d�(
�(
�(
�
	+�
	+�#�I�|�%�T�T�r�T�*�
+�
+���O�(�D�O�,@�@�@���.�$�/�2H�H�H��
�*�d�m�.@�@�@��
�,��
�0D�D�D�"�i�?�?�?�*�*�*�*�*��
+��rrc�\��t���|��}|�|��}|jD]l\}}|�|j��}|jj}t
||j|j��}||jvr|g|j|<�L|j|�	|���m|Sr)
r�construct_mappingr0�valuerr)r	rr"�append)
rr�mapping�nested_path_prefix�key_node�
value_node�
node_key_path�line_numr/rs
         �rr2z,_CustomSafeLoaderWithMarks.construct_mappingNs�����'�'�+�+�D�1�1��!�9�9�$�?�?��$(�J�		@�		@� �H�j�1�C�8�>�C�C�M��*�/�H�"��x�2�J�4G���D��t�7�7�7�6:�V��(��2�2��(��2�9�9�$�?�?�?�?��rFc�p��t���|d���}|�|��}t|j��D]g\}}|jj}|�|��}t||j|j��}	||j	vr|	g|j	|<�G|j	|�
|	���h|S)NT)�deep)r�construct_sequencer0�	enumerater3rr)r	rr"r4)rrr<�sequencer6�index�
sequence_itemr:r9�marksrs          �rr=z-_CustomSafeLoaderWithMarks.construct_sequence]s�����7�7�-�-�d��-�>�>��!�9�9�$�?�?��$-�d�j�$9�$9�		A�		A� �E�=�$�/�4�H�1�:�5�:�:�M�#��}�7��9O���E��t�7�7�7�6;�W��(��2�2��(��2�9�9�%�@�@�@�@��rc����t�����}t|t��r:td�t	|j����D����|d<|S)Nc�:�g|]}|j|jjdzf��S)�)r
rr))�.0�vs  r�
<listcomp>z>_CustomSafeLoaderWithMarks.get_single_data.<locals>.<listcomp>ps9�������V�Q�\�.��2�3���r�schemamarks)r�get_single_data�
isinstance�dictrr"�values)r�datars  �rrJz*_CustomSafeLoaderWithMarks.get_single_datalsu����w�w�&�&�(�(���d�D�!�!�	�"&���"�D�$<�$C�$C�$E�$E�F����#�#�D����r)F)
rrr�__doc__r!r0r2r=rJrrs@rrrs����������:H�H�H�H�H���� 
�
�
�
�
�
�
�
�
�
�
�	�	�	�	�	�	�	�	�	rrz tag:yaml.org,2002:python/unicodec��eZdZdZd�ZdS)�NoAliasSafeDumperz>A class which avoids constructing anchors/aliases on yaml dumpc��dS)NT�)rrNs  r�ignore_aliasesz NoAliasSafeDumper.ignore_aliases�s���trN)rrrrOrTrSrrrQrQ~s)������H�H�����rrQ�returnc��tj|t���}t|t��si}n|�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


    ��LoaderrI)�yaml�loadrrKrL�pop)�blob�resultrIs   r�load_with_marksr^�sN���Y�t�$>�
?�
?�
?�F��f�d�#�#�0�����j�j��/�/���;��rc�8�tj|t���S)NrW)rYrZr)r\s rrZrZ�s���9�T�"3�4�4�4�4rTFc	�h�tj|dd||d|rtntjj���S)z%Return data in nicely formatted yaml.�
�F)�
line_break�indent�explicit_start�explicit_end�default_flow_style�Dumper)rY�dumprQ�dumper�
SafeDumper)�objrerf�noaliass    r�dumpsrn�sB���9����%�!� �%,�H�!�!�$�+�2H����r)TTF)�collectionsr�	itertoolsr�typingrrrrrY�	YAMLErrorr	�
SafeLoaderrr�add_constructorrrjrkrQ�str�intr^rZrnrSrr�<module>rws���#�"�"�"�"�"�������)�)�)�)�)�)�)�)�)�)�)�)������N�	�
�*��9����
.�.�.�.�.���.�.�.�
Y�Y�Y�Y�Y���Y�Y�Y�x�!�!�&��.�����������.�����U�3��S�#�X��#6�7�����*5�5�5������r