a
    ͝Gd                     @   s0  d dl Z d dlZd dlZd dlZd dlmZ d dlZd dlm	Z	m
Z
 d dlT d dlT d dlT d dlmZmZmZmZ d dlmZmZmZmZ d dlmZmZmZmZmZ d dlmZm Z  d d	l!m"Z"m#Z#m$Z$m%Z% d d
l&m'Z'm(Z(m)Z)m*Z* d dlmZ+ d dl,m-Z-m.Z.m/Z/ zd dl<m=Z=m>Z> W n   d Z=Z>Y n0 G dd dZ?G dd dZ@dd ZAdKddZBefddZCefddZDefddZEefddZFdLdd ZGdMd!d"ZHdNd#d$ZIdOd%d&ZJdPd'd(ZKdQd)d*ZLdedddddfd+d,ZMdZNdedddddeNddddfd-d.ZOdefd/d0ZPdedddddddeNdddddddfd1d2ZQdedddddddeNdddddfd3d4ZRdRd5d6ZSdSd7d8ZTdedddddddeNdddddddfd9d:ZUddde fd;d<ZVddde fd=d>ZWde)fd?d@ZXde)fdAdBZYde$fdCdDZZde$fdEdFZ[G dGdH dHe\Z]G dIdJ dJee]Z^dS )T    N)import_module)UnsafeLoaderWarning	YAMLError)*)
BaseLoader
SafeLoaderLoaderRoundTripLoader)
BaseDumper
SafeDumperDumperRoundTripDumper)StringIOBytesIOwith_metaclassnprintnprintf)VersionedResolverResolver)BaseRepresenterSafeRepresenterRepresenterRoundTripRepresenter)BaseConstructorSafeConstructorConstructorRoundTripConstructor)r   )CommentedMapCommentedSeqC_PRE)CParserCEmitterc                   @   s  e Zd ZdddddddZedd Zedd	 Zed
d Zedd Zedd Z	edd Z
edd Zedd Zedd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ ZdKdd,d-d.Zdd,d/d0Zdd,d1d2Zd3d4 Zd5d6 Zd7d8 Zd9d: Zd;d< Zd=d> Z d?d@ Z!dLdAdBZ"edCdD Z#e#j$dEdD Z#edFdG Z%e%j$dHdG Z%dMdIdJZ&dS )NYAMLNF)typpureoutputplug_insc          
      C   s  |du rdgnt |tr|n|g| _|| _|| _d| _g | _|du rHg n||   D ]"}|t	j
d}| jt| qTtjjj| _d| _d| _d| _d| _d| _d| _d| _d| _d}d}d| jv rd}nd| jv r>|stdu rtjjjnt| _tjjj| _|stdu rtjj j!nt| _!tjj"j#| _#tjj$j%| _nFd| jv rtjjj| _tjjj&| _|srtdu r|tjj j!nt| _!tjj"j#| _#tjj$j'| _nd	| jv r|stdu rtjjjnt| _tjjj| _|stdu rtjj j!nt| _!tjj"j#| _#tjj$j| _nvd
| jv r|d| _tjjj| _tjj(j| _tjjj)| _tjj*j+| _tjj j,| _!tjj"j#| _#tjj$j-| _t.| _nd}d}|rd| _tjjj| _tjj(j| _tjjj)| _tjj*j/| _tjj j0| _!tjj"j#| _#tjj$j-| _~d| _1d| _2d| _3d| _4d| _5d| _6d| _7d| _8d| _9d| _:d| _;d| _<d| _=d| _>d| _?d| _@d| _Ad| _Bd| _Cd| _Dd| _Ed| _Fd| _Gd| _H| jD ]2}	tI|	dd| jv r||d7 }|	J|   qq||dkrtKdL| jdS )ak  
        typ: 'rt'/None -> RoundTripLoader/RoundTripDumper,  (default)
             'safe'    -> SafeLoader/SafeDumper,
             'unsafe'  -> normal/unsafe Loader/Dumper
             'base'    -> baseloader
        pure: if True only use Python modules
        input/output: needed to work as context manager
        plug_ins: a list of plug-in files
        Nrt.T   FsafebaseunsafeZrtscr   zutf-8r#   z1typ "{}"not recognised (need to install plug-in?))M
