o
    wi                     @  s  d dl mZ d dlT d dlT d dlmZ d dlmZmZ d dlm	Z	m
Z
mZmZmZ d dlmZmZmZmZmZ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 d d	l m!Z! d d
l"m#Z# d dl$m%Z% d dl&Z&d dl'Z'd dl(Z(d dl)Z)d dl*Z*	 g dZ2G dd de3Z4G dd dZ5G dd de5Z6e67e8de6j9 e67e:e6j; e67e<e6j= e67e>e6j? e67e@e6jA e67eBe6jC e67eDe6jE e67eFe6jE e67eGe6jH e67eIe6jJ e67ee6jK e67e&jLe6jK e67e'jMe6jN e67e'j'e6jO e67de6jP G dd de6ZQeQ7eReQjS eQ7eFeQjT eQ7e8eQjU eQ7e(jVeQjU eQ7e(jWeQjU eQ7e(jXeQjY eQZe[eQj\ eQZe8eQjU G dd de6Z]e]7e8de]j9 e]7e	e]j^ e]7e
e]j_ e]7ee]j` e]7ee]ja e]7ee]jb e]7ee]jc e]7ee]jd e]7ee]je e]7ee]jf e]7ee]jg e]7ee]jh e]7e!e]ji e]7ee]jE e]7ee]jH e]7ee]jK e]7e&jLe]jK e]7ee]jJ e]7ee]jj e]7e#e]jO dS )    )annotations)*)ordereddict)nprintnprintf)LiteralScalarStringFoldedScalarStringSingleQuotedScalarStringDoubleQuotedScalarStringPlainScalarString)	CommentedMapCommentedOrderedMapCommentedSeqCommentedKeySeqCommentedKeyMapCommentedSetcomment_attribmerge_attribTaggedScalar)	ScalarInt	BinaryIntOctalIntHexInt
HexCapsInt)ScalarFloat)ScalarBoolean)	TimeStamp)AnchorNF)DictListAnyUnionTextOptional)BaseRepresenterSafeRepresenterRepresenterRepresenterErrorRoundTripRepresenterc                   @  s   e Zd ZdS )r'   N)__name__
__module____qualname__ r,   r,   T/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/ruamel/yaml/representer.pyr'   0   s    r'   c                   @  s   e Zd ZU i Zded< i Zded< 			d3d4ddZed5ddZd6ddZ	d7ddZ
d7ddZed8ddZed8ddZ	d9d:d"d#Z	d;d<d'd(Zd;d=d*d+Zd;d>d.d/Zd?d1d2ZdS )@r$   zDict[Any, Any]yaml_representersyaml_multi_representersNselfr    default_styledefault_flow_styledumperreturnNonec                 C  s@   || _ | j d ur| | j _|| _|| _i | _g | _d | _d| _d S )NT)r3   _representerr1   r2   represented_objectsobject_keeper	alias_key sort_base_mapping_type_on_outputr0   r1   r2   r3   r,   r,   r-   __init__9   s   

zBaseRepresenter.__init__c                 C  s8   zt | jdr| jjW S | jjW S  ty   |  Y S w )Ntyp)hasattrr3   
serializer_serializerAttributeError)r0   r,   r,   r-   r?   I   s   

zBaseRepresenter.serializerdatac                 C  s,   |  |}| j| i | _g | _d | _d S N)represent_datar?   	serializer7   r8   r9   )r0   rB   noder,   r,   r-   	representR   s
   

zBaseRepresenter.representc                 C  s   |  |r	d | _nt|| _| jd ur'| j| jv r!| j| j }|S | j| t|j}|d | jv r?| j|d  | |}|S |D ]}|| j	v rS| j	| | |} |S qAd | j	v rc| j	d  | |}|S d | jv rr| jd  | |}|S t
d t|}|S )Nr   )ignore_aliasesr9   idr7   r8   appendtype__mro__r.   r/   
ScalarNodestr)r0   rB   rF   
data_types	data_typer,   r,   r-   rD   Y   s4   







zBaseRepresenter.represent_datac                 C  s
   |  |S )a  
        David Fraser: Extract a method to represent keys in mappings, so that
        a subclass can choose not to quote them (for example)
        used in represent_mapping
        https://bitbucket.org/davidfraser/pyyaml/commits/d81df6eb95f20cac4a79eed95ae553b5c6f77b8c
        )rD   r0   rB   r,   r,   r-   represent_keyz   s   
zBaseRepresenter.represent_keyrP   representerc                 C  $   d| j vr| j | _|| j|< d S )Nr.   )__dict__r.   copyclsrP   rS   r,   r,   r-   add_representer      
zBaseRepresenter.add_representerc                 C  rT   )Nr/   )rU   r/   rV   rW   r,   r,   r-   add_multi_representer   rZ   z%BaseRepresenter.add_multi_representertagvaluestyleanchorrM   c                 C  s|   |d u r| j }d }|r|d dv rt|dd }|rd |gg}t|tr(t|d}t|||||d}| jd ur<|| j| j< |S )Nr   z|>commentsuffix)r^   r`   r_   )r1   getattr
isinstancerN   TagrM   r9   r7   )r0   r\   r]   r^   r_   r`   rF   r,   r,   r-   represent_scalar   s   



z BaseRepresenter.represent_scalarsequence
flow_styleSequenceNodec           	      C  s   g }t |trt|d}t|||d}| jd ur|| j| j< d}|D ]}| |}t |tr1|jr3d}|	| q"|d u rK| j
d urH| j
|_|S ||_|S )Nra   rh   TF)rd   rN   re   ri   r9   r7   rD   rM   r^   rJ   r2   rh   )	r0   r\   rg   rh   r]   rF   
best_styleitem	node_itemr,   r,   r-   represent_sequence   s$   




z"BaseRepresenter.represent_sequenceomapc           
      C  s   g }t |trt|d}t|||d}| jd ur|| j| j< d}|D ]}|| }| ||i}	||	 q"|d u rG| jd urD| j|_	|S ||_	|S )Nra   rj   T)
rd   rN   re   ri   r9   r7   rD   rJ   r2   rh   )
r0   r\   ro   rh   r]   rF   rk   item_keyitem_valrm   r,   r,   r-   represent_omap   s"   



zBaseRepresenter.represent_omapmappingMappingNodec                 C  s   g }t |trt|d}t|||d}| jd ur|| j| j< d}t|dr>t| }| j	r>zt
|}W n	 ty=   Y nw |D ])\}}| |}	| |}
t |	trV|	jrXd}t |
tr`|
jrbd}||	|
f q@|d u r|| jd ury| j|_|S ||_|S )Nra   rj   TitemsF)rd   rN   re   rt   r9   r7   r>   listru   r:   sorted	TypeErrorrR   rD   rM   r^   rJ   r2   rh   )r0   r\   rs   rh   r]   rF   rk   rp   
item_valuenode_key
node_valuer,   r,   r-   represent_mapping   s:   






