%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/lib/python3.8/__pycache__/shutil.cpython-38.pyc

U

k�]e��@s�dZddlZddlZddlZddlZddlZddlZzddlZ[dZWne	k
r^dZYnXzddl
Z
[
dZWne	k
r�dZYnXzddlZ[dZ
Wne	k
r�dZ
YnXzddlmZWne	k
r�dZYnXzddlmZWne	k
�rdZYnXejdkZdZZejdk�r6ddlZne�rDddlZe�rNd	nd
Zeed��ohej�d�ae�oxeed
�ZdZdddddddddddddddddd d!d"d#d$d%d&d'gZGd(d�de�ZGd)d'�d'e�Z Gd*d�de�Z!Gd+d�de�Z"Gd,d-�d-e�Z#Gd.d/�d/e$�Z%Gd0d1�d1e$�Z&d2d3�Z'd4d5�Z(efd6d7�Z)d�d8d�Z*d9d:�Z+d;d<�Z,d=d>�Z-dd?�d@d�Z.dd?�dAd�Z/eedB��r�dd?�dCdD�Z0ndEdD�Z0dd?�dFd�Z1dd?�dGd�Z2dd?�dHd�Z3dId#�Z4d�dJdK�Z5dde3ddfdLd�Z6eej7dM��rdNdO�Z8dPdQ�Z9ndRdO�Z8dSdQ�Z9dTdU�Z:dVdW�Z;ej<ejej=ej>hej?k�ofej@ejAk�ofejejBkZCd�dXd�ZDeCeD_EdYdZ�ZFe3fd[d�ZGd\d]�ZHd^d_�ZId`da�ZJdbdc�ZKd�dedf�ZLd�dgdh�ZMdieLdjgdkfiZNe�r�eLdlgdmfeNdn<eMgdofeNdp<e�r
eLdqgdrfeNds<e
�r eLdtgdufeNdv<dwd�ZOd�dyd�ZPdzd�ZQd�d{d�ZRd|d�ZSd}d~�ZTd�dd �ZUd�d!�ZVd�d��ZWd�d��ZXd�d��ZYd�geYgdkfd�geXgdofd��ZZe�r�d�d�geYgdmfeZdn<e�r�d�d�geYgdrfeZds<e
�r�d�d�geYgdufeZdv<d�d��Z[d�d�d"�Z\eed���r@e�]d��e�^d�d��Z_d�e_j`_d�e_ja_d�e_jb_d�d��Zcn$e�rde�]d��e�^d�d��Z_d�d��Zcd�d�d$�Zdd�d�d&�Zed�d��ZfejgejhBdfd�d%�ZidS)�z�Utility functions for copying and archiving files and directory trees.

XXX The functions here don't copy the resource fork or other metadata on Mac.

�NTF)�getpwnam)�getgrnam�nt�posixii�sendfileZlinux�
_fcopyfilez%.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)rN)�__name__�
__module__�__qualname__�r$r$�/usr/lib/python3.8/shutil.pyrEsc@seZdZdZdS)r z5Raised when source and destination are the same file.N�r!r"r#�__doc__r$r$r$r%r Hsc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is
    not supported on a special file (e.g. a named pipe)Nr&r$r$r$r%rKsc@seZdZdZdS)rz+Raised when a command could not be executedNr&r$r$r$r%rOsc@seZdZdZdS)�	ReadErrorz%Raised when an archive cannot be readNr&r$r$r$r%r(Rsr(c@seZdZdZdS)�
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsNr&r$r$r$r%r)Usr)c@seZdZdZdS)�_GiveupOnFastCopyzuRaised as a signal to fallback on using raw read()/write()
    file copy when fast-copy functions fail to do so.
    Nr&r$r$r$r%r*Ysr*c