isinstancelistr#   r$   _output_context_managerr&   official_plug_insreplaceossepappendr   ruamelyamlresolverr   r   allow_unicodeReaderr   r   Scanner
Serializerdefault_flow_styleZcomment_handlingr!   emitterEmitterrepresenterr   r    parserParsercomposerComposerconstructorr   r   r   
serializerr   scannerZRoundTripScannerSCZRoundTripParserSCr   r   ZRoundTripScannerZRoundTripParserstream	canonical
old_indentwidth
line_break
map_indentsequence_indentsequence_dash_offsetcompact_seq_seqcompact_seq_map sort_base_mapping_type_on_outputtop_level_colon_alignprefix_colonversionpreserve_quotesallow_duplicate_keysencodingexplicit_startexplicit_endtagsdefault_styleZ0top_level_block_style_scalar_no_indent_error_1_1scalar_after_indicator+brace_single_entry_mapping_in_flow_sequencegetattrZinit_typNotImplementedErrorformat)
selfr#   r$   r%   r&   Zpu	file_nameZ	typ_foundZsetup_rtmodule re   L/var/www/html/django/DPS/env/lib/python3.9/site-packages/ruamel/yaml/main.py__init__6   s    $
   




zYAML.__init__c                 C   s6   z| j W S  ty0   | jd | d| _ | j  Y S 0 d S Nloader)_readerAttributeErrorr:   rb   re   re   rf   reader   s
    zYAML.readerc                 C   s4   z| j W S  ty.   | j| d| _ | j  Y S 0 d S rh   )_scannerrl   r;   rm   re   re   rf   rG      s
    zYAML.scannerc                 C   sj   dt  jj }t| |s`| jtur:t| || j| d n&t| dd d u rNd S t| |t| j	 t| |S )N_ri   _stream)
sys	_getframef_codeco_namehasattrrB   r    setattrr_   rq   rb   attrre   re   rf   rA      s    

zYAML.parserc                 C   s8   dt  jj }t| |s.t| || j| d t| |S )Nrp   ri   )rr   rs   rt   ru   rv   rw   rD   r_   rx   re   re   rf   rC      s    
zYAML.composerc                 C   sH   dt  jj }t| |s>| j| j| d}| j|_t| || t	| |S )Nrp   )rV   rj   )
rr   rs   rt   ru   rv   r   rV   rW   rw   r_   )rb   ry   Zcnstre   re   rf   rE      s    
zYAML.constructorc                 C   s<   dt  jj }t| |s2t| || j| j| d t| |S )Nrp   )rU   rj   )	rr   rs   rt   ru   rv   rw   r   rU   r_   rx   re   re   rf   r8      s    
zYAML.resolverc                 C   s   dt  jj }t| |s| jtur| jd | j| j| j	| j
| j| j| j| d	}t| || | jd url| j|_| jd ur~| j|_| jd ur| j|_| jd ur| j|_| jd ur| j|_nt| dd d u rd S d S t| |S )Nrp   )rI   indentrK   r9   rL   rT   r^   dumperrq   )rr   rs   rt   ru   rv   r?   r!   rI   rJ   rK   r9   rL   rT   r^   rw   rM   Zbest_map_indentrN   Zbest_sequence_indentrO   rP   rQ   r_   )rb   ry   _emitterre   re   rf   r>      s:    







zYAML.emitterc                 C   sL   dt  jj }t| |sBt| || j| j| j| j	| j
| j| d t| |S )Nrp   )rX   rY   rZ   rU   r[   r{   )rr   rs   rt   ru   rv   rw   r<   rX   rY   rZ   rU   r[   r_   rx   re   re   rf   rF     s    
zYAML.serializerc                 C   sV   dt  jj }t| |sL| j| j| j| d}| jd ur@| j|_t	| || t
| |S )Nrp   )r\   r=   r{   )rr   rs   rt   ru   rv   r   r\   r=   rR   rw   r_   )rb   ry   Zrepresre   re   rf   r@   *  s    

zYAML.representerc                 c   s  t |dsHt |drH|d}| |W  d   S 1 s>0    Y  | |\}}zh| j rp| j V  qXW |  z| j	  W n t
y   Y n0 z| j  W n t
y   Y n0 nP|  z| j	  W n t
y   Y n0 z| j  W n t
y   Y n0 0 dS )zA
        Scan a YAML stream and produce scanning tokens.
        readopenrbN)rv   r~   scanget_constructor_parserrG   check_token	get_tokendisposerk   reset_readerrl   ro   reset_scannerrb   rH   fprp   rA   re   re   rf   r   9  s2    (
z	YAML.scanc                 c   s  t |dsHt |drH|d}| |W  d   S 1 s>0    Y  | |\}}zd| rl| V  qXW |  z| j  W n t	y   Y n0 z| j
  W n t	y   Y n0 nP|  z| j  W n t	y   Y n0 z| j
  W n t	y   Y n0 0 dS )zA
        Parse a YAML stream and produce parsing events.
        r}   r~   r   N)rv   r~   parser   check_event	get_eventr   rk   r   rl   ro   r   r   re   re   rf   r   Q  s2    (z
YAML.parsec                 C   sN  t |dsHt |drH|d}| |W  d   S 1 s>0    Y  | |\}}z|j W |  z| j  W n t	y   Y n0 z| j
  W S  t	y   Y S 0 S z| j  W n t	y   Y n0 z| j
  W n t	 y   Y n0 nR|  z| j  W n t	y"   Y n0 z| j
  W n t	yF   Y n0 0 dS )zv
        Parse the first YAML document in a stream
        and produce the corresponding representation tree.
        r}   r~   r   N)rv   r~   composer   rC   get_single_noder   rk   r   rl   ro   r   rb   rH   r   rE   rA   re   re   rf   r   i  sD    (
 zYAML.composec                 c   s   |  |\}}zh|j r(|j V  qW |  z| j  W n tyR   Y n0 z| j	  W q tyt   Y q0 nN|  z| j  W n ty   Y n0 z| j	  W n ty   Y n0 0 dS )zn
        Parse all YAML documents in a stream
        and produce corresponding representation trees.
        N)
r   rC   
check_nodeget_noder   rk   r   rl   ro   r   )rb   rH   rE   rA   re   re   rf   compose_all  s,    
zYAML.compose_allc                 C   sL  t |dsHt |drH|d}| |W  d   S 1 s>0    Y  | |\}}z| W |  z| j  W n ty   Y n0 z| j	
  W S  ty   Y S 0 S z| j  W n ty   Y n0 z| j	
  W n t y   Y n0 nR|  z| j  W n ty    Y n0 z| j	
  W n tyD   Y n0 0 dS )a  
        at this point you either have the non-pure Parser (which has its own reader and
        scanner) or you have the pure Parser.
        If the pure Parser is set, then set the Reader and Scanner, if not already set.
        If either the Scanner or Reader are set, you cannot use the non-pure Parser,
            so reset it to the pure parser and set the Reader resp. Scanner if necessary
        r}   r~   r   N)rv   r~   loadr   get_single_datar   rk   r   rl   ro   r   r   re   re   rf   r     sD    	( z	YAML.loadc                 c   s   t |dsVt |drV|d(}| |D ]
}|V  q*W d    d S 1 sL0    Y  | |\}}zd| rz| V  qfW |  z| j  W n t	y   Y n0 z| j
  W n t	y   Y n0 nR|  z| j  W n t	 y   Y n0 z| j
  W n t	y   Y n0 0 d S )Nr}   r~   r)rv   r~   load_allr   
check_dataget_datar   rk   r   rl   ro   r   )rb   rH   r   drE   rA   re   re   rf   r     s6     zYAML.load_allc                    s   j tur@jdu r tjjj_jdu r6tjjj_|j_njdurvjdu r`tjjj_tjj	j _ |j_npjdurjdu rtjjj_tjj	j _ |j_n:j
 G  fdddj j }|_||}||fS jj	fS )zM
        the old cyaml needs special setup, and therefore the stream
        Nc                       s"   e Zd Zjdf fdd	ZdS )z,YAML.get_constructor_parser.<locals>.XLoaderNc                    sD   t | | |  | _| _jj| | d j| _ j| || d d S )Nri   )rU   Z	loadumper)r    rg   _parser	_composerr   rW   )selfxrH   rU   rV   Zrslvrrb   re   rf   rg     s
    z5YAML.get_constructor_parser.<locals>.XLoader.__init__)__name__
