File: //snap/core20/2669/usr/lib/python3/dist-packages/cloudinit/__pycache__/safeyaml.cpython-38.pyc
U
Ӈgm( � @ s� d dl Z d dlmZ d dlmZ d dlmZmZmZm Z d dl
Z
d dlmZ e �
e�ZG dd� d�Zdd � Zee d
�dd�Zeee ee d
�dd�ZG dd� de
j�ZG dd� de
jj�Ze�d�e eeeef f d�dd��Ze�d�ddd��ZdS )� N)�defaultdict)�chain)�Any�Dict�List�Tuple)�performancec @ s2 e Zd Zeejejd�dd�Zdd� Zdd� ZdS ) �SchemaPathMarks��path�
start_mark�end_markc C s || _ || _|| _d S �Nr
)�selfr r r
� r �4/usr/lib/python3/dist-packages/cloudinit/safeyaml.py�__init__ s zSchemaPathMarks.__init__c C sp |j j| j jk s |jj| jjkr$dS |j j| j jkrH|j j| j jk rHdS |jj| jjkrl|jj| jjkrldS dS )z;Return whether other start/end marks are within self marks.FT)r �liner
�column�r �otherr r r �__contains__ s ������zSchemaPathMarks.__contains__c C s@ | j j|j jko>| j j|j jko>| jj|jjko>| jj|jjkS r )r r r r
r r r r �__eq__/ s ���zSchemaPathMarks.__eq__N) �__name__�
__module__�__qualname__�str�yamlZMarkr r r r r r r r s r c C s0 |d d d� D ]}| |kr| |ks| S qd S )N���r )Z
child_mark�marks�markr r r �_find_closest_parent8 s
r! )�
line_marksc C s\ | D ]R}t || �}|r|j�dd�\}}|j|jksB|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"