a
    ø£Be  ã                   @  sÊ   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z
 ddlmZ zddlmZ ddlmZ W n" ey‚   dd	lmZmZ Y n0 d
d
dœdd„Zd
ddœdd„Zdd
dœdd„Zd
dddœdd„Z	dS )zYaml utilities.é    )Úannotations)ÚPathÚPurePath)ÚAny)Údump)Úload)ÚCSafeDumper)ÚCSafeLoader)Ú
SafeDumperÚ
SafeLoaderr   )ÚstreamÚreturnc                 C  s   t | td�S )zLoad yaml from a stream.)ÚLoader)Úyloadr   ©r   © r   úV/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/jupyter_events/yaml.pyÚloads   s    r   Ústrc                 C  s   t | td�S )z7Parse the first YAML document in a stream as an object.)ZDumper)Úydumpr
   r   r   r   r   Údumps   s    r   zstr | PurePath)Úfpathr   c                 C  s   t t| ƒƒjdd�}t|ƒS )zLoad yaml from a file.úutf-8©Úencoding)r   r   Ú	read_textr   )r   Údatar   r   r   r      s    r   ÚNone)r   Úoutpathr   c                 C  s   t |ƒjt| ƒdd� dS )z1Parse the a YAML document in a file as an object.r   r   N)r   Ú
write_textr   )r   r   r   r   r   r   "   s    r   N)Ú__doc__Ú
__future__r   Úpathlibr   r   Útypingr   Úyamlr   r   r   r   r   r
   r	   r   ÚImportErrorr   r   r   r   r   r   Ú<module>   s   