__module____qualname__rU   rg   re   r   re   rf   XLoader  s   r   )rB   r    r:   r6   r7   rn   r;   rG   rH   rA   r   r   rq   rE   )rb   rH   r   rj   re   r   rf   r     s,    









	zYAML.get_constructor_parserc                 C   sv   |  |d\}}}z:|D ]}|| qW z|  W qr tyJ    Y qr0 n$z|  W n tyn    Y n0 0 dS )zx
        Emit YAML parsing events into a stream.
        If stream is None, return the produced string instead.
        N)"get_serializer_representer_emitteremitr   rl   )rb   eventsrH   rp   r>   eventre   re   rf   r     s    
z	YAML.emitc                 C   s   |  |g| dS )z
        Serialize a representation tree into a YAML stream.
        If stream is None, return the produced string instead.
        N)serialize_all)rb   noderH   re   re   rf   	serialize  s    zYAML.serializec                 C   s   |  |d\}}}zJ|  |D ]}|| q |  W z|  W q tyZ    Y q0 n$z|  W n ty~    Y n0 0 dS )z
        Serialize a sequence of representation trees into a YAML stream.
        If stream is None, return the produced string instead.
        N)r   r~   r   closer   rl   )rb   nodesrH   rF   rp   r>   r   re   re   rf   r     s    