Cs�z|��}|��}Wn*tk
r>}zt|��W5d}~XYnXzt�|||�WnTtk
r�}z6|j|_|j|_|j	t	j
t	jhkr�t|��n|d�W5d}~XYnXdS)zhCopy a regular file content or metadata by using high-performance
    fcopyfile(3) syscall (macOS).
    N)�fileno�	Exceptionr*rr�OSError�name�filename�	filename2�errno�EINVAL�ENOTSUP)�fsrc�fdst�flags�infd�outfd�errr$r$r%�_fastcopy_fcopyfile^s
r:c
CsDz|��}|��}Wn*tk
r>}zt|��W5d}~XYnXztt�|�jd�}Wntk
rnd}YnXtj	dkr�t
|d�}d}zt�||||�}Wn�tk
�r&}zj|j|_
|j|_|jtjkr�dat|��|jtjkr�|d�|dk�rt�|dtj�dk�rt|��|�W5d}~XYq�X|dk�r6�q@||7}q�dS)z�Copy data from one regular mmap-like fd to another by using
    high-performance sendfile(2) syscall.
    This should work on Linux >= 2.6.33 only.
    Ni�ili@rF)r+r,r*�max�os�fstat�st_sizer-�sys�maxsize�minrr.r/r0r1ZENOTSOCK�_USE_CP_SENDFILEZENOSPC�lseek�SEEK_CUR)r4r5r7r8r9Z	blocksize�offsetZsentr$r$r%�_fastcopy_sendfilers8


 
rFc
Csn|j}|j}tt|���L}||�}|s*q`q||krV|d|��}|�|�W5QRXq||�qW5QRXdS)z�readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
    N)�readinto�write�
memoryview�	bytearray)r4r5�lengthZ
fsrc_readinto�
fdst_writeZmv�nZsmvr$r$r%�_copyfileobj_readinto�srNcCs0|st}|j}|j}||�}|s"q,||�qdS)z=copy data from file-like object fsrc to file-like object fdstN)�COPY_BUFSIZE�readrH)r4r5rKZ	fsrc_readrLZbufr$r$r%r�scCs�t|tj�rJttjd�rJztj�|��t�|��WStk
rHYdSXttjd�r~ztj�||�WStk
r|YdSXtj�	tj�
|��tj�	tj�
|��kS)N�samestatF�samefile)�
isinstancer<�DirEntry�hasattr�pathrQ�statr-rR�normcase�abspath��src�dstr$r$r%�	_samefile�s�r]cCst|tj�r|��St�|�S�N)rSr<rTrW��fnr$r$r%�_stat�sracCs t|tj�r|��Stj�|�Sr^)rSr<rT�
is_symlinkrV�islinkr_r$r$r%�_islink�srd��follow_symlinksc	Cs�t�d||�t||�r(td�||���d}t||g�D]j\}}zt|�}Wntk
r`Yq8Xt�	|j
�r�t|tj
�r�|jn|}td|��tr8|dkr8|j}q8|s�t|�r�t�t�|�|��n
t|d����}t|d���}t�r,z,t||tj�|WW5QR�W5QR�Stk
�r(YnXn�t�rtz(t||�|WW5QR�W5QR�Stk
�rpYnXn>t�r�|dk�r�t||t|t��|W5QR�W5QR�St ||�W5QRXW5QRX|S)z�Copy data from src to dst in the most efficient way possible.

    If follow_symlinks is not set and src is a symbolic link, a new
    symlink will be created instead of copying the file it points to.

    zshutil.copyfilez{!r} and {!r} are the same filerz`%s` is a named pipe�rb�wb)!r?�auditr]r �format�	enumeraterar-rW�S_ISFIFO�st_moderSr<rTrVr�_WINDOWSr>rd�symlink�readlink�open�_HAS_FCOPYFILEr:rZ_COPYFILE_DATAr*rBrFrNrArOr)	r[r\rf�	file_size�ir`�str4r5r$r$r%r	�sD

cCspt�d||�|sFt|�rFtj�|�rFttd�r@tjtj}}qRdSnt	tj
}}||�}||t�|j
��dS)z�Copy mode bits from src to dst.

    If follow_symlinks is not set, symlinks aren't followed if and only
    if both `src` and `dst` are symlinks.  If `lchmod` isn't available
    (e.g. Linux) this method does nothing.

    zshutil.copymode�lchmodN)r?rirdr<rVrcrU�lstatrvra�chmodrW�S_IMODErm)r[r\rfZ	stat_funcZ
chmod_funcrur$r$r%r
!s
�	listxattrcCs�ztj||d�}Wn@tk
rR}z"|jtjtjtjfkr<�WY�dSd}~XYnX|D]j}z&tj|||d�}tj||||d�WqXtk
r�}z |jtj	tjtjtjfkr��W5d}~XYqXXqXdS)z�Copy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

        If `follow_symlinks` is false, symlinks won't be followed.

        reN)
r<rzr-r1r3ZENODATAr2�getxattr�setxattrZEPERM)r[r\rf�names�er.�valuer$r$r%�
_copyxattr7s	�r�cOsdSr^r$)�args�kwargsr$r$r%r�Osc	
s`t�d||�ddd�dd��|p6t|�o4tj�|�}|rJ�fdd�}n�fdd�}t|tj�rp|j|d	�}n|d
�||d	�}t�	|j
�}|d�||j|jf|d�t
|||d	�z|d�|||d	�Wntk
r�YnXt|d
��r\z|d�||j|d	�WnVtk
�rZ}z6dD]*}tt|��r|jtt|�k�r�qJ�q�W5d}~XYnXdS)a�Copy file metadata

    Copy the permission bits, last access time, last modification time, and
    flags from `src` to `dst`. On Linux, copystat() also copies the "extended
    attributes" where possible. The file contents, owner, and group are
    unaffected. `src` and `dst` are path-like objects or path names given as
    strings.

    If the optional flag `follow_symlinks` is not set, symlinks aren't
    followed if and only if both `src` and `dst` are symlinks.
    zshutil.copystatN)�nsrfcWsdSr^r$)r�rfr�r$r$r%�_nop`szcopystat.<locals>._nopcstt|��Sr^)�getattrr<�r.�r�r$r%�lookupgszcopystat.<locals>.lookupcstt|��}|tjkr|S�Sr^)r�r<�supports_follow_symlinks)r.r`r�r$r%r�ls