z!BaseRepresenter.represent_mappingboolc                 C  s   dS NFr,   rQ   r,   r,   r-   rH      s   zBaseRepresenter.ignore_aliasesNNN)
r0   r    r1   r    r2   r    r3   r    r4   r5   )r4   r    rB   r    r4   r5   rB   r    r4   r    )rP   r    rS   r    r4   r5   )NN)
r\   r    r]   r    r^   r    r_   r    r4   rM   rC   r\   r    rg   r    rh   r    r4   ri   r\   r    ro   r    rh   r    r4   ri   r\   r    rs   r    rh   r    r4   rt   rB   r    r4   r}   )r)   r*   r+   r.   __annotations__r/   r<   propertyr?   rG   rD   rR   classmethodrY   r[   rf   rn   rr   r|   rH   r,   r,   r,   r-   r$   4   s.   
 


!	r$   c                   @  s   e Zd Zd.ddZd/dd	Zd0d
dZd/ddZd1d2ddZd/ddZdZ	e
e	e
e	e	 kr=e	e	9 Z	e
e	e
e	e	 ks/d/ddZd3ddZd4ddZd3ddZd4d d!Zd/d"d#Zd/d$d%Z	d1d5d)d*Zd6d,d-ZdS )7r%   rB   r    r4   r}   c                 C  s:   |d u st |tr|dkrdS t |tttttfrdS dS )Nr,   TF)rd   tuplebytesrN   r}   intfloatrQ   r,   r,   r-   rH      s
   zSafeRepresenter.ignore_aliasesrM   c                 C  s   |  ddS )Ntag:yaml.org,2002:nullnullrf   rQ   r,   r,   r-   represent_none      zSafeRepresenter.represent_nonec                 C     |  d|S )Ntag:yaml.org,2002:strr   rQ   r,   r,   r-   represent_str   r   zSafeRepresenter.represent_strc                 C  s<   t tdrt|d}nt|d}| jd|ddS )Nencodebytesasciiztag:yaml.org,2002:binary|)r^   )r>   base64r   decodeencodestringrf   rQ   r,   r,   r-   represent_binary   s   