zYAML.serialize_all	transformc                C   sb   | j r<| jstd|d ur.td| jj| j | n"|d u rLtd| j|g||dS d S )Nz8Missing output stream while dumping from context managerz?{}.dump() in the context manager cannot have transform keyword z<Need a stream argument when not dumping from context managerr   )r0   r/   	TypeErrorra   	__class__r   dumpdump_all)rb   datarH   r   re   re   rf   r   0  s    z	YAML.dumpc                C   sN   | j r
t|| _t| |d| _ |D ]}| j | q"| j   d | _d | _ d S )Nr   )r0   r`   r/   YAMLContextManagerr   teardown_output)rb   	documentsrH   r   r   re   re   rf   r   @  s    
zYAML.dump_allc                C   s  t |dsNt |drN|d }| j|||dW  d   S 1 sD0    Y  | jdu rptdd |d	 D }n| j}|dur|}| jdu rt }nt }| ||\}}}	z| j	  |D ]*}
z| j
|
 W q ty    Y q0 q| j	  W z| j  W n ty    Y n0 t| d
 t| d n<z| j  W n tyT    Y n0 t| d
 t| d 0 |r| }| jr|| j}|du r|| n||| dS )zL
        Serialize a sequence of Python objects into a YAML stream.
        writer~   wr   NTc                 S   s   g | ]}t t|qS re   lenstr.0xre   re   rf   
<listcomp>W      z"YAML.Xdump_all.<locals>.<listcomp>r   _serializerr|   )rv   r~   r   rS   maxrX   r   r   r   rF   r@   	representrl   r   r>   r   delattrgetvaluedecoder   )rb   r   rH   r   r   tlcaZfstreamrF   r@   r>   r   valre   re   rf   	Xdump_allL  sT    .








