
    4                        d dl  d dl d dl d dl d dl d dl dZ	 d dl dZddiZ
d(dZ G d de      Zd	 Zefd
ZefdZefdZefdZd(dZd(dZd Zd Zd Zd Zd Zd ZdedddddfdZdeddddddddddfdZdefdZdedddddddddddddfdZ defdZ!d(dZ"d(dZ#ddefdZ$ddefdZ%d(d Z&d(d!Z'efd"Z(efd#Z) G d$ d%e*      Z+ G d& d'e,      Z-y# e	$ r dZY w xY w))    )*z5.4.1TFYAMLLoadWarningNc                 p    | t         S t        |       t        u r| D ]  }|t         v s| |   t         |<    y y N)_warnings_enabledtypedict)settingskeys      lib/third_party/yaml/__init__.pywarningsr      sA      H~C'')1#!#&      c                       e Zd Zy)r   N)__name__
__module____qualname__ r   r   r   r   (   s    r   c                 ^    t         d   du ry dd l}d| z  }|j                  |t        d       y )Nr   Fr   zcalling yaml.%s() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.   )
stacklevel)r   r   warnr   )methodr   messages      r   load_warningr   +   s;    *+u4	8 		G MM'?qM9r   c              #      K    ||       }	 |j                         r#|j                          |j                         r#|j                          y# |j                          w xY ww)z9
    Scan a YAML stream and produce scanning tokens.
    N)check_token	get_tokendisposestreamLoaderloaders      r   scanr#   :   U      F^F  """$$   " 	   	A%2A A%A""A%c              #      K    ||       }	 |j                         r#|j                          |j                         r#|j                          y# |j                          w xY ww)z9
    Parse a YAML stream and produce parsing events.
    N)check_event	get_eventr   r   s      r   parser)   E   r$   r%   c                 ~     ||       }	 |j                         |j                          S # |j                          w xY w)zj
    Parse the first YAML document in a stream
    and produce the corresponding representation tree.
    )get_single_noder   r   s      r   composer,   P   s3    
 F^F%%'s   * <c              #      K    ||       }	 |j                         r#|j                          |j                         r#|j                          y# |j                          w xY ww)zb
    Parse all YAML documents in a stream
    and produce corresponding representation trees.
    N)
check_nodeget_noder   r   s      r   compose_allr0   [   sS     
 F^F!//## ! 	r%   c                     |t        d       t        } ||       }	 |j                         |j                          S # |j                          w xY w)zd
    Parse the first YAML document in a stream
    and produce the corresponding Python object.
    load)r   
FullLoaderget_single_datar   r   s      r   r2   r2   g   sE    
 ~VF^F%%'s	   = Ac              #      K   |t        d       t        } ||       }	 |j                         r#|j                          |j                         r#|j	                          y# |j	                          w xY ww)z\
    Parse all YAML documents in a stream
    and produce corresponding Python objects.
    Nload_all)r   r3   
check_dataget_datar   r   s      r   r6   r6   v   se     
 ~Z F^F!//## ! 	s   A82A# A8#A55A8c                 "    t        | t              S )z
    Parse the first YAML document in a stream
    and produce the corresponding Python object.

    Resolve all tags except those known to be
    unsafe on untrusted input.
    )r2   r3   r    s    r   	full_loadr;           
##r   c                 "    t        | t              S )z
    Parse all YAML documents in a stream
    and produce corresponding Python objects.

    Resolve all tags except those known to be
    unsafe on untrusted input.
    )r6   r3   r:   s    r   full_load_allr>           FJ''r   c                 "    t        | t              S )z
    Parse the first YAML document in a stream
    and produce the corresponding Python object.

    Resolve only basic YAML tags. This is known
    to be safe for untrusted input.
    )r2   
SafeLoaderr:   s    r   	safe_loadrB      r<   r   c                 "    t        | t              S )z
    Parse all YAML documents in a stream
    and produce corresponding Python objects.

    Resolve only basic YAML tags. This is known
    to be safe for untrusted input.
    )r6   rA   r:   s    r   safe_load_allrD      r?   r   c                 "    t        | t              S )z
    Parse the first YAML document in a stream
    and produce the corresponding Python object.

    Resolve all tags, even those known to be
    unsafe on untrusted input.
    )r2   UnsafeLoaderr:   s    r   unsafe_loadrG      s     %%r   c                 "    t        | t              S )z
    Parse all YAML documents in a stream
    and produce corresponding Python objects.

    Resolve all tags, even those known to be
    unsafe on untrusted input.
    )r6   rF   r:   s    r   unsafe_load_allrI      s     FL))r   c                     d}|ddl m }	  |	       }|j                  } |||||||      }
	 | D ]  }|