rerW�utimerx�st_flagsZchflags)Z
EOPNOTSUPPr3)r?rirdr<rVrcrSrTrWryrm�st_atime_ns�st_mtime_nsr��NotImplementedErrorrUr�r-r1r�)	r[r\rfZfollowr�ru�mode�whyr9r$r�r%rRs4�
cCsBtj�|�r"tj�|tj�|��}t|||d�t|||d�|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    If source and destination are the same file, a SameFileError will be
    raised.

    re)r<rV�isdir�join�basenamer	r
�r[r\rfr$r$r%r�s
cCsBtj�|�r"tj�|tj�|��}t|||d�t|||d�|S)a0Copy data and metadata. Return the file's destination.

    Metadata is copied with copystat(). Please see the copystat function
    for more information.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".
    re)r<rVr�r�r�r	rr�r$r$r%r
�s
cs�fdd�}|S)z�Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filescs(g}�D]}|�t�||��qt|�Sr^)�extend�fnmatch�filter�set)rVr}�
ignored_names�pattern��patternsr$r%�_ignore_patterns�sz)ignore_patterns.<locals>._ignore_patternsr$)r�r�r$r�r%r�scCs>|dk	r$|t�|�dd�|D��}nt�}tj||d�g}	|tkpJ|tk}
|D�]~}|j|krbqPtj�||j�}tj�||j�}
|
r�|n|}z�|�	�}|r�tjdkr�|j
dd�}|jt
jkr�d}|�r8t�
|�}|r�t�||
�t||
|d�nBtj�|��s|�rWqP|���r,t||
||||d�n
|||
�n*|���rXt||
||||d�n
|||
�WqPtk
�r�}z|	�|jd�W5d}~XYqPtk
�r�}z|	�||
t|�f�W5d}~XYqPXqPzt||�WnJtk
�r*}z*t|d	d�dk�r|	�||t|�f�W5d}~XYnX|	�r:t|	��|S)
NcSsg|]
}|j�qSr$r�)�.0�xr$r$r%�
<listcomp>�sz_copytree.<locals>.<listcomp>)�exist_okrFre)�
dirs_exist_okrZwinerror)r<�fspathr��makedirsr
rr.rVr�rbrW�st_reparse_tag�IO_REPARSE_TAG_MOUNT_POINTrpror�exists�is_dirrrr�r�r-�append�strr�)�entriesr[r\�symlinks�ignore�
copy_function�ignore_dangling_symlinksr�r��errorsZuse_srcentryZsrcentryZsrcnameZdstnameZsrcobjrbrw�linktor9r�r$r$r%�	_copytree�s`




�
� (&r�c	
CsDt�d||�t�|��}t|�}W5QRXt||||||||d�S)aeRecursively copy a directory tree and return the destination directory.

    dirs_exist_ok dictates whether to raise an exception in case dst or any
    missing parent directory already exists.

    If exception(s) occur, an Error is raised with a list of reasons.

    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied. If the file pointed by the symlink doesn't
    exist, an exception will be added in the list of errors raised in
    an Error exception at the end of the copy process.

    You can set the optional ignore_dangling_symlinks flag to true if you
    want to silence this exception. Notice that this has no effect on
    platforms that don't support os.symlink.

    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():

        callable(src, names) -> ignored_names

    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.

    The optional copy_function argument is a callable that will be used
    to copy each file. It will be called with the source path and the
    destination path as arguments. By default, copy2() is used, but any
    function that supports the same signature (like copy()) can be used.

    zshutil.copytree)r�r[r\r�r�r�r�r�)r?rir<�scandir�listr�)	r[r\r�r�r�r�r�Zitrr�r$r$r%rs&
��st_file_attributescCsPz4|jdd�}t�|j�o2|jtj@o0|jtjkWStk
rJYdSXdS�NFre)rW�S_ISDIRrmr��FILE_ATTRIBUTE_REPARSE_POINTr�r�r-)�entryrur$r$r%�
_rmtree_isdir6s
�r�cCsLz0t�|�}t�|j�p.|jtj@o.|jtjkWSt	k
rFYdSXdS)NF)
r<rwrW�S_ISLNKrmr�r�r�r�r-)rVrur$r$r%�_rmtree_islink?s

�r�cCs*z|jdd�WStk
r$YdSXdSr�)r�r-)r�r$r$r%r�HscCstj�|�Sr^)r<rVrc)rVr$r$r%r�Nsc	Cs&z"t�|��}t|�}W5QRXWn*tk
rL|tj|t���g}YnX|D]�}|j}t|�r�z|��rvtd��Wn,tk
r�|tjj	|t���YqRYnXt
||�qRzt�|�WqRtk
r�|tj|t���YqRXqRzt�|�Wn(tk
�r |tj|t���YnXdS)N�%Cannot call rmtree on a symbolic link)
r<r�r�r-r?�exc_inforVr�rbrc�_rmtree_unsafe�unlink�rmdir)rV�onerror�
scandir_itr�r��fullnamer$r$r%r�Rs0

r�c
Cs.z"t�|��}t|�}W5QRXWn@tk
rb}z"||_|tj|t���WY�dSd}~XYnX|D�]�}tj�||j	�}z|j
dd�}Wntk
r�d}YnNX|r�z|jdd�}	t�|	j
�}Wn*tk
r�|tj|t���YqhYnX|�r�ztj|j	tj|d�}
Wn(tk
�r:|tj|t���Yn�Xz�tj�|	t�|
���r�t|
||�ztj|j	|d�Wn(tk
�r�|tj|t���YnXn8ztd��Wn*tk
�r�|tjj|t���YnXW5t�|
�Xqhztj|j	|d�Wqhtk
�r&|tj|t���YqhXqhdS)NFre)�dir_fdr�)r<r�r�r-r/r?r�rVr�r.r�rWr�rmrwrq�O_RDONLY�closerQr=�_rmtree_safe_fdr�rcr�)�topfdrVr�r�r�r9r�r�r��orig_st�dirfdr$r$r%r�qsR


r�c	Cs�t�d|�|rdd�}n|dkr*dd�}t�r`t|t�rDt�|�}zt�|�}Wn(tk
rz|tj|t�	��YdSXzt�
|tj�}Wn(tk
r�|tj
|t�	��YdSXz�tj
�|t�|���rt|||�zt�|�Wn(tk
�r|tj|t�	��YnXn8ztd��Wn*tk
�rL|tj
j|t�	��YnXW5t�|�XnNzt|��rttd��Wn,tk
�r�|tj
j|t�	��YdSXt||�SdS)a�Recursively delete a directory tree.

    If ignore_errors is set, errors are ignored; otherwise, if onerror
    is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is platform and implementation dependent;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If ignore_errors
    is false and onerror is None, an exception is raised.

    z
shutil.rmtreecWsdSr^r$�r�r$r$r%r��szrmtree.<locals>.onerrorNcWs�dSr^r$r�r$r$r%r��sr�)r?ri�_use_fd_functionsrS�bytesr<�fsdecoderwr,r�rqr�r�rVrQr=r�r�r-rcr�r�)rV�
ignore_errorsr�r��fdr$r$r%r�sJ



