Your IP : 3.138.102.163


Current Path : /usr/lib64/python3.6/site-packages/yaml/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/yaml/__pycache__/serializer.cpython-36.pyc

3

<z�WE�@sFddgZddlmZddlTddlTGdd�de�ZGdd�d�ZdS)�
Serializer�SerializerError�)�	YAMLError)�*c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�"/usr/lib64/python3.6/serializer.pyrsc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)rzid%03dNcCs:||_||_||_||_||_i|_i|_d|_d|_dS)N�)	�use_encoding�use_explicit_start�use_explicit_end�use_version�use_tags�serialized_nodes�anchors�last_anchor_id�closed)�self�encodingZexplicit_startZexplicit_end�version�tagsr	r	r
�__init__szSerializer.__init__cCs@|jdkr$|jt|jd��d|_n|jr4td��ntd��dS)N)rFzserializer is closedzserializer is already opened)r�emitZStreamStartEventrr)rr	r	r
�opens

zSerializer.opencCs0|jdkrtd��n|js,|jt��d|_dS)Nzserializer is not openedT)rrrZStreamEndEvent)rr	r	r
�close$s


zSerializer.closecCs||jdkrtd��n|jr"td��|jt|j|j|jd��|j|�|j|dd�|jt	|j
d��i|_i|_d|_
dS)Nzserializer is not openedzserializer is closed)�explicitrr)rr)rrrZDocumentStartEventr
rr�anchor_node�serialize_nodeZDocumentEndEventrrrr)r�noder	r	r
�	serialize.s



zSerializer.serializecCs�||jkr*|j|dkr�|j|�|j|<nbd|j|<t|t�rZxL|jD]}|j|�qFWn2t|t�r�x&|jD]\}}|j|�|j|�qlWdS)N)r�generate_anchor�
isinstance�SequenceNode�valuer�MappingNode)rr �item�keyr%r	r	r
r<s




zSerializer.anchor_nodecCs|jd7_|j|jS)Nr)r�ANCHOR_TEMPLATE)rr r	r	r
r"JszSerializer.generate_anchorcCs�|j|}||jkr&|jt|���njd|j|<|j||�t|t�r�|jt|jd�}|jt|jd�}|j	|k|j	|kf}|jt
||j	||j|jd��n�t|t��r|j	|jt|jd�k}|jt
||j	||jd��d}x$|jD]}|j|||�|d7}q�W|jt��nzt|t��r�|j	|jt|jd�k}|jt||j	||jd��x0|jD]&\}	}
|j|	|d�|j|
||	��qRW|jt��|j�dS)	NTF)�style)�
flow_stylerr)TF)FT)rrrZ
AliasEventZdescend_resolverr#Z
ScalarNodeZresolver%�tagZScalarEventr*r$ZSequenceStartEventr+rZSequenceEndEventr&ZMappingStartEventZMappingEndEventZascend_resolver)rr �parent�index�aliasZdetected_tagZdefault_tagZimplicitr'r(r%r	r	r
rNs>



zSerializer.serialize_node)NNNNN)rrrr)rrrr!rr"rr	r	r	r
rs
	
N)�__all__�errorrZeventsZnodesrrr	r	r	r
�<module>s


?>