z SafeRepresenter.represent_binaryNr_   Optional[Any]c                 C  sF   z
| j jt| }W n ty   |rd}nd}Y nw | jd||dS )Ntruefalseztag:yaml.org,2002:boolr_   )r3   boolean_representationr}   rA   rf   )r0   rB   r_   r]   r,   r,   r-   represent_bool  s   zSafeRepresenter.represent_boolc                 C  s   |  dt|S )Ntag:yaml.org,2002:int)rf   rN   rQ   r,   r,   r-   represent_int  s   zSafeRepresenter.represent_intgu <7~c                 C  s   ||ks|dkr|dkrd}n/|| j krd}n'|| j  kr d}nt| }t| jdd dkr>d|vr>d	|v r>|d	d
d}| d|S )N              ?.nan.inf-.infuse_version   r   .ez.0er   tag:yaml.org,2002:float)	inf_valuereprlowerrc   r?   replacerf   r0   rB   r]   r,   r,   r-   represent_float  s   
zSafeRepresenter.represent_floatri   c                 C  r   )Ntag:yaml.org,2002:seqrn   rQ   r,   r,   r-   represent_list-  s   zSafeRepresenter.represent_listrt   c                 C  r   )Ntag:yaml.org,2002:mapr|   rQ   r,   r,   r-   represent_dict=  r   zSafeRepresenter.represent_dictc                 C  r   )Nztag:yaml.org,2002:omap)rr   rQ   r,   r,   r-   represent_ordereddict@  r   z%SafeRepresenter.represent_ordereddictc                 C  s"   i }|D ]}d ||< q|  d|S )Ntag:yaml.org,2002:setr   )r0   rB   r]   keyr,   r,   r-   represent_setC  s   
zSafeRepresenter.represent_setc                 C  s   |  }| d|S )Ntag:yaml.org,2002:timestamp	isoformatrf   r   r,   r,   r-   represent_dateI  s   zSafeRepresenter.represent_datec                 C  s   | d}| d|S )N r   r   r   r,   r,   r-   represent_datetimeM  s   
z"SafeRepresenter.represent_datetimer\   rX   rh   c                 C  s.   t |dr
| }n|j }| j|||dS N__getstate__rj   )r>   r   rU   rV   r|   )r0   r\   rB   rX   rh   stater,   r,   r-   represent_yaml_objectQ  s   


z%SafeRepresenter.represent_yaml_objectr5   c                 C  s   t d|)Nzcannot represent an object: )r'   rQ   r,   r,   r-   represent_undefinedZ  s   z#SafeRepresenter.represent_undefinedr   rB   r    r4   rM   r   rC   )rB   r    r_   r   r4   rM   rB   r    r4   ri   rB   r    r4   rt   )
r\   r    rB   r    rX   r    rh   r    r4   rt   r   )r)   r*   r+   rH   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r,   r,   r,   r-   r%      s*    













	r%   c                   @  s>   e Zd ZdddZdddZdd
dZdddZdddZdS )r&   rB   r    r4   c                 C  sl   |j dkrt|j}n%|jdkr|j d}n|j dkr'|jd|j d}n	|j|j d}| d|S )Nr   jr   +z tag:yaml.org,2002:python/complex)imagr   realrf   rQ   r,   r,   r-   represent_complex  s   