cCs&tjjtjjpd}tj�|�|��S)N�)r<rV�sep�altsepr��rstrip)rVr�r$r$r%�	_basename�sr�c	CsTt�d||�|}tj�|�rbt||�r8t�||�dStj�|t|��}tj�	|�rbt
d|��zt�||�Wn�tk
�rNtj�|�r�t�
|�}t�||�t�|�n�tj�|��r6t||�r�t
d||f��t|��st�|tj��st�|��rtjdk�rtd||f��t|||dd�t|�n|||�t�|�YnX|S)	a+Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command. Return the file or directory's
    destination.

    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.

    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.

    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed. Symlinks are
    recreated under the new name if os.rename() fails because of cross
    filesystem renames.

    The optional `copy_function` argument is a callable that will be used
    to copy the source or it will be delegated to `copytree`.
    By default, copy2() is used, but any function that supports the same
    signature (like copy()) can be used.

    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    zshutil.moveNz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.�darwinzKCannot move the non-empty directory '%s': Lacking write permission to '%s'.T)r�r�)r?rir<rVr�r]�renamer�r�r�rr-rcrpror��
_destinsrc�
_is_immutable�access�W_OK�listdir�platform�PermissionErrorrr)r[r\r�Zreal_dstr�r$r$r%r�sL


�
�����

cCsVtj�|�}tj�|�}|�tjj�s2|tjj7}|�tjj�sL|tjj7}|�|�Sr^)r<rVrY�endswithr��
startswithrZr$r$r%r�/sr�cCs(t|�}tjtjg}t|d�o&|j|kS)Nr�)rarW�UF_IMMUTABLE�SF_IMMUTABLErUr�)r[ruZimmutable_statesr$r$r%r�8sr�cCsNtdks|dkrdSzt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns a gid, given a group name.N�)r�KeyError�r.�resultr$r$r%�_get_gid=s
r�cCsNtdks|dkrdSzt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns an uid, given a user name.Nr�)rr�r�r$r$r%�_get_uidIs
r��gzipcs |dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntd�|���d	dl}	|rfd
|nd}
|d|
}tj�|�}|r�tj�	|�s�|dk	r�|�
d|�|s�t�|�|dk	r�|�
d
�t���t
�������fdd�}
|�s|	�|d|�}z|j||
d�W5|��X|S)a�Create a (possibly compressed) tar file from all the files under
    'base_dir'.

    'compress' must be "gzip" (the default), "bzip2", "xz", or None.

    'owner' and 'group' can be used to define an owner and a group for the
    archive that is being built. If not provided, the current owner and group
    will be used.

    The output tar file will be named 'base_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", ".bz2", or ".xz").

    Returns the output filename.
    Nr�r�Zgz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.�.tar�creating %szCreating tar archivecs,�dk	r�|_�|_�dk	r(�|_�|_|Sr^)�gidZgname�uid�uname)Ztarinfo�r��group�ownerr�r$r%�_set_uid_gid�sz#_make_tarball.<locals>._set_uid_gidzw|%s)r�)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorrj�tarfiler<rV�dirnamer��infor�r�r�rqr��add)�	base_name�base_dir�compress�verbose�dry_runr�r��loggerZtar_compressionr�Zcompress_extZarchive_name�archive_dirr��tarr$r�r%�
