관리-도구
편집 파일: serializer.cpython-36.pyc
3 <z�WE � @ sF d dgZ ddlmZ ddlT ddlT G dd� de�ZG dd � d �ZdS )� Serializer�SerializerError� )� YAMLError)�*c @ s e Zd ZdS )r N)�__name__� __module__�__qualname__� r r �"/usr/lib64/python3.6/serializer.pyr s c @ sJ e Zd ZdZddd�Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dS )r zid%03dNc C s: || _ || _|| _|| _|| _i | _i | _d| _d | _d S )N� ) �use_encoding�use_explicit_start�use_explicit_end�use_version�use_tags�serialized_nodes�anchors�last_anchor_id�closed)�self�encodingZexplicit_startZexplicit_end�version�tagsr r r �__init__ s zSerializer.__init__c C s@ | j d kr$| jt| jd�� d| _ n| j r4td��ntd��d S )N)r Fzserializer is closedzserializer is already opened)r �emitZStreamStartEventr r )r r r r �open s zSerializer.openc C s0 | j d krtd��n| j s,| jt� � d| _ d S )Nzserializer is not openedT)r r r ZStreamEndEvent)r r r r �close$ s zSerializer.closec C s| | j d krtd��n| j r"td��| jt| j| j| jd�� | j|� | j|d d � | jt | j d�� i | _i | _d| _ d S )Nzserializer is not openedzserializer is closed)�explicitr r )r r )r r r ZDocumentStartEventr r r �anchor_node�serialize_nodeZDocumentEndEventr r r r )r �noder r r � serialize. s zSerializer.serializec C s� || j kr*| j | d kr�| j|�| j |<