zRepresenter.represent_complexri   c                 C  r   )Nztag:yaml.org,2002:python/tupler   rQ   r,   r,   r-   represent_tuple  r   zRepresenter.represent_tuplerM   c                 C  sL   z|j d|j}W n ty   |j d|j}Y nw | d| dS )Nr   ztag:yaml.org,2002:python/name: )r*   r+   rA   r)   rf   )r0   rB   namer,   r,   r-   represent_name  s   zRepresenter.represent_namec                 C  s   |  d|j dS )Nz tag:yaml.org,2002:python/module:r   )rf   r)   rQ   r,   r,   r-   represent_module  s   zRepresenter.represent_module Union[SequenceNode, MappingNode]c                 C  s  t |}|tjv rtj| |}nt|dr|d}nt|dr&| }ntd|t|d gd  d d }|\}}}}}t|}|d u rKi }|d urSt|}|d ur[t|}|j	dkro|d }|dd  }d	}	d
}
nd}	d}
z|j
d|j}W n ty   |j
d|j	}Y nw |s|s|st|tr|
r| d| |S |s|st|tr|s| |	| |S i }|r||d< |st|ts||d< |r||d< |r||d< | |	| |S )N__reduce_ex__   
__reduce__zcannot represent object:    
__newobj__r   r   z$tag:yaml.org,2002:python/object/new:Tz&tag:yaml.org,2002:python/object/apply:Fr   z tag:yaml.org,2002:python/object:argsr   	listitems	dictitems)rK   copyregdispatch_tabler>   r   r   r'   rv   dictr)   r*   r+   rA   rd   r|   rn   )r0   rB   rX   reducefunctionr   r   r   r   r\   newobjfunction_namer]   r,   r,   r-   represent_object  sZ   




zRepresenter.represent_objectNr   r   r   )rB   r    r4   r   )r)   r*   r+   r   r   r   r   r   r,   r,   r,   r-   r&     s    



r&   c                   @  s2  e Zd Z	dQdRdd	ZdSddZdTddZdTddZeZdTddZdTddZ	dTddZ
dTddZ	dUdVdd ZdTd!d"ZdTd#d$ZdTd%d&ZdTd'd(ZdTd)d*ZdTd+d,Z	dUdWd1d2ZdXd5d6ZdYd7d8ZdUdZd;d<ZdUd[d>d?Zd\dAdBZd]dCdDZd^dEdFZdTdGdHZdTdIdJZdTdKdLZ	dUd_dOdPZdS )`r(   Nr1   r    r2   r3   r4   r5   c                 C  s,   t |ds|d u rd}tj| |||d d S )Nr=   F)r1   r2   r3   )r>   r%   r<   r;   r,   r,   r-   r<     s   
zRoundTripRepresenter.__init__rB   r}   c                 C  s@   z|j d ur|j jd urW dS W n	 ty   Y nw t| |S r~   )r_   r]   rA   r%   rH   rQ   r,   r,   r-   rH     s   z#RoundTripRepresenter.ignore_aliasesrM   c                 C  s.   t | jdkr| jjs| ddS | ddS )Nr   r   r   r   )lenr7   r?   use_explicit_startrf   rQ   r,   r,   r-   r     s   z#RoundTripRepresenter.represent_nonec                 C  *   d }d}|j dd}d}| j||||dS )Nr   Tanyr   r^   r_   yaml_anchorrf   r0   rB   r\   r^   r_   r,   r,   r-   represent_literal_scalarstring
  
   z3RoundTripRepresenter.represent_literal_scalarstringc                 C  s   d }d}|j dd}tt|dg D ]0}|| dkrB|dkrB||d   sB|t|k rB||d   sB|d | d ||d   }qd	}| j||||d
S )N>Tr   fold_posr   r   r   r   r   )r   reversedrc   isspacer   rf   )r0   rB   r\   r^   r_   r   r,   r,   r-   represent_folded_scalarstring  s   z2RoundTripRepresenter.represent_folded_scalarstringc                 C  r   )N'Tr   r   r   r   r   r,   r,   r-   $represent_single_quoted_scalarstring!  r   z9RoundTripRepresenter.represent_single_quoted_scalarstringc                 C  r   )N"Tr   r   r   r   r   r,   r,   r-   $represent_double_quoted_scalarstring(  r   z9RoundTripRepresenter.represent_double_quoted_scalarstringc                 C  r   )Nr   Tr   r   r   r   r   r,   r,   r-   represent_plain_scalarstring/  r   z1RoundTripRepresenter.represent_plain_scalarstringprefixs
underscorer_   c                 C  s   |d u r| j d|| |dS |d r7t|}t||d  }|dkr2||d ||d 8 }|dks"d|}|d r?d| }|d rG|d7 }| j d|| |dS )Nr   r   r   _r   r   r   )rf   rv   r   insertjoin)r0   r   r   r   r_   slposr,   r,   r-   insert_underscore6  s   
z&RoundTripRepresenter.insert_underscorec                 C  H   |j d ur|d|j  d}nt|d}|jdd}| jd||j|dS )N0dTr   r   r   _widthformatr   r  _underscorer0   rB   r   r_   r,   r,   r-   represent_scalar_intH  s
   