_make_tarballUs>�

	
rc	Csnddl}|d}tj�|�}|rNtj�|�sN|dk	r@|�d|�|sNt�|�|dk	rd|�d||�|�sj|j|d|jd���}tj�	|�}	|	tj
kr�|�|	|	�|dk	r�|�d|	�t�|�D]�\}
}}t
|�D]:}
tj�	tj�|
|
��}	|�|	|	�|dk	r�|�d|	�q�|D]L}
tj�	tj�|
|
��}	tj�|	��r|�|	|	�|dk	�r|�d|	��qq�W5QRX|S)	z�Create a zip file from all the files under 'base_dir'.

    The output zip file will be named 'base_name' + ".zip".  Returns the
    name of the output zip file.
    rN�.zipr�z#creating '%s' and adding '%s' to it�w)Zcompressionzadding '%s')�zipfiler<rVr�r�r�r��ZipFileZZIP_DEFLATED�normpath�curdirrH�walk�sortedr��isfile)rrrrrrZzip_filenamerZzfrV�dirpathZdirnames�	filenamesr.r$r$r%�
_make_zipfile�sH
��

rr)rNzuncompressed tar file)rr�zgzip'ed tar-fileZgztarzZIP file�zip)rr�zbzip2'ed tar-fileZbztar)rr�zxz'ed tar-fileZxztarcCsdd�t��D�}|��|S)z�Returns a list of supported formats for archiving and unarchiving.

    Each element of the returned sequence is a tuple (name, description)
    cSsg|]\}}||df�qS)r�r$)r�r.�registryr$r$r%r��sz'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort�Zformatsr$r$r%r�s
