ó
jˆú\c           @@  sÀ   d  Z  d d l m Z d d l m Z d Z d „  Z d „  Z d „  Z d	 „  Z	 d
 „  Z
 d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   sS  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.

i    (   t   absolute_importi   (   t
   split_patht   reStructuredTextc         G@  sÉ   | d k r  t  |  | d ƒ n¥ | d k r@ t |  | d ƒ n… | d k rg t |  | d | d ƒ n^ | d k rŽ t |  | d | d ƒ n7 | d k rµ t |  | d | d ƒ n t d | ƒ ‚ d  S(	   Nt   CREATEi    t   REMOVEt   MOVEi   t   ADDATTRt   DELATTRsW   the requested unknown operation %r can not be undone; please report this to the authors(   t   undo_createt   undo_removet	   undo_movet   undo_add_attrt   undo_del_attrt   NotImplementedError(   t   file_t	   operationt   args(    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   undo(   s    c         G@  sÉ   | d k r  t  |  | d ƒ n¥ | d k r@ t |  | d ƒ n… | d k rg t |  | d | d ƒ n^ | d k rŽ t |  | d | d ƒ n7 | d k rµ t |  | d | d ƒ n t d | ƒ ‚ d  S(	   NR   i    R   R   i   R   R   sW   the requested unknown operation %r can not be redone; please report this to the authors(   t   redo_createt   redo_removet	   redo_movet   redo_add_attrt   redo_del_attrR   (   R   R   R   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   redo9   s    c         C@  s5   |  j  | ƒ } |  j ƒ  \ } } | j | | ƒ d  S(   N(   t	   _get_nodet   _shadow_namet   _g_move(   R   t   patht   nodet   shparentt   shname(    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   move_to_shadowJ   s    c         C@  sV   |  j  ƒ  \ } } | j | ƒ } t | ƒ \ } } |  j | ƒ } | j | | ƒ d  S(   N(   R   t   _f_get_childR   R   R   (   R   R   R   R   R   t   pnamet   namet   parent(    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   move_from_shadowR   s
    c         C@  s   t  |  | ƒ d  S(   N(   R   (   R   R   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   \   s    c         C@  s   t  |  | ƒ d  S(   N(   R$   (   R   R   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   a   s    c         C@  s   t  |  | ƒ d  S(   N(   R$   (   R   R   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR	   f   s    c         C@  s   t  |  | ƒ d  S(   N(   R   (   R   R   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   k   s    c         C@  sD   t  | ƒ \ } } |  j | ƒ } |  j | ƒ } | j | | ƒ d  S(   N(   R   R   R   (   R   t   origpatht   destpatht	   origpnamet   orignameR   t
   origparent(    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR
   p   s    c         C@  sD   t  | ƒ \ } } |  j | ƒ } |  j | ƒ } | j | | ƒ d  S(   N(   R   R   R   (   R   R%   R&   t	   destpnamet   destnameR   t
   destparent(    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   y   s    c   	      C@  sr   |  j  | ƒ } | j } t | | ƒ } |  j ƒ  \ } } | j } | | k ra | j | | ƒ n  | j | ƒ d  S(   N(   R   t   _v_attrst   getattrR   t   _g__setattrt   _g__delattr(	   R   R   R"   R   t   attrst   valueR   R   t   shattrs(    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   attr_to_shadow‚   s    		c         C@  sP   |  j  ƒ  \ } } | j } t | | ƒ } |  j | ƒ } | j j | | ƒ d  S(   N(   R   R-   R.   R   R/   (   R   R   R"   R   R   R3   R2   R   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   attr_from_shadow“   s
    	c         C@  s   t  |  | | ƒ d  S(   N(   R4   (   R   R   R"   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR       s    c         C@  s   t  |  | | ƒ d  S(   N(   R5   (   R   R   R"   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   ¥   s    c         C@  s   t  |  | | ƒ d  S(   N(   R5   (   R   R   R"   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   ª   s    c         C@  s   t  |  | | ƒ d  S(   N(   R4   (   R   R   R"   (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyR   ¯   s    N(   t   __doc__t
   __future__R    R   R   t   __docformat__R   R   R   R$   R   R   R	   R   R
   R   R4   R5   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/tables/undoredo.pyt   <module>   s&   				
													