z)RoundTripRepresenter.represent_scalar_intc                 C  r  )Nr  bTr   0br   r
  r  r,   r,   r-   represent_binary_intP  
   

z)RoundTripRepresenter.represent_binary_intc                 C  sb   |j d ur|d|j  d}nt|d}|jdd}d}t| jdd dkr'd}| j|||j|dS )	Nr  oTr   0or   r   r   )r  r  r   rc   r?   r  r  )r0   rB   r   r_   r   r,   r,   r-   represent_octal_intY  s   

z(RoundTripRepresenter.represent_octal_intc                 C  r  )Nr  xTr   0xr   r
  r  r,   r,   r-   represent_hex_inte  r  z&RoundTripRepresenter.represent_hex_intc                 C  r  )Nr  XTr   r  r   r
  r  r,   r,   r-   represent_hex_caps_intn  r  z+RoundTripRepresenter.represent_hex_caps_intc                 C  sD  d}|j dd}||ks|dkr|dkrd}n|| jkrd}n|| j kr'd}|r1| jd	||d
S |jdu rW|jdkrW|j|jd krW|jrI|jnd tt|dd}n|jdu r|j}|jre|jnd}|dk r| tt|d|jt	|  d}n,| t|d|jt	|  d|j| d  d}|dks|dkr|dkr|
dd}t	||jk r|d7 }t	||jk snO||j d|j|jrdnd  dd\}}|jdkr|jn|jd }|dk r|d7 }|d| }t|}	|d\}
}t	|
t	| |j|jdkrdnd k r.|d7 }t	|
t	| |j|jdkr)dnd k s|jr;|dkr;d|
 }
|jrAdnd}|jdk r|dkrU|	t	|8 }	nd}t	|
t	| |jrddnd |jk r|d7 }|	d8 }	t	|
t	| |jrdnd |jk sk|
| |j |	| d|j d }nu|jdkr|	t	|8 }	|
| d |j |	| d|j d }nT|jdkrd|jd  |
 | }d}
|d|j  }|	|j7 }	t	|
|jk r|
|d 7 }
|dd }|	d8 }	t	|
|jk s|
d | |j |	| d|j d }|du rt| }| jd	||d
S )z this is way more complicated NTr   r   r   r   r   r   r   r   r   r   r   r	  r   r  fz0.r   r   )r   r   rf   _exp_precr  _m_signabsr   r   r   split_e_sign_e_width_m_lead0r   r   )r0   rB   r]   r_   precmsmeswr   m1m2esgnr,   r,   r-   represent_scalar_floatw  s   
$(
*4*,,
((&*
(
z+RoundTripRepresenter.represent_scalar_floatr\   rg   rh   ri   c                 C  s  g }z|j |}W n ty   |}Y nw z| }W n ty'   d }Y nw t|tr2t|d}t||||d}| jd urE|| j	| j< d}zbt
|t}|j|_|jre|jd re|jd D ]}	|	  q^|j}
|
 D ]}|r|d r|d D ]}	|	  qxql|j}
|jd u r|j|_n|jd d  |_z	|j|j W n	 ty   Y nw W n ty   i }
Y nw t|D ]!\}}| |}| ||
| t|tr|jrd}|| q|d u rt|dkr| jd ur| j|_|S ||_|S )Nra   rh   r_   Tr   Fr   )farh   rA   r   rd   rN   re   ri   r9   r7   rc   r   r`   resetru   valuesrJ   end	enumeraterD   merge_commentsgetrM   r^   r   r2   )r0   r\   rg   rh   r]   r_   rF   rk   r`   ctitem_commentsvidxrl   rm   r,   r,   r-   rn     sl   