j                  |        	 |
j                          |r |       S y# |
j                          w xY w)zl
    Emit YAML parsing events into a stream.
    If stream is None, return the produced string instead.
    Nr   StringIO)	canonicalindentwidthallow_unicode
line_break)rL   getvalueemitr   )eventsr    DumperrM   rN   rO   rP   rQ   rR   rL   dumperevents               r   rS   rS      s~     H~%??Fie'J@FEKK  	z  	s   A   A2zutf-8c                 D   d}|"|ddl m } nddlm }  |       }|j                  } |||||||||||	|
      }	 |j                          | D ]  }|j	                  |        |j                          |j                          |r |       S y# |j                          w xY w)z
    Serialize a sequence of representation trees into a YAML stream.
    If stream is None, return the produced string instead.
    Nr   rK   )
rM   rN   rO   rP   rQ   encodingversiontagsexplicit_startexplicit_end)rL   	cStringIOrR   open	serializecloser   )nodesr    rU   rM   rN   rO   rP   rQ   rY   r\   r]   rZ   r[   rR   rL   rV   nodes                    r   serialize_allrd      s     H~)*??Fie'JwT)FFDT" z  	s   8B Bc                 "    t        | g|fd|i|S )zx
    Serialize a representation tree into a YAML stream.
    If stream is None, return the produced string instead.
    rU   )rd   )rc   r    rU   kwdss       r   r`   r`      s    
 $??$??r   c                 J   d}|"|
ddl m } nddlm }  |       }|j                  } |||||||||	|
|||||      }	 |j                          | D ]  }|j	                  |        |j                          |j                          |r |       S y# |j                          w xY w)z
    Serialize a sequence of Python objects into a YAML stream.
    If stream is None, return the produced string instead.
    Nr   rK   )default_styledefault_flow_stylerM   rN   rO   rP   rQ   rY   rZ   r[   r\   r]   	sort_keys)rL   r^   rR   r_   	representra   r   )	documentsr    rU   rh   ri   rM   rN   rO   rP   rQ   rY   r\   r]   rZ   r[   rj   rR   rL   rV   datas                       r   dump_allrn      s     H~)*??F-1e'JwT)PY[FDT" z  	s   8B B"c                 "    t        | g|fd|i|S )zr
    Serialize a Python object into a YAML stream.
    If stream is None, return the produced string instead.
    rU   )rn   )rm   r    rU   rf   s       r   dumprp      s    
 TFF:6:T::r   c                 (    t        | |fdt        i|S )z
    Serialize a sequence of Python objects into a YAML stream.
    Produce only basic YAML tags.
    If stream is None, return the produced string instead.
    rU   rn   
SafeDumper)rl   r    rf   s      r   safe_dump_allrt   '  s     IvAjADAAr   c                 *    t        | g|fdt        i|S )z
    Serialize a Python object into a YAML stream.
    Produce only basic YAML tags.
    If stream is None, return the produced string instead.
    rU   rr   )rm   r    rf   s      r   	safe_dumprv   /  s     TFF>:>>>r   c                    |dt         j                  j                  | ||       t         j                  j                  | ||       t         j                  j                  | ||       n|j                  | ||       |j                  | ||       y)z
    Add an implicit scalar detector.
    If an implicit scalar value matches the given regexp,
    the corresponding tag is assigned to the scalar.
    first is a sequence of possible initial characters or None.
    N)r"   r!   add_implicit_resolverr3   rF   )tagregexpfirstr!   rU   s        r   rx   rx   7  ss     ~++C?//VUC11#vuE$$S&%8
  fe4r   c                    |dt         j                  j                  | ||       t         j                  j                  | ||       t         j                  j                  | ||       n|j                  | ||       |j                  | ||       y)z
    Add a path based resolver for the given tag.
    A path is a list of keys that forms a path
    to a node in the representation tree.
    Keys can be string values, integers, or None.
    N)r"   r!   add_path_resolverr3   rF   )ry   pathkindr!   rU   s        r   r}   r}   G  ss     ~''T48++Ct<--c4>  dD1
