a
    =_                     @   s   d Z ddlmZ dZdd Zdd Zdd	 Zd
d Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$S )%aS  Support for undoing and redoing actions.

Functions:

* undo(file, operation, *args)
* redo(file, operation, *args)
* move_to_shadow(file, path)
* move_from_shadow(file, path)
* attr_to_shadow(file, path, name)
* attr_from_shadow(file, path, name)

Misc variables:

`__docformat__`
    The format of documentation strings in this module.

   )
split_pathZreStructuredTextc                 G   s   |dkrt | |d  n~|dkr0t| |d  nf|dkrNt| |d |d  nH|dkrlt| |d |d  n*|dkrt| |d |d  ntd| d S )	NCREATE    REMOVEMOVEr   ADDATTRDELATTRzWthe requested unknown operation %r can not be undone; please report this to the authors)undo_createundo_remove	undo_moveundo_add_attrundo_del_attrNotImplementedErrorfile_Z	operationargs r   .lib/python3.9/site-packages/tables/undoredo.pyundo'   s    r   c                 G   s   |dkrt | |d  n~|dkr0t| |d  nf|dkrNt| |d |d  nH|dkrlt| |d |d  n*|dkrt| |d |d  ntd| d S )	Nr   r   r   r   r   r   r   zWthe requested unknown operation %r can not be redone; please report this to the authors)redo_createredo_remove	redo_moveredo_add_attrredo_del_attrr   r   r   r   r   redo8   s    r   c                 C   s&   |  |}|  \}}||| d S N)	_get_node_shadow_name_g_move)r   pathnodeshparentshnamer   r   r   move_to_shadowI   s    
r#   c                 C   s<   |   \}}||}t|\}}| |}||| d S r   )r   Z_f_get_childr   r   r   )r   r   r!   r"   r    Zpnamenameparentr   r   r   move_from_shadowQ   s
    

r&   c                 C   s   t | | d S r   r#   r   r   r   r   r   r	   [   s    r	   c                 C   s   t | | d S r   r&   r(   r   r   r   r   `   s    r   c                 C   s   t | | d S r   r)   r(   r   r   r   r
   e   s    r
   c                 C   s   t | | d S r   r'   r(   r   r   r   r   j   s    r   c                 C   s0   t |\}}| |}| |}||| d S r   r   r   r   )r   origpathdestpathZ	origpnameZorignamer    Z
origparentr   r   r   r   o   s    

r   c                 C   s0   t |\}}| |}| |}||| d S r   r*   )r   r+   r,   Z	destpnameZdestnamer    Z
destparentr   r   r   r   x   s    

r   c           	      C   sN   |  |}|j}t||}|  \}}|j}||vr@||| || d S r   )r   _v_attrsgetattrr   _g__setattrZ_g__delattr)	r   r   r$   r    attrsvaluer!   r"   shattrsr   r   r   attr_to_shadow   s    

r3   c                 C   s8   |   \}}|j}t||}| |}|j|| d S r   )r   r-   r.   r   r/   )r   r   r$   r!   r"   r2   r1   r    r   r   r   attr_from_shadow   s
    

r4   c                 C   s   t | || d S r   r3   r   r   r$   r   r   r   r      s    r   c                 C   s   t | || d S r   r4   r6   r   r   r   r      s    r   c                 C   s   t | || d S r   r7   r6   r   r   r   r      s    r   c                 C   s   t | || d S r   r5   r6   r   r   r   r      s    r   N)__doc__r   r   Z__docformat__r   r   r#   r&   r	   r   r
   r   r   r   r3   r4   r   r   r   r   r   r   r   r   <module>   s$   
		