z'RoundTripRepresenter.represent_sequencerF   commentsc                 C  s   |d u rt |dsJ |S t|dd d ur=t|D ]#\}}|t|jkr%q|j| }|d ur<|d u s8||ks8J |||< q||_|S )Nr`   )r>   rc   r3  r   r`   )r0   rF   r:  r9  valncr,   r,   r-   r4    s   
z#RoundTripRepresenter.merge_commentsc                 C  sL   t |trd | _| jd|ddS t |tr d | _| jd|ddS t| |S )Nr   Trj   r   )rd   r   r9   rn   r   r|   r%   rR   rQ   r,   r,   r-   rR   	  s   

z"RoundTripRepresenter.represent_keyrs   rt   c                 C  s(  g }z|j |}W n ty   |}Y nw z| }W n ty'   d }Y nw t|tr2t|d}t||||d}| jd urE|| j	| j< d}zbt
|t}|jd u rW|j|_n|jd d  |_|jrs|jd rs|jd D ]}	|	  ql|j}
| jjd u r|
 D ]}|r|d r|d D ]}	|	  qqz	|j|j W n
 ty   Y nw 	 W n ty   i }
Y nw dd t
|tg D }zt
|tdggd d }W n ty   d}Y nw d}t|r| }n| }|D ]_\}}|d7 }| |}| |}|
|}|r+|d d |_t
|d	d }|d ur$|d |d< |d
 |d< n|dd  |_t|tr5|jr7d}t|trA|jrCd}|||f q|d u rh|dksZt|re| jd ure| j|_n||_t|rt|dkr|| |d }n| |}d|_||ttddd|f |S )Nra   r.  Tr   c                 S  s   g | ]}|d  qS )r   r,   ).0r'  r,   r,   r-   
<listcomp><  s    z:RoundTripRepresenter.represent_mapping.<locals>.<listcomp>r   r   r`      Fztag:yaml.org,2002:mergez<<) r/  rh   rA   r   rd   rN   re   rt   r9   r7   rc   r   r`   r0  ru   r3   comment_handlingr1  rJ   r2  r   
IndexErrorr}   non_merged_itemsrR   rD   r5  rM   r^   r2   r   r  )r0   r\   rs   rh   r]   r_   rF   rk   r`   r6  r7  r8  
merge_list	merge_pos
item_countru   rp   ry   rz   r{   item_commentnvcargr,   r,   r-   r|     s   













 


z&RoundTripRepresenter.represent_mappingro   c                 C  s`  g }z|j |}W n ty   |}Y nw z| }W n ty'   d }Y nw t|tr2t|d}t||||d}| jd urE|| j	| j< d}z[t
|t}|jd u rW|j|_n|jd d  |_|jrs|jd rs|jd D ]}	|	  ql|j}
|
 D ]}|r|d r|d D ]}	|	  qqzz	|j|j W n	 ty   Y nw W n ty   i }
Y nw |D ]i}|| }| ||i}|
|}|r|d rd |d g|_t
|jd d dd d u sJ |d d g|jd d _t
|jd d dd }|d ur|d |d< |d |d< n|dd  |jd d _|| q|d u r.| jd ur+| j|_|S ||_|S )	Nra   r.  Tr   r   r`   r   r?  )r/  rh   rA   r   rd   rN   re   ri   r9   r7   rc   r   r`   r0  ru   r1  rJ   r2  rD   r5  r]   r2   )r0   r\   ro   rh   r]   r_   rF   rk   r`   r6  r7  r8  rp   rq   rm   rF  rG  r,   r,   r-   rr   m  sz   










z#RoundTripRepresenter.represent_omapsettingc                 C  s  d}t dd}g }|j|}z| }W n ty    d }Y nw t||||d}| jd ur4|| j| j< d}z[t|t	}|j
d u rF|j
|_
n|j
d d  |_
|j
rb|j
d rb|j
d D ]}	|	  q[|j}
|
 D ]}|r||d r||d D ]}	|	  quqiz	|j
|j W n	 ty   Y nw W n ty   i }
Y nw |jD ]I}| |}| d }|
|}|rt|dd d u sJ |d d |_
d	|_|rd
nd	|_t|tr|jrd}t|tr|jrd}|||f q|}|S )NFr   ra   r.  Tr   r`   r   ?-)re   r/  rh   r   rA   rt   r9   r7   rc   r   r`   r0  ru   r1  rJ   r2  odictrR   rD   r5  r^   rd   rM   )r0   rI  rh   r\   r]   r_   rF   rk   r`   r6  r7  r8  rp   rz   r{   rF  r,   r,   r-   r     sh   










z"RoundTripRepresenter.represent_setc                 C  sv   z|j }W n ty   tdd}Y n"w |j jr0|j dr,td|j jdd  d}n	|j }ntdd}| ||S )z!write out tag if saved on loadingr   ra   !!tag:yaml.org,2002:r   N)r\   rA   re   trval
startswithr|   r0   rB   r  r\   r,   r,   r-   r     s   

