%PDF- %PDF-
Direktori : /snap/core18/current/usr/lib/python3/dist-packages/cloudinit/__pycache__/ |
Current File : //snap/core18/current/usr/lib/python3/dist-packages/cloudinit/__pycache__/safeyaml.cpython-36.pyc |
3 �Ad� � @ s� d dl mZ d dlmZ d dlmZmZmZmZ d dl Z e j Z edd�ZG d d � d e j�Z dd� ZG d d� de j�Ze jde j� G dd� de jj�Zeeeeef f d�dd�Zdd� Zddd�ZdS )� )� namedtuple)�chain)�Any�Dict�List�TupleN�SchemaPathMarks�path� start_mark�end_markc s e Zd Z� fdd�Z� ZS )�_CustomSafeLoaderc s t � j|�S )N)�superZconstruct_scalar)�self�node)� __class__� �4/usr/lib/python3/dist-packages/cloudinit/safeyaml.py�construct_python_unicode s z*_CustomSafeLoader.construct_python_unicode)�__name__� __module__�__qualname__r � __classcell__r r )r r r s r c C s� g }xv|D ]n}d|j kr$|j|� q |j jdd�\}}| |j krn||j krn|jt|j j|| d�|j|j�� q |j|� q W |S )N�.� )r �append�rsplitr �replacer r )Znew_key_path�marks� new_marks�markZpath_prefixZ _path_idxr r r �_fix_nested_map_index s r c sN e Zd ZdZ� 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 } c s t � j|� i | _d S )N)r �__init__�schemamarks_by_line)r �stream)r r r r"