�r�cCst|dkrg}t|�s td|��t|ttf�s6td��|D]&}t|ttf�rXt|�dkr:td��q:|||ft|<dS)auRegisters an archive format.

    name is the name of the format. function is the callable that will be
    used to create archives. If provided, extra_args is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_archive_formats() function.
    NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorrS�tupler��lenr)r.�function�
extra_args�descriptionZelementr$r$r%r�s	
cCs
t|=dSr^)rr�r$r$r%r�sc	
Cst�d||||�t��}	|dk	rP|dk	r6|�d|�tj�|�}|sPt�|�|dkr^tj}||d�}
zt	|}Wn"t
k
r�td|�d�YnX|d}|dD]\}
}||
|
<q�|dkr�||
d	<||
d
<z|||f|
�}W5|dk	�r|dk	�r|�d|	�t�|	�X|S)aCreate an archive file (eg. zip or tar).

    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "gztar",
    "bztar", or "xztar".  Or any other registered format.

    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.

    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.
    zshutil.make_archiveNzchanging into '%s')rrzunknown archive format '%s'r�rr�r�zchanging back to '%s')r?rir<�getcwd�debugrVrY�chdirrrr�r�)rrjZroot_dirrrrr�r�rZsave_cwdr��format_info�func�arg�valr/r$r$r%r�s8