z#RoundTripRepresenter.represent_dictc                 C  sv   z|j }W n ty   tdd}Y n"w |j jr0|j dr,td|j jdd   d}n	|j }ntdd}| ||S )Nr   ra   rM  rN  r   )r\   rA   re   rO  rP  rn   rQ  r,   r,   r-   r     s   

z#RoundTripRepresenter.represent_listc                 C  sh   |j d rdnd}|j }	 || }	 |jr.t|jr.|d dv r.|d d t|j }| d	|S )
NtTr   Fdeltatziz+-r   )_yamlr   striptzinforN   rf   )r0   rB   interrV  r]   r,   r,   r-   r     s   z'RoundTripRepresenter.represent_datetimec                 C  s   z|j jdkr|j j d|j j }n|j }W n ty"   d }Y nw z| }W n ty4   d }Y nw | j||j|j|dS )NrM  r   r   )r\   handlerb   rA   r   rf   r]   r^   )r0   rB   r\   r_   r,   r,   r-   represent_tagged_scalar  s   z,RoundTripRepresenter.represent_tagged_scalarc                 C  s4   z|  }W n ty   d }Y nw tj| ||dS )Nr   )r   rA   r%   r   )r0   rB   r_   r,   r,   r-   represent_scalar_bool  s   z*RoundTripRepresenter.represent_scalar_boolrX   r   c                 C  sN   t |dr
| }n|j }|tjd }| j|||d}|d ur%||_|S r   )	r>   r   rU   rV   popr   attribr|   r_   )r0   r\   rB   rX   rh   r   r_   resr,   r,   r-   r   &  s   


z*RoundTripRepresenter.represent_yaml_objectr   )r1   r    r2   r    r3   r    r4   r5   r   r   rC   )
r   r    r   r    r   r    r_   r    r4   rM   r   )rF   r    r:  r    r4   r    r   r   r   )rI  r    r4   rt   r   r   )
r\   r    rB   r    rX   r    rh   r   r4   rt   )r)   r*   r+   r<   rH   r   r    represent_preserved_scalarstringr   r   r   r   r  r  r  r  r  r  r-  rn   r4  rR   r|   rr   r   r   r   r   r[  r\  r   r,   r,   r,   r-   r(     sB    









	

	
	J
:
	[
A
5



r(   )k
__future__r   ruamel.yaml.errorruamel.yaml.nodesruamel.yaml.compatr   r   r   ruamel.yaml.scalarstringr   r   r	   r
   r   ruamel.yaml.commentsr   r   r   r   r   r   r   r   r   ruamel.yaml.scalarintr   r   r   r   r   ruamel.yaml.scalarfloatr   ruamel.yaml.scalarboolr   ruamel.yaml.timestampr   ruamel.yaml.anchorr   collectionsdatetimetypesr   r   typingr   r   r    r!   r"   r#   __all__	YAMLErrorr'   r$   r%   rY   rK   r   rN   r   r   r   r}   r   r   r   r   r   rv   r   r   r   r   setr   r   OrderedDictdater   r   r   r&   complexr   r   r   FunctionTypeBuiltinFunctionType
ModuleTyper   r[   objectr   r(   r   r   r   r   r   r  r  r  r  r  r-  r\  r[  r,   r,   r,   r-   <module>   s   , ;p\    L