S$-r   c                     |at         j                  j                  | |       t         j                  j                  | |       t         j                  j                  | |       y|j                  | |       y)z
    Add a constructor for the given tag.
    Constructor is a function that accepts a Loader instance
    and a node object and produces the corresponding Python object.
    N)r"   r!   add_constructorr3   rF   )ry   constructorr!   s      r   r   r   V  sY     ~%%c;7))#{;++C=sK0r   c                     |at         j                  j                  | |       t         j                  j                  | |       t         j                  j                  | |       y|j                  | |       y)a  
    Add a multi-constructor for the given tag prefix.
    Multi-constructor is called for a node if its tag starts with tag_prefix.
    Multi-constructor accepts a Loader instance, a tag suffix,
    and a node object and produces the corresponding Python object.
    N)r"   r!   add_multi_constructorr3   rF   )
tag_prefixmulti_constructorr!   s      r   r   r   c  s]     ~++J8IJ//
<MN11*>OP$$Z1BCr   c                 (    |j                  | |       y)z
    Add a representer for the given type.
    Representer is a function accepting a Dumper instance
    and an instance of the given data type
    and producing the corresponding representation node.
    N)add_representer)	data_typerepresenterrU   s      r   r   r   q  s     9k2r   c                 (    |j                  | |       y)z
    Add a representer for the given type.
    Multi-representer is a function accepting a Dumper instance
    and an instance of the given data type or subtype
    and producing the corresponding representation node.
    N)add_multi_representer)r   multi_representerrU   s      r   r   r   z  s       ,=>r   c                   "     e Zd ZdZ fdZ xZS )YAMLObjectMetaclassz'
    The metaclass for YAMLObject.
    c                    t         t        |   |||       d|v r|d   t        | j                  t
              r8| j                  D ](  }|j                  | j                  | j                         * n0| j                  j                  | j                  | j                         | j                  j                  | | j                         y y y )Nyaml_tag)superr   __init__
isinstanceyaml_loaderlistr   r   	from_yamlyaml_dumperr   to_yaml)clsnamebasesrf   r"   	__class__s        r   r   zYAMLObjectMetaclass.__init__  s    !30udC$z"2">#//40!ooF**3<<G . //cmmLOO++C= #?r   )r   r   r   __doc__r   __classcell__)r   s   @r   r   r     s    	> 	>r   r   c                   Z    e Zd ZdZeZdZeee	gZ
eZdZdZd Z ee      Zd Z ee      Zy)
YAMLObjectza
    An object that can dump itself to a YAML stream
    and load itself from a YAML stream.
    r   Nc                 &    |j                  ||       S )zC
        Convert a representation node to a Python object.
        )construct_yaml_object)r   r"   rc   s      r   r   zYAMLObject.from_yaml  s     ++D#66r   c                 T    |j                  | j                  || | j                        S )zC
        Convert a Python object to a representation node.
        )
flow_style)represent_yaml_objectr   yaml_flow_style)r   rV   rm   s      r   r   zYAMLObject.to_yaml  s/     ++CLL$.. , 0 	0r   )r   r   r   r   r   __metaclass__	__slots__r!   r3   rF   r   rU   r   r   r   r   classmethodr   r   r   r   r   r     sP    
 (MI:|4KKHO7
 I&I0 '"Gr   r   r   ).errortokensrT   rb   r"   rV   __version__cyaml__with_libyaml__ImportErrorr   r   RuntimeWarningr   r   r!   r#   r)   r,   r0   r2   r6   r;   r>   rB   rD   rG   rI   rU   rS   rd   r`   rn   rp   rt   rv   rx   r}   r   r   r   r   r   r   objectr   r   r   r   <module>r      s         t 
7	n 	:  	   	 " 	  & 
 $($(&* Vt4t, !%Vt4tD4	>   @  $Fut4tD44 D 6 ;B? .2F5  '+4 .1D 4: 3 @F ?>$ ># #E  s   C& &C0/C0