3
QfX%                 @   s  d dl T d dlT d dlT d dlT d dlT d dlT dZyd dlT dZW n e	k
r\   dZY nX ddl
Z
efddZefd	d
ZefddZefddZefddZefddZdd Zdd ZdedddddfddZdeddddddddddfddZdefddZdeddddddddddddfddZdefdd Zd6d!d"Zd7d#d$Zdeefd%d&Zdeefd'd(Zefd)d*Zefd+d,Zefd-d.Z efd/d0Z!G d1d2 d2e"Z#G d3d4 d4e#d5Z$dS )8   )*z3.10TF    Nc          
   c   s4   || }zx|j  r |j V  qW W d|j  X dS )z9
    Scan a YAML stream and produce scanning tokens.
    N)Zcheck_tokenZ	get_tokendispose)streamLoaderloader r   V/home/psgendb/BIRCHDEV/pkg/SPAdes-3.15.4/linux-x86_64/share/spades/pyyaml3/__init__.pyscan   s
    
r
   c          
   c   s4   || }zx|j  r |j V  qW W d|j  X dS )z9
    Parse a YAML stream and produce parsing events.
    N)Zcheck_eventZ	get_eventr   )r   r   r   r   r   r	   parse   s
    
r   c          
   C   s    || }z|j  S |j  X dS )zj
    Parse the first YAML document in a stream
    and produce the corresponding representation tree.
    N)Zget_single_noder   )r   r   r   r   r   r	   compose*   s    r   c          
   c   s4   || }zx|j  r |j V  qW W d|j  X dS )zb
    Parse all YAML documents in a stream
    and produce corresponding representation trees.
    N)Z
check_nodeZget_noder   )r   r   r   r   r   r	   compose_all5   s
    
r   c          
   C   s    || }z|j  S |j  X dS )zd
    Parse the first YAML document in a stream
    and produce the corresponding Python object.
    N)Zget_single_datar   )r   r   r   r   r   r	   loadA   s    r   c          
   c   s4   || }zx|j  r |j V  qW W d|j  X dS )z\
    Parse all YAML documents in a stream
    and produce corresponding Python objects.
    N)Z
check_dataget_datar   )r   r   r   r   r   r	   load_allL   s
    
r   c             C   s
   t | tS )z
    Parse the first YAML document in a stream
    and produce the corresponding Python object.
    Resolve only basic YAML tags.
    )r   
SafeLoader)r   r   r   r	   	safe_loadX   s    r   c             C   s
   t | tS )z~
    Parse all YAML documents in a stream
    and produce corresponding Python objects.
    Resolve only basic YAML tags.
    )r   r   )r   r   r   r	   safe_load_all`   s    r   c          
   C   sd   d}|dkrt j }|j}|||||||d}	zx| D ]}
|	j|
 q6W W d|	j  X |r`| S dS )zl
    Emit YAML parsing events into a stream.
    If stream is None, return the produced string instead.
    N)	canonicalindentwidthallow_unicode
line_break)ioStringIOgetvalueemitr   )eventsr   Dumperr   r   r   r   r   r   dumpereventr   r   r	   r   h   s    



r   c             C   s   d}|dkr,|dkrt j }nt j }|j}|||||||||||	|
d}z,|j  x| D ]}|j| qZW |j  W d|j  X |r| S 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   r   r   encodingversiontagsexplicit_startexplicit_end)r   r   BytesIOr   open	serializecloser   )nodesr   r   r   r   r   r   r   r!   r$   r%   r"   r#   r   r   noder   r   r	   serialize_all}   s$    	




r,   c             K   s   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   kwdsr   r   r	   r(      s    r(   c             C   s   d}|dkr,|
dkrt j }nt j }|j}|||||||||	|
||||d}z,|j  x| D ]}|j| q^W |j  W d|j  X |r| S dS )z
    Serialize a sequence of Python objects into a YAML stream.
    If stream is None, return the produced string instead.
    N)default_styledefault_flow_styler   r   r   r   r   r!   r"   r#   r$   r%   )r   r   r&   r   r'   Z	representr)   r   )	documentsr   r   r.   r/   r   r   r   r   r   r!   r$   r%   r"   r#   r   r   datar   r   r	   dump_all   s(    




r2   c             K   s   t | g|fd|i|S )zr
    Serialize a Python object into a YAML stream.
    If stream is None, return the produced string instead.
    r   )r2   )r1   r   r   r-   r   r   r	   dump   s    r3   c             K   s   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.
    r   )r2   
SafeDumper)r0   r   r-   r   r   r	   safe_dump_all   s    r5   c             K   s   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.
    r   )r2   r4   )r1   r   r-   r   r   r	   	safe_dump   s    r6   c             C   s    |j | || |j | || 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)tagZregexpfirstr   r   r   r   r	   r7      s    r7   c             C   s    |j | || |j | || 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)r8   pathZkindr   r   r   r   r	   r:      s    r:   c             C   s   |j | | dS )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)add_constructor)r8   constructorr   r   r   r	   r<      s    r<   c             C   s   |j | | 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.
    N)add_multi_constructor)Z
tag_prefixZmulti_constructorr   r   r   r	   r>      s    r>   c             C   s   |j | | dS )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_typeZrepresenterr   r   r   r	   r?      s    r?   c             C   s   |j | | 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)r@   Zmulti_representerr   r   r   r	   rA   	  s    rA   c                   s    e Zd ZdZ fddZ  ZS )YAMLObjectMetaclassz'
    The metaclass for YAMLObject.
    c                sN   t t| j||| d|krJ|d d k	rJ| jj| j| j | jj| | j	 d S )Nyaml_tag)
superrB   __init__yaml_loaderr<   rC   	from_yamlyaml_dumperr?   to_yaml)clsnamebasesr-   )	__class__r   r	   rE     s    zYAMLObjectMetaclass.__init__)__name__
__module____qualname____doc__rE   __classcell__r   r   )rM   r	   rB     s   rB   c               @   s<   e Zd ZdZf 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.
    Nc             C   s   |j || S )zC
        Convert a representation node to a Python object.
        )Zconstruct_yaml_object)rJ   r   r+   r   r   r	   rG   *  s    zYAMLObject.from_yamlc             C   s   |j | j|| | jdS )zC
        Convert a Python object to a representation node.
        )Z
flow_style)Zrepresent_yaml_objectrC   yaml_flow_style)rJ   r   r1   r   r   r	   rI   1  s    zYAMLObject.to_yaml)rN   rO   rP   rQ   	__slots__r   rF   r   rH   rC   rT   classmethodrG   rI   r   r   r   r	   rS     s   rS   )	metaclass)N)N)%errortokensr   r*   r   r   __version__ZcyamlZ__with_libyaml__ImportErrorr   r   r
   r   r   r   r   r   r   r   r   r   r,   r(   r2   r3   r5   r6   r7   r:   r<   r>   r?   rA   typerB   rS   r   r   r   r	   <module>   s^   




			
