3
\me#) @ s d dl mZ d dlmZ d dlmZmZmZmZ d dl Z e j
Z
G dd dZG dd de jZ
d d
Zee ddd
Zeee ee dddZG dd de jZe
jde
j G dd de jjZeeeeef f dddZdd ZdddZdS ) )defaultdict)chain)AnyDictListTupleNc @ s2 e Zd ZeejejdddZdd Zdd ZdS ) SchemaPathMarks)path
start_markend_markc C s || _ || _|| _d S )N)r r
r )selfr r
r r
/usr/lib/python3.6/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 )N)r
r r r )r r r
r
r __eq__+ s zSchemaPathMarks.__eq__N) __name__
__module____qualname__stryamlZMarkr r r r
r
r
r r s r c s e Zd Z fddZ ZS )_CustomSafeLoaderc s t j|S )N)superZconstruct_scalar)r node) __class__r
r construct_python_unicode5 s z*_CustomSafeLoader.construct_python_unicode)r r r r
__classcell__r
r
)r r r 4 s r c C s2 x,|d d d D ]}| |kr| |k r|S qW d S )N r
)Z
child_markmarksmarkr
r
r _find_closest_parent9 s r$ )
line_marksc C sb x\| D ]T}t || }|r|jjdd\}}|j|jksF|jj|j r|jj||jd|_qW dS )zP
Update any SchemaPathMarks.path for items not under the proper parent.
.r N)r$ r rsplit
startswithreplace)r% r# parentZpath_prefixZ _path_idxr
r
r _reparent_schema_mark_children@ s
r+ )new_markr" returnc C sf g }d}x@|D ]8}|| kr&|j | q| |kr