cCsdd�t��D�}|��|S)z�Returns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    cSs"g|]\}}||d|df�qS)r�r$)r�r.r�r$r$r%r�3sz&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSrrrr$r$r%r-s
�c	Csji}t��D]\}}|dD]}|||<qq|D]$}||kr0d}t||||f��q0t|�sftd��dS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r+rr)rr)	�
extensionsrr Zexisting_extensionsr.r��ext�	extension�msgr$r$r%�_check_unpack_options8s�
r0cCs,|dkrg}t|||�||||ft|<dS)aMRegisters an unpack format.

    `name` is the name of the format. `extensions` is a list of extensions
    corresponding to the format.

    `function` is the callable that will be
    used to unpack archives. The callable will receive archives to unpack.
    If it's unable to handle an archive, it needs to raise a ReadError
    exception.

    If provided, `extra_args` is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_unpack_formats() function.
    N)r0r+)r.r,rr r!r$r$r%rJscCs
t|=dS)z*Removes the pack format from the registry.N)r+r�r$r$r%r`scCs&tj�|�}tj�|�s"t�|�dS)z1Ensure that the parent directory of `path` existsN)r<rVr�r�r�)rVr�r$r$r%�_ensure_directorydsr1c		Cs�ddl}|�|�std|��|�|�}z�|��D]�}|j}|�d�s2d|krPq2tj	j
|f|�d���}|snq2t|�|�
d�s2|�|j�}t|d�}z|�|�W5|��~Xq2W5|��XdS)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file�/z..rh)rZ
is_zipfiler(rr�Zinfolistr/r�r<rVr��splitr1r�rPrqrH)	r/�extract_dirrrr�r.�target�data�fr$r$r%�_unpack_zipfilejs*




r8cCsXddl}z|�|�}Wn"|jk
r8td|��YnXz|�|�W5|��XdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar file)r�rqZTarErrorr(r�Z
extractall)r/r4r�Ztarobjr$r$r%�_unpack_tarfile�s�
r9r�r	)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:t��D],\}}|dD]}|�|�r|SqqdS)Nr)r+rr�)r/r.r�r.r$r$r%�_find_unpack_format�s

r:cCs�t�d|||�|dkr t��}t�|�}t�|�}|dk	r�zt|}Wn$tk
rltd�|��d�YnX|d}|||ft	|d��nHt
|�}|dkr�td�|���t|d}t	t|d�}|||f|�dS)a
Unpack an archive.

    `filename` is the name of the archive.

    `extract_dir` is the name of the target directory, where the archive
    is unpacked. If not provided, the current working directory is used.

    `format` is the archive format: one of "zip", "tar", "gztar", "bztar",
    or "xztar".  Or any other registered format.  If not provided,
    unpack_archive will use the filename extension and see if an unpacker
    was registered for that extension.

    In case none is found, a ValueError is raised.
    zshutil.unpack_archiveNzUnknown unpack format '{0}'r"r�zUnknown archive format '{0}')r?rir<r#r�r+r�r�rj�dictr:r()r/r4rjr&r'r�r$r$r%r�s$

�statvfs�
disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@t�|�}|j|j}|j|j}|j|j|j}t|||�S)z�Return disk usage statistics about the given path.

        Returned value is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r<r<�f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)rVru�free�total�usedr$r$r%r=�s

cCs"t�|�\}}||}t|||�S)z�Return disk usage statistics about the given path.

        Returned values is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )rZ
_getdiskusagerB)rVrDrCrEr$r$r%r=�scCs�t�d|||�|dkr(|dkr(td��|}|}|dkr>d}n(t|t�rft|�}|dkrftd�|���|dkrtd}n(t|t�s�t	|�}|dkr�td�|���t
�|||�dS)z�Change owner user and group of the given path.

    user and group can be the uid/gid or the user/group names, and in that case,
    they are converted to their respective uid/gid.
    zshutil.chownNzuser and/or group must be set���zno such user: {!r}zno such group: {!r})r?rir�rSr�r��LookupErrorrj�intr�r<r)rV�userr�Z_userZ_groupr$r$r%rs$

��P�c
Cs�zttjd�}Wnttfk
r.d}YnXzttjd�}Wnttfk
r^d}YnX|dksp|dkr�zt�tj���}Wn$t	tt
fk
r�t�|�}YnX|dkr�|j}|dkr�|j
}t�||f�S)aGet the size of the terminal window.

    For each of the two dimensions, the environment variable, COLUMNS
    and LINES respectively, is checked. If the variable is defined and
    the value is a positive integer, it is used.

    When COLUMNS or LINES is not defined, which is the common case,
    the terminal connected to sys.__stdout__ is queried
    by invoking os.get_terminal_size.

    If the terminal size cannot be successfully queried, either because
    the system doesn't support querying, or because we are not
    connected to a terminal, the value given in fallback parameter
    is used. Fallback defaults to (80, 24) which is the default
    size used by many terminal emulators.

    The value returned is a named tuple of type os.terminal_size.
    ZCOLUMNSrZLINES)rHr<�environr�r�rr?�
__stdout__r+�AttributeErrorr-�
terminal_size�columns�lines)ZfallbackrQrR�sizer$r$r%r s$

cCs&tj�|�o$t�||�o$tj�|�Sr^)r<rVr�r�r�)r`r�r$r$r%�
_access_checkQs�rTc
	s�tj���rt�|�r�SdSt�t�}|dkrttj�dd�}|dkrtzt�d�}Wnt	t
