
    ob0                         d Z ddlmZmZ ddl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 dd
lmZ ej$                  rddlmZmZ ddlmZ 	 	 ddZ	 	 ddZ	 	 ddZy)z0Functions for moving files between filesystems.
    )print_functionunicode_literalsN   )
commonpath)copy_dir	copy_file)FSError)	manage_fs)OSFS)frombase)TextUnion)FSc                 &    t        | d|d||       y)a  Move the contents of a filesystem to another filesystem.

    Arguments:
        src_fs (FS or str): Source filesystem (instance or URL).
        dst_fs (FS or str): Destination filesystem (instance or URL).
        workers (int): Use `worker` threads to copy data, or ``0`` (default) for
            a single-threaded copy.
        preserve_time (bool): If `True`, try to preserve mtime of the
            resources (defaults to `False`).

    /workerspreserve_timeN)move_dir)src_fsdst_fsr   r   s       )/usr/lib/python3/dist-packages/fs/move.pymove_fsr      s    $ VS&#wmT    c                 F   t        | d      5 }t        |dd      5 }||u r'|j                  ||d|       	 ddd       ddd       y|j                  |      r|j                  |      r	 |j                  |      }|j                  |      }	t	        ||	g      }
|
rt        |
|      }t        |
|	      }|j                         5  |j                         5  t        |
      5 }|j                  |||       	 ddd       ddd       ddd       ddd       ddd       y|j                         5  |j                         5  t        |||||       	 |j                  |       	 ddd       ddd       ddd       ddd       y# 1 sw Y   nxY w	 ddd       n# 1 sw Y   nxY wddd       # 1 sw Y   xY w# t        $ r Y w xY w# t        $ r}|r|j                  |       |d}~ww xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   yxY w)aR  Move a file from one filesystem to another.

    Arguments:
        src_fs (FS or str): Source filesystem (instance or URL).
        src_path (str): Path to a file on ``src_fs``.
        dst_fs (FS or str): Destination filesystem (instance or URL).
        dst_path (str): Path to a file on ``dst_fs``.
        preserve_time (bool): If `True`, try to preserve mtime of the
            resources (defaults to `False`).
        cleanup_dst_on_error (bool): If `True`, tries to delete the file copied to
            ``dst_fs`` if deleting the file from ``src_fs`` fails (defaults to `True`).

    T	writeabler   create)	overwriter   N)r   )r
   move
hassyspath
getsyspathr   r   lockr   
ValueErrorr   remover	   )r   src_pathr   dst_pathr   cleanup_dst_on_error_src_fs_dst_fssrc_syspathdst_syspathcommonrel_srcrel_dstbasees                  r   	move_filer3   *   s   , 
6T	* ,gvd; +	w'!h$m   +	, , !!(+0B0B80L")"4"4X">K")"4"4X">K'k(BCF"*6;"?"*6;"?$\\^ 'W\\^ '!%f ' $		'7-	 X &'' '%+	, ,:   "/NN8, 9+	, ,(' ' '' ' ' ' ' ' "      ,x0G   9+	 +	, ,s   HHH	"H,AF>F2F	"F8F	 F2F>H!H1G?G3	G&G?.H6HFF		F2F&"F2)	F>2F;7F>>	G
H	G

H	G0G++G00G3	3G<8G??HHH	HH c                    t        | d      5 }t        |dd      5 }|j                         5  |j                         5  |j                  |d       t        | |||||       |j	                  |       ddd       ddd       ddd       ddd       y# 1 sw Y   "xY w# 1 sw Y   &xY w# 1 sw Y   *xY w# 1 sw Y   yxY w)a,  Move a directory from one filesystem to another.

    Arguments:
        src_fs (FS or str): Source filesystem (instance or URL).
        src_path (str): Path to a directory on ``src_fs``
        dst_fs (FS or str): Destination filesystem (instance or URL).
        dst_path (str): Path to a directory on ``dst_fs``.
        workers (int): Use ``worker`` threads to copy data, or ``0``
            (default) for a single-threaded copy.
        preserve_time (bool): If `True`, try to preserve mtime of the
            resources (defaults to `False`).

    Tr   r   )recreater   N)r
   r$   makedirr   
removetree)r   r'   r   r(   r   r   r*   r+   s           r   r   r   o   s    , 
6T	* -gvd; 	-w 
- 
-48#"/ ""8,
- 
-	-- -
- 
- 
- 
-	- 	-- -sP   B:B.B"6B	5B"=B.B:BB""B+'B..B7	3B::C)r   F)FT)__doc__
__future__r   r   typing_pathcompatr   copyr   r   errorsr	   openerr
   osfsr   pathr   TYPE_CHECKINGr   r   r1   r   r   r3   r    r   r   <module>rC      s]    8  # %    	" 	U4 BT "-r   