a
    h%                     @   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zd dlT dZW n e	yZ   dZY n0 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   s8   || }z |  r| V  q
W |  n
|  0 dS )z9
    Scan a YAML stream and produce scanning tokens.
    N)Zcheck_tokenZ	get_tokendisposestreamLoaderloader r	   _/home/psgendb/BIRCHDEV/install/SPAdes-4.2.0-Linux/linux-x86_64/share/spades/pyyaml3/__init__.pyscan   s
    r   c                 c   s8   || }z |  r| V  q
W |  n
|  0 dS )z9
    Parse a YAML stream and produce parsing events.
    N)Zcheck_eventZ	get_eventr   r   r	   r	   r
   parse   s
    r   c                 C   s*   || }z|  W |  S |  0 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
   compose*   s    r   c                 c   s8   || }z |  r| V  q
W |  n
|  0 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
   compose_all5   s
    r   c                 C   s*   || }z|  W |  S |  0 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
   loadA   s    r   c                 c   s8   || }z |  r| V  q
W |  n
|  0 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
   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   sh   d}|du rt  }|j}|||||||d}	z | D ]}
|	|
 q4W |	  n
|	  0 |rd| 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u r,|du rt  }nt  }|j}|||||||||||	|
d}z0|  | D ]}|| qX|  W |  n
|  0 |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u r,|
du rt  }nt  }|j}|||||||||	|
||||d}z0|  | D ]}|| q\|  W |  n
|  0 |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    r0   r1   r   r   r   r   r   r#   r&   r'   r$   r%   r   r!   datar	   r	   r
   dump_all   s*    


r4   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    )r4   )r3   r   r    r/   r	   r	   r
   dump   s    r5   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    r4   Z
SafeDumper)r2   r   r/   r	   r	   r
   safe_dump_all   s    r7   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    r6   )r3   r   r/   r	   r	   r
   	safe_dump   s    r8   c                 C   s    | | || | | || 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
   r9      s    r9   c                 C   s    | | || | | || 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)r:   pathkindr   r    r	   r	   r
   r<      s    r<   c                 C   s   | | | 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)r:   constructorr   r	   r	   r
   r?      s    r?   c                 C   s   | | | 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
   rA      s    rA   c                 C   s   | | | 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
   rB      s    rB   c                 C   s   | | | 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)rC   Zmulti_representerr    r	   r	   r
   rD   	  s    rD   c                       s    e Zd ZdZ fddZ  ZS )YAMLObjectMetaclassz'
    The metaclass for YAMLObject.
    c                    sN   t t| ||| d|v rJ|d d urJ| j| j| j | j| | j	 d S )Nyaml_tag)
superrE   __init__yaml_loaderr?   rF   	from_yamlyaml_dumperrB   to_yaml)clsnamebasesr/   	__class__r	   r
   rH     s    zYAMLObjectMetaclass.__init__)__name__
__module____qualname____doc__rH   __classcell__r	   r	   rP   r
   rE     s   rE   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.
    r	   Nc                 C   s   | || S )zC
        Convert a representation node to a Python object.
        )Zconstruct_yaml_object)rM   r   r-   r	   r	   r
   rJ   *  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_objectrF   yaml_flow_style)rM   r!   r3   r	   r	   r
   rL   1  s    zYAMLObject.to_yaml)rR   rS   rT   rU   	__slots__r   rI   r    rK   rF   rX   classmethodrJ   rL   r	   r	   r	   r
   rW     s   
rW   )	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*   r4   r5   r7   r8   r9   r<   r?   rA   rB   rD   typerE   rW   r	   r	   r	   r
   <module>   sf   



!



			