fk
rrtj}YnX|s|dS|r�t�|�}|�
t�tj��}nt�|�}|�
tj�}tjdk�rTtj}|r�t�|�}||kr�|�d|�t�d�p�t}dd�|�
tj�D�}|�r d	d�|D�}t�fd
d�|D���r@�g}n�fdd�|D�}n�g}t�}|D]X}	tj�|	�}
|
|k�rd|�|
�|D],}tj�|	|�}t||��r�|S�q��qddS)
a3Given a command, mode, and a PATH string, return the path which
    conforms to the given mode on the PATH, or None if there is no such
    file.

    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
    of os.environ.get("PATH"), or can be overridden with a custom search
    path.

    N�PATH�CS_PATHZwin32rZPATHEXTcSsg|]}|r|�qSr$r$�r�r-r$r$r%r��szwhich.<locals>.<listcomp>cSsg|]}t�|��qSr$)r<�fsencoderWr$r$r%r��sc3s |]}����|���VqdSr^)�lowerr�rW��cmdr$r%�	<genexpr>�szwhich.<locals>.<genexpr>csg|]}�|�qSr$r$rWrZr$r%r��s)r<rVr�rTrSr�rM�get�confstrrOr��defpathrXr3�pathsepr�r?r�r�insert�getenv�_WIN_DEFAULT_PATHEXT�anyr�rXr�r�)
r[r�rVZ	use_bytesrZpathext_sourceZpathext�files�seen�dirZnormdirZthefiler.r$rZr%rVsV







)r)F)FN)r�rrNNN)rrN)Nr�)NNrrNNN)Nr�)NN)NN)rJ)jr'r<r?rWr��collectionsr1�zlibr��ImportErrorr�r�Zlzmar��pwdrZgrprr.rnrrrOrUr�r�rBrrrc�__all__r-rr rrr(r,r)r*r:rFrNrr]rardr	r
r�rrr
rr�r�stat_resultr�r�r�r�rqr�r��supports_dir_fdr��supports_fdr�r�rZavoids_symlink_attacksr�rr�r�r�r�rrrrrrrrr0rrr1r8r9r+r:rr��
namedtuplerBrDrErCr=rrrT�F_OK�X_OKrr$r$r$r%�<module>st






�
@

7B
�
A�
.	
	4�
�
�
>?	�
A
-
����

�
8�
"�
�
�
�
*



 
1

Zerion Mini Shell 1.0