o
    3g                     @  sd   d dl mZ d dlZd dlmZ d dlmZ d dlmZ dd Z	dd	 Z
d
d Zdd Zdd ZdS )    )annotationsN)local)Path)	LocalPathc                  G  s\   | D ])}t |tr|  qt |trt|  qt|dr%t|  qtd|dS )a   Deletes the given paths. The arguments can be either strings,
    :class:`local paths <plumbum.path.local.LocalPath>`,
    :class:`remote paths <plumbum.path.remote.RemotePath>`, or iterables of such.
    No error is raised if any of the paths does not exist (it is silently ignored)
    __iter__zCannot delete N)
isinstancer   deletestrr   pathhasattr	TypeError)pathsp r   J/home/garg/my-data/venv/lib/python3.10/site-packages/plumbum/path/utils.pyr   
   s   




r   c                 C  s   t | |}t|  |S )N)copyr   )srcdstretr   r   r   _move   s   
r   c                 C  s   t |ts
t|}t | ttfr2| s|  n| s&t	d|d| D ]}t
|| q(|S t | ts<t| } t | trPt |trK| 
|S t| |S t |trZt| |S | j|jkre| 
|S t| |S )a  Moves the source path onto the destination path; ``src`` and ``dst`` can be either
    strings, :class:`LocalPaths <plumbum.path.local.LocalPath>` or
    :class:`RemotePath <plumbum.path.remote.RemotePath>`; any combination of the three will
    work.

    .. versionadded:: 1.3
        ``src`` can also be a list of strings/paths, in which case ``dst`` must not exist or be a directory.
    !When using multiple sources, dst  must be a directory)r   r   r   r
   tuplelistexistsmkdiris_dir
ValueErrormover   r   remote)r   r   src2r   r   r   r   !   s*   
	









r   c                 C  s"  t |ts
t|}t | ttfr2| s|  n| s&t	d|d| D ]}t
|| q(|S t | ts<t| } t | trTt |trK| 
|S |j| | |S t |trb| j| | |S | j|jkrm| 
|S t }t
| | t
|| j | W d   |S 1 sw   Y  |S )a  
    Copy (recursively) the source path onto the destination path; ``src`` and ``dst`` can be
    either strings, :class:`LocalPaths <plumbum.path.local.LocalPath>` or
    :class:`RemotePath <plumbum.path.remote.RemotePath>`; any combination of the three will
    work.

    .. versionadded:: 1.3
        ``src`` can also be a list of strings/paths, in which case ``dst`` must not exist or be a directory.
    r   r   N)r   r   r   r
   r   r   r   r   r   r   r   r   r   uploaddownloadtempdirname)r   r   r    tmpr   r   r   r   C   s>   














r   c                 C  s,   t tdrt|  dS tdd|  dS )ztThis selects the proper gui open function. This can
    also be achieved with webbrowser, but that is not supported.	startfilezxdg-openopenN)r   osr&   r   get)filenamer   r   r   gui_openp   s   
r+   )
__future__r   r(   plumbum.machines.localr   plumbum.path.baser   plumbum.path.localr   r   r   r   r   r+   r   r   r   r   <module>   s    "-