zYAML.Xdump_allc                    s*  j turTjd u r tjjj_|j_|j_j	d urDj	j_	jj
jfS jd urtjjj _ |j_|j_j	d urj	j_	jj
jfS djv rtjjjntjjj G  fdddtj }|_||jjjjjjjjjjjd}| __|||fS )Nr+   c                       s   e Zd Zd fdd	ZdS )z8YAML.get_serializer_representer_emitter.<locals>.XDumperNc                    sT   t j| |||||	|||
|||d |  | _ | _| _jj| ||d  |  d S )N)
rI   rz   rK   rX   r9   rL   rY   rZ   rU   r[   )r\   r=   )r!   rg   r|   r   _representerr   )r   rH   r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   block_seq_indentrS   rT   r   re   rf   rg     s&    zAYAML.get_serializer_representer_emitter.<locals>.XDumper.__init__)NNNNNNNNNNNNNNN)r   r   r   rg   re   r   re   rf   XDumper  s                   r   )r\   r=   rI   rz   rK   r9   rL   rY   rZ   rU   r[   )r?   r!   r<   r6   r7   rF   r>   rH   rS   r]   r@   r#   r8   BaseResolverr   r   rq   r\   r=   rI   rJ   rK   r9   rL   rY   rZ   rU   r[   r|   r   )rb   rH   r   r   r{   re   r   rf   r   ~  sJ    






)z'YAML.get_serializer_representer_emitterc                 K   s*   d| j v rtf i |S tf i |S d S Nr'   )r#   r   dict)rb   kwre   re   rf   map  s    
zYAML.mapc                 G   s   d| j v rt| S t| S d S r   )r#   r   r.   )rb   argsre   re   rf   seq  s    
zYAML.seqc                    s\   zt jt}W n ty&   g  Y S 0 t jt j|  fddt|d D }|S )a  search for list of subdirs that are plug-ins, if __file__ is not available, e.g.
        single file installers that are not properly emulating a file-system (issue 324)
        no plug-ins will be found. If any are packaged, you know which file that are
        and you can explicitly provide it during instantiation:
            yaml = ruamel.yaml.YAML(plug_ins=['ruamel/yaml/jinja2/__plug_in__'])
        c                    s    g | ]}|  d dd qS ) r)   )r2   r   Zgpbdre   rf   r     r   z*YAML.official_plug_ins.<locals>.<listcomp>z/*/__plug_in__.py)r3   pathdirname__file__	NameErrorglob)rb   Zbdresre   r   rf   r1     s    
zYAML.official_plug_insc                    s   t  dd j z| j  j W n. tyT    fdd}| j | Y n0 z| j j W n, ty    fdd}| j| Y n0  S )z
        register a class for dumping loading
        - if it has attribute yaml_tag use that to register, else use class name
        - if it has methods to_yaml/from_yaml use those to dump/load else dump attributes
          as mapping
        yaml_tag!c                    s   | j | | jdS NZ
flow_stylerepresent_yaml_objectr=   r@   r   clstagre   rf   t_y  s    
z YAML.register_class.<locals>.t_yc                    s   |  | S NZconstruct_yaml_objectrE   r   r   re   rf   f_y  s    z YAML.register_class.<locals>.f_y	r_   r   r@   add_representerto_yamlrl   rE   add_constructor	from_yaml)rb   r   r   r   re   r   rf   register_class  s    zYAML.register_classc                 C   s   t | | _| S r   )r   r0   rm   re   re   rf   	__enter__  s    
zYAML.__enter__c                 C   s"   |rt d| | j  d | _d S )Nr#   )r   r0   r   )rb   r#   value	tracebackre   re   rf   __exit__  s    

zYAML.__exit__c                 C   s.   |d ur|| _ |d ur|| _|d ur*|| _d S r   )rM   rN   rO   )rb   mappingsequenceoffsetre   re   rf   _indent#  s    zYAML._indentc                 C   s   | j S r   )r   rm   re   re   rf   rz   ,  s    zYAML.indentc                 C   s
   || _ d S r   )rJ   rb   r   re   re   rf   rz   1  s    c                 C   s   | j S r   rO   rm   re   re   rf   r   6  s    zYAML.block_seq_indentc                 C   s
   || _ d S r   r   r   re   re   rf   r   ;  s    c                 C   s   || _ || _d S r   )rP   rQ   )rb   Zseq_seqZseq_mapre   re   rf   compact@  s    zYAML.compact)N)NNN)NN)'r   r   r   rg   propertyrn   rG   rA   rC   rE   r8   r>   rF   r@   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r1   r   r   r   r   rz   setterr   r   re   re   re   rf   r"   5   sb   {




	

#

"-2W!	
	



r"   c                   @   s.   e Zd Zd
ddZdd Zdd Zdd	 ZdS )r   Nc                 C   s   || _ d| _d | _| j j| _|| _t| jdsPt| jdrP| j| _| jd| _| jd ur| j| _| j jd u rxt	 | _nt
 | _d S )NFr   r~   r   )_yaml_output_inited_output_pathr/   
_transformrv   r~   _fstreamrX   r   r   )rb   r7   r   re   re   rf   rg   G  s    


zYAMLContextManager.__init__c                 C   s   | j r| jj  nd S z| jj  W n ty<    Y n0 zt| jd t| jd W n tyn    Y n0 | jr| j	
 }| jjr|| jj}| jd u r| | n$| j| | | j  | j| _	| jd ur| j	  d S )Nr   r|   )r   r   rF   r   r>   r   rl   r   r   r/   r   rX   r   r  r   flushr   r   re   re   rf   r   g  s.    



z"YAMLContextManager.teardown_outputc                 C   sN   | j jdu r tdd |D }n| j j}| j | j| | j j  d| _d S )NTc                 S   s   g | ]}t t|qS re   r   r   re   re   rf   r     r   z2YAMLContextManager.init_output.<locals>.<listcomp>)r   rS   r   r   r/   rF   r~   r   )rb   Z
first_datar   re   re   rf   init_output  s    zYAMLContextManager.init_outputc                 C   s<   | j s| | z| jj| W n ty6    Y n0 d S r   )r   r  r   r@   r   rl   )rb   r   re   re   rf   r     s    
zYAMLContextManager.dump)N)r   r   r   rg   r   r  r   re   re   re   rf   r   F  s   
 
r   c                    s    fdd}|S )aj   decorator for classes that needs to dump/load objects
    The tag for such objects is taken from the class attribute yaml_tag (or the
    class name in lowercase in case unavailable)
    If methods to_yaml and/or from_yaml are available, these are called for dumping resp.
    loading, default routines (dumping a mapping of the attributes) used otherwise.
    c                    s   t  dd j zj  j W n. tyT    fdd}j | Y n0 zj j W n, ty    fdd}j| Y n0  S )Nr   r   c                    s   | j | | jdS r   r   r   r   re   rf   r     s    
z)yaml_object.<locals>.yo_deco.<locals>.t_yc                    s   |  | S r   r   r   r   re   rf   r     s    z)yaml_object.<locals>.yo_deco.<locals>.f_yr   )r   r   r   ymlr   rf   yo_deco  s    zyaml_object.<locals>.yo_decore   )r  r  re   r  rf   yaml_object  s    	r  r   c                 C   s,   ddl m} tj|d| ||dtdd d S )Nr   )_FzM
{fun} will be removed, use

  yaml=YAML({arg})
  yaml.{method}(...)

instead)funmethodarg   
stacklevel)ruamel.yaml.compatr  warningswarnPendingDeprecationWarning)r	  r
  r  r  re   re   rf   warn_deprecation  s    r  c                 c   sN   t dddd || }z&|j r0|j V  qW |j  n|j  0 dS )z9
    Scan a YAML stream and produce scanning tokens.
    r   typ='unsafe', pure=Truer  N)r  rG   r   r   r   r   rH   r   rj   re   re   rf   r     s    
r   c                 c   sN   t dddd || }z&|j r0|j V  qW |j  n|j  0 dS )z9
    Parse a YAML stream and produce parsing events.
    r   r  r  N)r  r   r   r   r   r  re   re   rf   r     s    
r   c                 C   s8   t dddd || }z| W |  S |  0 dS )zj
    Parse the first YAML document in a stream
    and produce the corresponding representation tree.
    r   r  r  N)r  r   r   r  re   re   rf   r     s    r   c                 c   sL   t dddd || }z$| r.|j V  qW |j  n|j  0 dS )zb
    Parse all YAML documents in a stream
    and produce corresponding representation trees.
    r   r  r  N)r  r   r   r   r   r   r  re   re   rf   r     s    r   c                 C   s4  t dddd |du r,tjtjtdd t}|| ||d}z|j W |j	  z|j
  W n typ   Y n0 z|j  W S  ty   Y S 0 S z|j
  W n ty   Y n0 z|j  W n ty   Y n0 nT|j	  z|j
  W n ty   Y n0 z|j  W n ty,   Y n0 0 dS )zd
    Parse the first YAML document in a stream
    and produce the corresponding Python object.
    r   r  r  N   r  rV   )r  r  r  r   textUnsafeLoader_constructorr   r   r   rk   r   rl   ro   r   rH   r   rU   rV   rj   re   re   rf   r   #  sF    

 
r   c                 c   s   t dddd |du r,tjtjtdd t}|| ||d}zj|j rT|j V  q<W |j	
  z|j  W n ty   Y n0 z|j  W q ty   Y q0 nP|j	
  z|j  W n ty   Y n0 z|j  W n ty   Y n0 0 dS )z\
    Parse all YAML documents in a stream
    and produce corresponding Python objects.
    r   r  r  Nr  r  r  )r  r  r  r   r  r  r  r   r   r   r   rk   r   rl   ro   r   r  re   re   rf   r   <  s4    


r   c                 C   s   t dddd t| t|S )
    Parse the first YAML document in a stream
    and produce the corresponding Python object.
    Resolve only basic YAML tags.
    	safe_loadr   typ='safe', pure=Truer  )r  r   r   rH   rU   re   re   rf   r  V  s    r  c                 C   s   t dddd t| t|S )~
    Parse all YAML documents in a stream
    and produce corresponding Python objects.
    Resolve only basic YAML tags.
    safe_load_allr   r  r  )r  r   r   r   re   re   rf   r"  a  s    r"  c                 C   s   t dd t| t||dS )r  round_trip_load_allr   r  )r  r   r	   rH   rU   rV   re   re   rf   round_trip_loadl  s    
r%  c                 C   s   t dd t| t||dS )r!  r#  r   r  )r  r   r	   r$  re   re   rf   r#  w  s    
r#  c                 C   s   t dddd d}|du r&t }|j}|||||||d}	zD| D ]}
|	|
 q@W z|	j  W q ty|    |	  Y q0 n.z|	j  W n ty    |	  Y n0 0 |dur| S dS )zl
    Emit YAML parsing events into a stream.
    If stream is None, return the produced string instead.
    r   r  r  N)rI   rz   rK   r9   rL   )r  r   r   r   r|   r   rl   )r   rH   r   rI   rz   rK   r9   rL   r   r{   r   re   re   rf   r     s8    r   c                 C   s   t dddd d}|du r6|du r*t }nt }|j}|||||||||||	|
d}zX|j  | D ]}|| qd|j  W z|j	  W q t
y    |	  Y q0 n.z|j	  W n t
y    |	  Y n0 0 |dur| S dS )z
    Serialize a sequence of representation trees into a YAML stream.
    If stream is None, return the produced string instead.
    r   r  r  N)
rI   rz   rK   r9   rL   rX   rU   r[   rY   rZ   )r  r   r   r   r   r~   r   r   r|   r   rl   )r   rH   r   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   r{   r   re   re   rf   r     sJ    
r   c                 K   s&   t dddd t| g|fd|i|S )zx
    Serialize a representation tree into a YAML stream.
    If stream is None, return the produced string instead.
    r   r  r  r   )r  r   )r   rH   r   kwdsre   re   rf   r     s    r   c                 C   s6  t dddd d}|du r0tdd | d D }|du rT|
du rHt }nt }|j}|||||||||	|
|||||||d	}zt|j  | D ]*}z|j| W q t	y    Y q0 q|j
  W z|j  W n t	y    |  Y n0 n0z|j  W n t	y    |  Y n0 0 |dur2| S dS )
z
    Serialize a sequence of Python objects into a YAML stream.
    If stream is None, return the produced string instead.
    r   r  r  NTc                 S   s   g | ]}t t|qS re   r   r   re   re   rf   r     r   zdump_all.<locals>.<listcomp>r   )r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   rS   rT   )r  r   r   r   r   r   r~   r   r   rl   r   r|   r   )r   rH   r   r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   rS   rT   r   r{   r   re   re   rf   r     s`    


r   c                 C   s8   t dddd t| g|||||||||	|
|||||dS )u   
    Serialize a Python object into a YAML stream.
    If stream is None, return the produced string instead.

    default_style ∈ None, '', '"', "'", '|', '>'

    r   r  r  )r   r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   r  r   )r   rH   r   r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   re   re   rf   r   9  s&    r   c                 K   s$   t dddd 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.
    safe_dump_allr   r  r  r   r  r   r   )r   rH   r&  re   re   rf   r(  h  s    r(  c                 K   s&   t dddd 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.
    	safe_dumpr   r  r  r   r)  )r   rH   r&  re   re   rf   r*  s  s    r*  c                 C   sH   |d u rdn|}t dd t| g|||||||||	|
|||||||dS )NTround_trip_dumpr   )r   r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   rS   rT   r'  )r   rH   r   r\   r=   rI   rz   rK   r9   rL   rX   rY   rZ   rU   r[   r   rS   rT   re   re   rf   r+  ~  s,    
r+  c                 C   s   |du r"|du r"| | || dS |rlt|dr@| | || n,t|tttjjjt	frht
 | || nt|rt|dr| | || n,t|tttjjjtfrt
 | || ntdS )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add_implicit_resolver)r,  rv   
issubclassr   r   r6   r7   rj   r   r	   r   r`   r
   r   r{   r   r   )r   regexpfirstr   r   r8   re   re   rf   r,    s&    


r,  c                 C   s   |du r"|du r"| | || dS |rlt|dr@| | || n,t|tttjjjt	frht
 | || nt|rt|dr| | || n,t|tttjjjtfrt
 | || ntdS )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add_path_resolver)r0  rv   r-  r   r   r6   r7   rj   r   r	   r   r`   r
   r   r{   r   r   )r   r   kindr   r   r8   re   re   rf   r0    s&    

r0  c                 C   s   |du r| | | n~t|dr0| | | dS t|trHt | | nLt|tr`t | | n4t||rxt | | nt|trt	 | | nt
dS )z
    Add an object constructor for the given tag.
    object_onstructor is a function that accepts a Loader instance
    and a node object and produces the corresponding Python object.
    Nr   )r   rv   r-  r   r   r   r   r   r	   r   r`   )r   Zobject_constructorr   rE   re   re   rf   r     s    




r   c                 C   s   |du r| | | ndr4t|dr4| | | dS t|trLt | | nRt|trdt | | n:t|tjj	j
rt | | nt|trt | | ntdS )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.
    NFadd_multi_constructor)r2  rv   r-  r   r   r   r   r6   r7   rj   r   r   r	   r   r`   )Z
tag_prefixZmulti_constructorr   rE   re   re   rf   r2  	  s    


r2  c                 C   s   |du r| | | n~t|dr0| | | dS t|trHt | | nLt|tr`t | | n4t||rxt | | nt|trt	 | | nt
dS )z
    Add a representer for the given type.
    object_representer is a function accepting a Dumper instance
    and an instance of the given data type
    and producing the corresponding representation node.
    Nr   )r   rv   r-  r
   r   r   r   r   r   r   r`   )	data_typeZobject_representerr   r@   re   re   rf   r   #  s    




r   c                 C   s   |du r| | | n~t|dr0| | | dS t|trHt | | nLt|tr`t | | n4t||rxt | | nt|trt	 | | nt
dS )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)r4  rv   r-  r
   r   r   r   r   r   r   r`   )r3  Zmulti_representerr   r@   re   re   rf   r4  >  s    




r4  c                       s    e Zd ZdZ fddZ  ZS )YAMLObjectMetaclassz'
    The metaclass for YAMLObject.
    c                    sJ   t  ||| d|v rF|d d urF| j| j| j | j| | j d S )Nr   )	superrg   yaml_constructorr   r   r   yaml_representerr   r   )r   namebasesr&  r   re   rf   rg   ]  s    zYAMLObjectMetaclass.__init__)r   r   r   __doc__rg   __classcell__re   re   r;  rf   r5  X  s   r5  c                   @   s<   e Zd ZdZdZeZeZdZ	dZ
edd Zedd ZdS )
YAMLObjectza
    An object that can dump itself to a YAML stream
    and load itself from a YAML stream.
    re   Nc                 C   s   | || S )zC
        Convert a representation node to a Python object.
        r   )r   rE   r   re   re   rf   r   s  s    zYAMLObject.from_yamlc                 C   s   |j | j|| | jdS )zC
        Convert a Python object to a representation node.
        r   )r   r   yaml_flow_style)r   r@   r   re   re   rf   r   {  s    zYAMLObject.to_yaml)r   r   r   r<  	__slots__r   r7  r   r8  r   r?  classmethodr   r   re   re   re   rf   r>  e  s   
r>  )r   )NNN)NNN)N)N)NN)NN)N)N)_rr   r3   r  r   	importlibr   Zruamel.yamlr6   Zruamel.yaml.errorr   r   Zruamel.yaml.tokensZruamel.yaml.eventsZruamel.yaml.nodesZruamel.yaml.loaderr   r   r   r	   Zruamel.yaml.dumperr
   r   r   r   r  r   r   r   r   r   Zruamel.yaml.resolverr   r   Zruamel.yaml.representerr   r   r   r   Zruamel.yaml.constructorr   r   r   r   r  Zruamel.yaml.commentsr   r   r   ListSetDictUnionAnyCallableOptionalTextZ
StreamTypeZStreamTextTypeZVersionTypePathZ_ruamel_yamlr    r!   r"   r   r  r  r   r   r   r   r   r   r  r"  r%  r#  r   encr   r   r   r   r(  r*  r+  r,  r0  r   r2  r   r4  typer5  r>  re   re   re   rf   <module>   s   	      k&







)
8
K
/


2
"