AlkantarClanX12

Your IP : 3.12.148.180


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/shutil.cpython-311.opt-1.pyc

�

c��f�����dZddlZddlZddlZddlZddlZddlZ	ddlZ[dZn
#e	$rdZYnwxYw	ddl
Z
[
dZn
#e	$rdZYnwxYw	ddlZ[dZ
n
#e	$rdZ
YnwxYwejdkZdxZZejdkrddlZnerddlZerdndZeed	��oej�d
��aeoeed��ZdZgd
�ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de ��Z!Gd�de ��Z"d�Z#d�Z$efd�Z%dud�Z&d �Z'd!�Z(d"�Z)dd#�d$�Z*dd#�d%�Z+eed&��rdd#�d'�Z,nd(�Z,dd#�d)�Z-dd#�d*�Z.dd#�d+�Z/d,�Z0	dvd-�Z1dde/ddfd.�Z2eej3d/��rd0�Z4d1�Z5nd2�Z4d3�Z5d4�Z6d5�Z7ej8ejej9ej:hej;koej<ej=vo
ejej>vZ?dwdd6�d7�Z@e?e@_Ad8�ZBe/fd9�ZCd:�ZDd;�ZEd<�ZFd=�ZG		dxd?�ZH		dyd@�ZIdAeHdBgdCdfiZJereHdDgdEdfeJdF<eIgdGdfeJdH<er
eHdIgdJdfeJdK<e
r
eHdLgdMdfeJdN<dO�ZKdzdQ�ZLdR�ZM		d{dS�ZNdT�ZOdU�ZP		dzdV�ZQdW�ZRdX�ZSdY�ZTddZ�d[�ZUd\geUgdCfd]geTgdGfd^�ZVerd_d`geUgdEfeVdF<erdadbgeUgdJfeVdK<e
rdcddgeUgdMfeVdN<de�ZWd|ddZ�df�ZXeedg��rNe�Ydh��ejZdidj��Z[dke[j\_dle[j]_dme[j^_dn�Z_n+er)e�Ydh��ejZdidj��Z[do�Z_d|dp�Z`d}dr�Zads�Zbejcejdzdfdt�ZedS)~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�nt�posixii�sendfile�linux�
_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��eZdZdS)rN)�__name__�
__module__�__qualname__���-/opt/alt/python311/lib64/python3.11/shutil.pyrr=s�������Dr&rc��eZdZdZdS)r z5Raised when source and destination are the same file.N�r"r#r$�__doc__r%r&r'r r @s������?�?�?�?r&r c��eZdZdZdS)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'rrCs������;�;�;�;r&rc��eZdZdZdS)rz+Raised when a command could not be executedNr)r%r&r'rrGs������5�5�5�5r&rc��eZdZdZdS)�	ReadErrorz%Raised when an archive cannot be readNr)r%r&r'r.r.Js������/�/�/�/r&r.c��eZdZdZdS)�
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsNr)r%r&r'r0r0Ms������&�&�&�&r&r0c��eZdZdZdS)�_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'r2r2Qs���������r&r2c��	|���}|���}n!#t$r}t|���d}~wwxYw	tj|||��dS#t
$rN}|j|_|j|_|j	tj
tjhvrt|���|d�d}~wwxYw)zhCopy a regular file content or metadata by using high-performance
    fcopyfile(3) syscall (macOS).
    N)�fileno�	Exceptionr2rr�OSError�name�filename�	filename2�errno�EINVAL�ENOTSUP)�fsrc�fdst�flags�infd�outfd�errs      r'�_fastcopy_fcopyfilerCVs���%��{�{�}�}�����
�
�����%�%�%���$�$�$�����%���� �
���u�e�,�,�,�,�,��� � � ��y����	��
��9���u�}�5�5�5�#�C�(�(�(��4������
 ���s-�(+�
A	�A�A	�
A%�%
B=�/A	B8�8B=c���	|���}|���}n!#t$r}t|���d}~wwxYw	tt	j|��jd��}n#t$rd}YnwxYwtj	dkrt|d��}d}		t	j||||��}|dkrdS||z
}n�#t$r�}|j|_
|j|_|jtjkrdat|���|jtjkr|d�|dkr3t	j|dtj��dkrt|���|�d}~wwxYw��)	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@rTF)r4r5r2�max�os�fstat�st_sizer6�sys�maxsize�minrr7r8r9r:�ENOTSOCK�_USE_CP_SENDFILE�ENOSPC�lseek�SEEK_CUR)r=r>r@rArB�	blocksize�offset�sents        r'�_fastcopy_sendfilerTjs���%��{�{�}�}�����
�
�����%�%�%���$�$�$�����%�����������.��8�8�	�	�������	�	�	������{�W����	�7�+�+�	�
�F��	��;�u�d�F�I�>�>�D�,�q�y�y����d�N�F�F��/�	�	�	��9�C�L� �I�C�M��y�E�N�*�*�$)� �'��,�,�,��y�E�L�(�(��t�#���{�{�r�x��q�"�+�>�>�!�C�C�'��,�,�,��I�����'	����s?�(+�
A	�A�A	�
'A5�5B�B�+C�
E0�BE+�+E0c�@�|j}|j}tt|����5}	||��}|snJ||kr8|d|�5}|�|��ddd��n#1swxYwYn||���X	ddd��dS#1swxYwYdS)z�readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
    TN)�readinto�write�
memoryview�	bytearray)r=r>�length�
fsrc_readinto�
fdst_write�mv�n�smvs        r'�_copyfileobj_readintor`�s:���M�M���J�	�I�f�%�%�	&�	&�	�"�	��
�b�!�!�A��
���V�������V�$�s��J�J�s�O�O�O�$�$�$�$�$�$�$�$�$�$�$����$�$�$�$���
�2����	��		�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s5� B�A-�!B�-A1	�1B�4A1	�5B�B�Bc�h�|st}|j}|j}	||��}|sdS||���)z=copy data from file-like object fsrc to file-like object fdstTN)�COPY_BUFSIZE�readrW)r=r>rZ�	fsrc_readr\�bufs      r'rr�sP�������	�I���J���i������	��E��
�3����	r&c��t|tj��rpttjd��rV	tj�|���tj|����S#t$rYdSwxYwttjd��r2	tj�||��S#t$rYdSwxYwtj�	tj�
|����tj�	tj�
|����kS)N�samestatF�samefile)�
isinstancerF�DirEntry�hasattr�pathrg�statr6rh�normcase�abspath��src�dsts  r'�	_samefilers�s���#�r�{�#�#������(D�(D��	��7�#�#�C�H�H�J�J������=�=�=���	�	�	��5�5�	�����r�w�
�#�#��	��7�#�#�C��-�-�-���	�	�	��5�5�	����
�G���R�W�_�_�S�1�1�2�2��G���R�W�_�_�S�1�1�2�2�
3�4s$�AA:�:
B�B�&C�
C�Cc��t|tj��r|���ntj|��S�N)rirFrjrm��fns r'�_statrx�s-��"�2�r�{�3�3�D�2�7�7�9�9�9������Dr&c��t|tj��r|���ntj�|��Sru)rirFrj�
is_symlinkrl�islinkrvs r'�_islinkr|�s3��(��R�[�9�9�Q�2�=�=�?�?�?�r�w�~�~�b�?Q�?Q�Qr&��follow_symlinksc
�D�tjd||��t||��r#td�||�����d}t||g��D]�\}}	t
|��}tj|j	��r5t|tj��r|j
n|}td|z���tr
|dkr|j}�x#t"$rY��wxYw|s8t%|��r)tjtj|��|���n�t+|d��5}	t+|d��5}t,rF	t/||t0j��|cddd��cddd��S#t4$rYn�wxYwt6r;	t9||��|cddd��cddd��S#t4$rYnOwxYwtrD|dkr>t;||t=|t>����|cddd��cddd��StA||��ddd��n#1swxYwYnE#tB$r8}	tj
�"|��stGd|����|	��d}	~	wwxYwddd��n#1swxYwY|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�wbNzDirectory does not exist: )$rI�auditrsr �format�	enumeraterxrm�S_ISFIFO�st_moderirFrjrlr�_WINDOWSrHr6r|�symlink�readlink�open�_HAS_FCOPYFILErCr�_COPYFILE_DATAr2rMrTr`rKrbr�IsADirectoryError�exists�FileNotFoundError)
rqrrr~�	file_size�irw�str=r>�es
          r'r	r	�s���I���c�*�*�*���c���P��=�D�D�S�#�N�N�O�O�O��I��C��:�&�&�'�'���2�	'��r���B��}�R�Z�(�(�
D� *�2�r�{� ;� ;�C�R�W�W���&�'=��'B�C�C�C��
'�A��F�F��J�	����	�	�	��D�	�����!�w�s�|�|�!�
�
�2�;�s�#�#�S�)�)�)�)�
�#�t�_�_�	��
��#�t�_�_�,��%�#�!�/��d�E�<P�Q�Q�Q�#&�,�,�,�,�,�,�,�	�	�	�	�	�	�	�	�� 1�!�!�!� �D�!����*�
#�!�.�t�T�:�:�:�#&�,�,�,�,�,�,�,�	�	�	�	�	�	�	�	�� 1�!�!�!� �D�!����"�#�i�!�m�m�-�d�D�#�i��:V�:V�W�W�W�"�',�,�,�,�,�,�,�	�	�	�	�	�	�	�	�. ��d�+�+�+�+,�,�,�,�,�,�,�,�,�,�,����,�,�,�,���0%�
�
�
��w�~�~�c�*�*��+�,N��,N�,N�O�O�UV�V������	
����5	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�@�Js��#C�
C"�!C"�/J�1I�H8�
E?�&I�?
F�	H8�F�
H8�G�(I�
G�H8�
G�5H8�I�H8�,I�8H<	�<I�?H<	�I�J�
J�3J�J�J�J�Jc�f�tjd||��|s�t|��rxtj�|��rYtjdkrtjtj}}n�ttd��rtjtj
}}nedStjdkr@tj�|��r!tj�|d���}ttj}}||��}||tj|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.copymoder�lchmodNT��strict)rIr�r|rFrlr{r7�lstat�chmodrkr��realpathrxrm�S_IMODEr�)rqrrr~�	stat_func�
chmod_funcr�s      r'r
r
"s����I���c�*�*�*��
0�w�s�|�|�
0�����s�0C�0C�
0�
�7�d�?�?�$&�H�b�h�z�I�I�
�R��
"�
"�	�$&�H�b�i�z�I�I��F�
�7�d�?�?�r�w�~�~�c�2�2�?��'�"�"�3�t�"�4�4�C� %�r�x�:�	�	��3���B��J�s�D�L���,�,�-�-�-�-�-r&�	listxattrc��	tj||���}nC#t$r6}|jtjtjtjfvr�Yd}~dSd}~wwxYw|D]}	tj|||���}tj||||����3#t$r@}|jtj	tjtjtjfvr�Yd}~�xd}~wwxYwdS)z�Copy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

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

        r}N)
rFr�r6r:r<�ENODATAr;�getxattr�setxattr�EPERM)rqrrr~�namesr�r7�values       r'�
_copyxattrr�<s��	��L��o�F�F�F�E�E���	�	�	��w�u�}�e�m�U�\�J�J�J���F�F�F�F�F�����	�����	�	�D�
���C���O�O�O����C��u�o�N�N�N�N�N���
�
�
��7�5�;��
�u�}�#(�<�#1�1�1��1�1�1�1�1�����
����		�	s,��
A�+A�A�!/B�
C�6C�Cc��dSrur%��args�kwargss  r'r�r�T����r&c���
�tjd||��ddd�d��
|p.t|��otj�|��}|r�
fd�}n�
fd�}t
|tj��r|�|���}n|d��||���}tj	|j
��}|d	��||j|jf|���t|||���|d
��}tjdkrF|rAtj�|��r!tj�|d�
��}nd�}	||||���n#t $rYnwxYwt#|d��rr	|d��||j|���dS#t&$rF}dD]7}	t#t(|	��r |jt+t(|	��krn�8�Yd}~dSd}~wwxYwdS)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)�nsr~c��dSrur%)r�r~r�s   r'�_nopzcopystat.<locals>._noper�r&c�0��tt|���Sru)�getattrrF)r7r�s �r'�lookupzcopystat.<locals>.lookupls����2�t�T�*�*�*r&c�T��tt|���}|tjvr|S�Sru)r�rF�supports_follow_symlinks)r7rwr�s  �r'r�zcopystat.<locals>.lookupqs,�����T�4�(�(�B��R�0�0�0��	��Kr&r}rm�utimer�rTr�c�"�tj|�dSru)rFr�r�s  r'�_chmodzcopystat.<locals>._chmod�s����$����r&�st_flags�chflags)�
EOPNOTSUPPr<)rIr�r|rFrlr{rirjrmr�r��st_atime_ns�st_mtime_nsr�r7r��NotImplementedErrorrkr�r6r:r�)rqrrr~�followr�r��moder��whyrBr�s          @r'rrWs�����I���c�*�*�*��T�
�
�
�
�
��
J�W�S�\�\�%I�b�g�n�n�S�6I�6I� J�F�
��	+�	+�	+�	+�	+�	+�
	�	�	�	�	��#�r�{�#�#�9�
�X�X�f�X�
-�
-���
�V�V�F�^�^�C��
8�
8�
8���<��
�#�#�D��F�F�7�O�O�C�R�^�R�^�<�� � � � ��s�C��0�0�0�0�
�V�G�_�_�F�	�w�$����	 ��w�~�~�c�"�"�
9��g�&�&�s�4�&�8�8���
 �
 �
 �

���s�D�&�1�1�1�1�1���
�
�
�	
��
�����r�:����	��F�F�9���c�2�;��G�G�G�G�G�G���	�	�	�.�
�
���5�#�&�&��3�9���s�8K�8K�+K�+K��E����E�E�E�E�E�����	�����s*�E#�#
E0�/E0�F"�"
G2�,;G-�-G2c��tj�|��r=tj�|tj�|����}t|||���t
|||���|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.

    r})rFrl�isdir�join�basenamer	r
�rqrrr~s   r'rr�sn��
�w�}�}�S���7��g�l�l�3��� 0� 0�� 5� 5�6�6���S�#��7�7�7�7��S�#��7�7�7�7��Jr&c��tj�|��r=tj�|tj�|����}t|||���t
|||���|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".
    r})rFrlr�r�r�r	rr�s   r'r
r
�sn��
�w�}�}�S���7��g�l�l�3��� 0� 0�� 5� 5�6�6���S�#��7�7�7�7��S�#��7�7�7�7��Jr&c����fd�}|S)z�Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filesc���g}�D]*}|�tj||�����+t|��Sru)�extend�fnmatch�filter�set)rlr��
ignored_names�pattern�patternss    �r'�_ignore_patternsz)ignore_patterns.<locals>._ignore_patterns�sJ����
��	A�	A�G�� � ����w�!?�!?�@�@�@�@��=�!�!�!r&r%)r�r�s` r'rr�s$���
"�"�"�"�"�
�r&c
��|�)|tj|��d�|D����}nd}tj||���g}	|tup|tu}
|D�]�}|j|vr�
tj�||j��}tj�||j��}
|
r|n|}	|���}|r=tjdkr-|�	d���}|j
tjkrd}|r�tj|��}|r)tj
||
��t||
|���n�tj�|��s|r��|���rt#||
|||||��nC|||
��n6|���rt#||
|||||��n|||
�����#t$$r+}|	�|jd��Yd}~���d}~wt*$r0}|	�||
t/|��f��Yd}~���d}~wwxYw	t||��nM#t*$r@}t1|dd���%|	�||t/|��f��Yd}~nd}~wwxYw|	rt%|	���|S)	Nc��g|]	}|j��
Sr%�r7)�.0�xs  r'�
<listcomp>z_copytree.<locals>.<listcomp>�s��/H�/H�/H�1���/H�/H�/Hr&r%)�exist_okrFr}r�winerror)rF�fspath�makedirsr
rr7rlr�rzrm�st_reparse_tag�IO_REPARSE_TAG_MOUNT_POINTr�r�rr��is_dirrrr�r�r6�append�strr�)�entriesrqrr�symlinks�ignore�
copy_function�ignore_dangling_symlinks�
dirs_exist_okr��errors�use_srcentry�srcentry�srcname�dstname�srcobjrzr��linktorBr�s                    r'�	_copytreer��s9��
����r�y��~�~�/H�/H��/H�/H�/H�I�I�
�
��
��K��m�,�,�,�,�
�F� �E�)�B�]�d�-B�L��,8�,8���=�M�)�)���'�,�,�s�H�M�2�2���'�,�,�s�H�M�2�2��)�6���w��&	8�!�,�,�.�.�J��
'�b�g��o�o�!�
�
�e�
�<�<���'�4�+J�J�J�!&�J��
/���W�-�-���7��J�v�w�/�/�/��V�W�(�l�K�K�K�K�K��7�>�>�&�1�1�!�6N�!� ����(�(�7� ���(�F�!.�0H�!.�0�0�0�0�&�
�f�g�6�6�6�6����"�"�
/����(�F�M�1�=�B�B�B�B��
�f�g�.�.�.����	'�	'�	'��M�M�#�(�1�+�&�&�&�&�&�&�&�&������	8�	8�	8��M�M�7�G�S��X�X�6�7�7�7�7�7�7�7�7�����	8����0���c�������0�0�0��3�
�D�)�)�1��M�M�3��S��X�X�.�/�/�/����������0�������F�m�m���JsD�8B5G�/A-G�
I�( H�
I�%I�I�I � 
J*�*6J%�%J*c
���tjd||��tj|��5}t	|��}ddd��n#1swxYwYt||||||||���S)a'Recursively copy a directory tree and return the destination directory.

    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.

    If dirs_exist_ok is false (the default) and `dst` already exists, a
    `FileExistsError` is raised. If `dirs_exist_ok` is true, the copying
    operation will continue if it encounters existing directories, and files
    within the `dst` tree will be overwritten by corresponding files from the
    `src` tree.
    zshutil.copytreeN)r�rqrrr�r�r�r�r�)rIr�rF�scandir�listr�)	rqrrr�r�r�r�r��itrr�s	         r'rrs���P�I���c�*�*�*�	��C����C��s�)�)���������������������W�#�3��"�-�.F�#0�2�2�2�2s�A�A�A�st_file_attributesc���	|�d���}tj|j��o)|jtjzo|jtjkS#t$rYdSwxYw�NFr})rm�S_ISDIRr�r��FILE_ATTRIBUTE_REPARSE_POINTr�r�r6)�entryr�s  r'�
_rmtree_isdirr�Fs���	����E��2�2�B��L���,�,�K��&��)J�J�J��&�$�*I�I�2K�
L���	�	�	��5�5�	���s�AA�
A)�(A)c���	tj|��}tj|j��p(|jtjzo|jtjkS#t$rYdSwxYw)NF)
rFr�rm�S_ISLNKr�r�r�r�r�r6)rlr�s  r'�_rmtree_islinkr�Osu��	���$���B��L���,�,�K��&��)J�J�J��&�$�*I�I�
L���	�	�	��5�5�	���s�AA�
A&�%A&c�R�	|�d���S#t$rYdSwxYwr�)r�r6)r�s r'r�r�Xs=��	��<�<��<�6�6�6���	�	�	��5�5�	���s��
&�&c�@�tj�|��Sru)rFrlr{)rls r'r�r�^s���w�~�~�d�#�#�#r&c�F�	tj|��5}t|��}ddd��n#1swxYwYn:#t$r-|tj|t	j����g}YnwxYw|D]�}|j}t|��rs	|���rtd���n=#t$r0|tjj	|t	j����Y�vwxYwt||����	tj|����#t$r+|tj|t	j����Y��wxYw	tj|��dS#t$r,|tj|t	j����YdSwxYw)N�%Cannot call rmtree on a symbolic link)
rFr�r�r6rI�exc_inforlr�rzr{�_rmtree_unsafe�unlink�rmdir)rl�onerror�
scandir_itr�r��fullnames      r'rrbs���
�Z��
�
�	'���:�&�&�G�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'����������
�D�#�,�.�.�1�1�1����������=�=���:������	=�
��#�#�%�%�K�"�"I�J�J�J�	K��
�
�
�
�������#�,�.�.�A�A�A���
����
�8�W�-�-�-�-�
=��	�(�#�#�#�#���
=�
=�
=����	�8�S�\�^�^�<�<�<�<�<�
=����0�
����������0�0�0�����$�����/�/�/�/�/�/�0���s]�>�2�>�6�>�6�>�4A5�4A5�#B7�77C1�0C1�D�2E�E�E*�*2F �F c
���	tj|��5}t|��}ddd��n#1swxYwYnG#t$r:}||_|tj|tj����Yd}~dSd}~wwxYw|D�]e}tj�||j	��}	|�
d���}|ri	|�d���}	tj|	j
��}nK#t$r+|tj|tj����Y��wxYwn#t$rd}YnwxYw|�rP	tj|j	tjtjz|���}
d}	tj�|	tj|
����r�t)|
||��	tj|
��n:#t$r-d}|tj|tj����YnwxYwd}	tj|j	|���n�#t$r+|tj|tj����YnQwxYw	td���#t$r0|tjj|tj����YnwxYw|sP	tj|
����G#t$r,|tj|tj����Y��|wxYw���#|sN	tj|
��w#t$r+|tj|tj����YwwxYwwxYw#t$r,|tj|tj����Y��wxYw	tj|j	|�����.#t$r,|tj|tj����Y��cwxYwdS)NFr}��dir_fdTr�)rFr�r�r6r8rIrrlr�r7r�rmr�r�r�r��O_RDONLY�
O_NONBLOCKrgrG�_rmtree_safe_fd�closerr{r)�topfdrlrrr�rBr�rr��orig_st�dirfd�dirfd_closeds            r'rr�s����
�Z��
�
�	'�*��:�&�&�G�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�������������
�D�#�,�.�.�1�1�1����������������6=�6=���7�<�<��e�j�1�1��	��\�\�%�\�8�8�F��
��#�j�j��j�?�?�G�!�\�'�/�:�:�F�F�������G�B�H�h�����?�?�?��H�����	
���	�	�	��F�F�F�	�����(	=�"
H����
�B�K�"�-�,G�PU�V�V�V��$��H��w�'�'����%���A�A�N�'��x��A�A�A�H��H�U�O�O�O�O��&�H�H�H�+/�L�#�G�B�H�h�����G�G�G�G�G�H����(,��H��H�U�Z��>�>�>�>�>��&�H�H�H�#�G�B�H�h�����G�G�G�G�G�H����N�#*�+1�#2�#2�2��&�N�N�N�#�G�B�G�N�H�c�l�n�n�M�M�M�M�M�N����(�H�H��H�U�O�O�O�O��&�H�H�H�#�G�B�H�h�����G�G�G�G�G�H����H��<�H�H��H�U�O�O�O�O��&�H�H�H�#�G�B�H�h�����G�G�G�G�G�H����H�����7�
;�
;�
;������3�<�>�>�:�:�:�:�:�
;����B
=��	�%�*�U�3�3�3�3�3���
=�
=�
=����	�8�S�\�^�^�<�<�<�<�<�
=����k6=�6=s�>�2�>�6�>�6�>�
B�/A=�=B�0D2�	/C9�92D.�-D.�2E�E�5M�>AL	�G�L	�4H�L	�
H�L	�H0�/L	�02I%�"L	�$I%�%L	�)I8�87J2�/L	�1J2�2L	�8K�2L�L�	M�
L"�!M�"2M	�M�M	�M�2N�N�N5�52O+�*O+rc	���tjd||��|rd�}n|�d�}t�r�t|t��rtj|��}	tj||���}n9#t$r,|t
j|tj	����YdSwxYw	tj
|t
jt
jz|���}d}n9#t$r,|t
j
|tj	����YdSwxYw	t
j
�|tj|����r�t!|||��	tj|��n:#t$$r-d}|t
j|tj	����YnwxYwd}	tj||���n�#t$$r+|t
j|tj	����YnQwxYw	t%d���#t$$r0|t
j
j|tj	����YnwxYw|sP	tj|��dS#t$$r,|t
j|tj	����YdSwxYwdS#|sN	tj|��w#t$$r+|t
j|tj	����YwwxYwwxYw|�t+d	���	t-|��rt%d���n>#t$$r1|t
j
j|tj	����YdSwxYwt/||��S)
a�Recursively delete a directory tree.

    If dir_fd is not None, it should be a file descriptor open to a directory;
    path will then be relative to that directory.
    dir_fd may not be implemented on your platform.
    If it is unavailable, using it will raise a NotImplementedError.

    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.rmtreec��dSrur%�r�s r'rzrmtree.<locals>.onerror�s���Dr&Nc���rur%rs r'rzrmtree.<locals>.onerror�s��r&rFTr�z#dir_fd unavailable on this platform)rIr��_use_fd_functionsri�bytesrF�fsdecoder�r5rr�r
rrlrgrGrr
r6rr{r�r�r)rl�
ignore_errorsrr	r�fd�	fd_closeds       r'rr�s��� �I�o�t�V�,�,�,���	�	�	�	�	��	�	�	��6-��d�E�"�"�	%��;�t�$�$�D�	��h�t�F�3�3�3�G�G���	�	�	��G�B�H�d�C�L�N�N�3�3�3��F�F�	����	����r�{�R�]�:�6�J�J�J�B��I�I���	�	�	��G�B�G�T�3�<�>�>�2�2�2��F�F�	����	<��w������"���6�6�
B���D�'�2�2�2�<��H�R�L�L�L�L���<�<�<� $�I��G�B�H�d�C�L�N�N�;�;�;�;�;�<����!�	�<��H�T�&�1�1�1�1�1���<�<�<��G�B�H�d�C�L�N�N�;�;�;�;�;�<����B�!�"I�J�J�J���B�B�B��G�B�G�N�D�#�,�.�.�A�A�A�A�A�B�����
<�<��H�R�L�L�L�L�L���<�<�<��G�B�H�d�C�L�N�N�;�;�;�;�;�;�<����
<�
<��9�
<�<��H�R�L�L�L�L���<�<�<��G�B�H�d�C�L�N�N�;�;�;�;�;�<����
<������%�&K�L�L�L�	��d�#�#�
G��E�F�F�F�
G���	�	�	��G�B�G�N�D�#�,�.�.�9�9�9��F�F�	�����d�G�,�,�,s��A+�+2B!� B!�%0C�2D�D�AJ�E)�(J�)4F �J�F � J�&F=�<J�=2G2�/J�1G2�2J�6H�7H?�<J�>H?�?J�I�2J�J�K(�J/�.K(�/2K$�!K(�#K$�$K(�=L�7M�Mc���tj|��}tjjtjjpdz}tj�|�|����S)aHA basename() variant which first strips the trailing slash, if present.
    Thus we always get the last component of the path, even for directories.

    path: Union[PathLike, str]

    e.g.
    >>> os.path.basename('/bar/foo')
    'foo'
    >>> os.path.basename('/bar/foo/')
    ''
    >>> _basename('/bar/foo/')
    'foo'
    �)rFr�rl�sep�altsepr��rstrip)rlrs  r'�	_basenamer!sJ���9�T�?�?�D�
�'�+����-�2�
.�C�
�7���D�K�K��,�,�-�-�-r&c��tjd||��|}tj�|��r�t||��r6tj�|��stj||��dStj�|t|����}tj�
|��rtd|z���	tj||���n^#t$�rPtj�|��r>tj
|��}tj||��tj|��n�tj�|��r�t!||��rtd|�d|�d����t#|��sCtj|tj��s:tj|��r&tjdkrt-d|�d	|�d����t/|||d
���t1|��n |||��tj|��YnwxYw|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 dst is an existing directory or a symlink to a directory, then src is
    moved inside that directory. The destination path in that directory must
    not already exist.

    If dst 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 existszCannot move a directory 'z' into itself 'z'.�darwinz%Cannot move the non-empty directory 'z ': Lacking write permission to 'T)r�r�)rIr�rFrlr�rsr{�renamer�r!r�rr6r�r�r�
_destinsrc�
_is_immutable�access�W_OK�listdir�platform�PermissionErrorrr)rqrrr��real_dstr�s     r'rr+sE��4�I�m�S�#�&�&�&��H�	�w�}�}�S���K��S�#���	�r�w�~�~�c�':�':�	�
�I�c�3�����F��7�<�<��Y�s�^�^�4�4��
�7�>�>�(�#�#�	K��>��I�J�J�J��
�	�#�x� � � � ������
�7�>�>�#���	��[��%�%�F��J�v�x�(�(�(��I�c�N�N�N�N�
�W�]�]�3�
�
�	��#�s�#�#�
3��e�(+���S�S�S�2�3�3�3��c�"�"�
4��I�c�2�7�3�3�
4�8:�
�3���
4��L�H�4�4�%�o�),���c�c�c�'3�4�4�4�
�S�(�-�"�
$�
$�
$�
$��3�K�K�K�K��M�#�x�(�(�(��I�c�N�N�N���)����*�Os�C4�4EI�Ic��tj�|��}tj�|��}|�tjj��s|tjjz
}|�tjj��s|tjjz
}|�|��Sru)rFrlro�endswithr�
startswithrps  r'r%r%ms���
�'�/�/�#�
�
�C�
�'�/�/�#�
�
�C��<�<����$�$���r�w�{����<�<����$�$���r�w�{����>�>�#���r&c��t|��}tjtjg}t	|d��o|j|vS)Nr�)rxrm�UF_IMMUTABLE�SF_IMMUTABLErkr�)rqr��immutable_statess   r'r&r&vs;��	�s���B��)�4�+<�=���2�z�"�"�F�r�{�6F�'F�Fr&c��|�dS	ddlm}n#t$rYdSwxYw	||��}n#t$rd}YnwxYw|�|dSdS)z"Returns a gid, given a group name.Nr)�getgrnam�)�grpr5�ImportError�KeyError)r7r5�results   r'�_get_gidr;{����|��t�� � � � � � � �������t�t��������$������������������
���a�y���4��
�
��+�:�:c��|�dS	ddlm}n#t$rYdSwxYw	||��}n#t$rd}YnwxYw|�|dSdS)z"Returns an uid, given a user name.Nr)�getpwnamr6)�pwdr?r8r9)r7r?r:s   r'�_get_uidrA�r<r=�gzipc	������|�d}	nRtr	|dkrd}	nBtr	|dkrd}	n2tr	|dkrd}	n"td�|�����d	dl}
|rd
|	znd}|dz|z}tj�|��}
|
rMtj�	|
��s.|�|�
d|
��|st
j|
��|�|�
d
��t����t��������fd�}|s�|
�|d|	z��}|}|� tj�||��}	|�|||���|���n#|���wxYw|�tj�|��}|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.
    NrrB�gz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.�.tar�creating %szCreating tar archivec�H�����|_�|_���|_�|_|Sru)�gid�gname�uid�uname)�tarinforL�group�ownerrNs ����r'�_set_uid_gidz#_make_tarball.<locals>._set_uid_gid�s.����?��G�K�!�G�M��?��G�K�!�G�M��r&zw|%s�r�)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorr��tarfilerFrl�dirnamer��infor�rAr;r�r��addr
ro)�	base_name�base_dir�compress�verbose�dry_runrRrQ�logger�root_dir�tar_compressionrY�compress_ext�archive_name�archive_dirrS�tar�arcnamerLrNs     ``          @@r'�
_make_tarballrj�s������ �����	�=�X��/�/����	�=�H��/�/����	�=�X��-�-�����+�+1�6�(�+;�+;�=�=�	=��N�N�N�,4�<�3��(�(�"�L��v�%��4�L��'�/�/�,�/�/�K��%�2�7�>�>�+�6�6�%����K�K�
�{�3�3�3��	%��K��$�$�$������*�+�+�+�
�5�/�/�C�
�5�/�/�C������������l�l�<��/�)A�B�B�������w�|�|�H�h�7�7�H�	��G�G�H�g�l�G�;�;�;��I�I�K�K�K�K��C�I�I�K�K�K�K�������w���|�4�4���s�F	�	Fc�8�ddl}|dz}	tj�|��}
|
rMtj�|
��s.|�|�d|
��|stj|
��|�|�d|	|��|�se|�|	d|j���5}tj�	|��}|� tj�
||��}tj�	|��}|tjkr.|�||��|�|�d|��tj
|��D�]{\}
}}|
}|� tj�||��}tj�	|��}t|��D]p}tj�
|
|��}tj�
||��}|�||��|�|�d|���q|D]�}tj�
|
|��}tj�	|��}tj�|��rNtj�
||��}|�||��|�|�d|������}	ddd��n#1swxYwY|�tj�|	��}	|	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�.ziprJz#creating '%s' and adding '%s' to it�w)�compressionzadding '%s')�zipfilerFrlrZr�r[r��ZipFile�ZIP_DEFLATED�normpathr��curdirrW�walk�relpath�sorted�isfilero)r]r^r`rarbrRrQrcro�zip_filenamerg�zfri�dirpath�dirnames�	filenames�
arcdirpathr7rls                   r'�
_make_zipfiler~�s ���N�N�N��v�%�L��'�/�/�)�,�,�K��%�2�7�>�>�+�6�6�%����K�K�
�{�3�3�3��	%��K��$�$�$�
�����9� �(�	,�	,�	,��=�
�_�_�\�3�)0�)=��?�?�	=�BD��g�&�&�x�0�0�G��#��7�<�<��(�;�;���w�'�'��1�1�H��"�)�#�#�����7�+�+�+��%��K�K�
�x�8�8�8�02���0A�0A�
=�
=�,���9�$�
��'�!#�����X�!F�!F�J��W�-�-�j�9�9�
�"�8�,�,�9�9�D��7�<�<���6�6�D� �g�l�l�:�t�<�<�G��H�H�T�7�+�+�+��)����M�4�8�8�8��%�=�=�D��7�<�<���6�6�D��7�+�+�D�1�1�D��w�~�~�d�+�+�=�"$�'�,�,�z�4�"@�"@������w�/�/�/�!�-�"�K�K�
�t�<�<�<��=�
=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�<���w���|�4�4���s�1H0K.�.K2�5K2rh)r_Nzuncompressed tar file)r_rBzgzip'ed tar-file�gztarzZIP file�zip)r_rEzbzip2'ed tar-file�bztar)r_rGzxz'ed tar-file�xztarc�t�d�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)
    c�(�g|]\}}||df��S)r6r%)r�r7�registrys   r'r�z'get_archive_formats.<locals>.<listcomp>:s1��)�)�)�~�t�X��h�q�k�"�)�)�)r&)�_ARCHIVE_FORMATS�items�sort��formatss r'rr5s>��
)�)��%�%�'�'�)�)�)�G��L�L�N�N�N��Nr&rc�H�|�g}t|��std|z���t|ttf��std���|D]@}t|ttf��rt|��dkrtd����A|||dft|<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 sequencer6z+extra_args elements are : (arg_name, value)F)�callable�	TypeErrorri�tupler��lenr�)r7�function�
extra_args�description�elements     r'rr?s������
��H���D��7�(�B�C�C�C��j�5�$�-�0�0�=��;�<�<�<��K�K���'�E�4�=�1�1�	K�S��\�\�A�5E�5E��I�J�J�J�6F�'�
�K��G��T���r&c��t|=dSru)r�r�s r'rrTs������r&c	�r�tjd||||��	t|}	n!#t$rt	d|z��d�wxYw||||d�}
|	d}|	dD]
\}}
|
|
|<�|�t
j}|	d}d}|��tj|��j}tj	|��sttjd|���|rtj
|��}||
d	<n`tj��}|�|�d
|��t
j�|��}|stj|��	|||fi|
��}|�,|�|�d|��tj|��n4#|�-|�|�d|��tj|��wwxYw|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_archivezunknown archive format '%s'N)rarbrRrQr��zNot a directoryrczchanging into '%s'zchanging back to '%s')rIr�r�r9rXrFrsrmr�r��NotADirectoryErrorr:�ENOTDIRr��getcwd�debugrlro�chdir)r]r�rcr^r`rarRrQrb�format_infor��func�arg�val�supports_root_dir�save_cwd�stmdr8s                  r'rrWs��$�I�#�Y���(�K�K�K�K�&�v�.�����K�K�K��6��?�@�@�d�J�K����!�F��u�.�.�F��q�>�D���N�����S���s������9��#�A����H����w�x� � �(���|�D�!�!�	Q�$�U�]�4E�x�P�P�P��
	#��	�)�,�,�I�!)�F�:����y�{�{�H��!����1�8�<�<�<�����	�2�2�I��
#����"�"�"���4�	�8�6�6�v�6�6�����!����4�h�?�?�?��H�X���������!����4�h�?�?�?��H�X����� ����
�Os�
(�A�

F�1F4c�t�d�t���D��}|���|S)z�Returns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    c�6�g|]\}}||d|df��S)rr�r%)r�r7r[s   r'r�z&get_unpack_formats.<locals>.<listcomp>�s7��(�(�(�J�D�$��d�1�g�t�A�w�'�(�(�(r&)�_UNPACK_FORMATSr�r�r�s r'rr�s>��(�(��$�$�&�&�(�(�(�G��L�L�N�N�N��Nr&c���i}t���D]\}}|dD]}|||<��|D]"}||vrd}t||||fz����#t|��st	d���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�r�r0r�r�)	�
extensionsr�r��existing_extensionsr7r[�ext�	extension�msgs	         r'�_check_unpack_optionsr��s�����%�+�+�-�-�,�,�
��d���7�	,�	,�C�'+���$�$�	,� �H�H�	��+�+�+�5�C���y�':�9�'E�'G�!G�H�H�
H�,�
�H���F��D�E�E�E�F�Fr&c�L�|�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)r�r�)r7r�r�r�r�s     r'rr�s:��"���
��*�h�
�;�;�;�&��*�k�I�O�D���r&c��t|=dS)z*Removes the pack format from the registry.N)r�r�s r'rr�s������r&c��tj�|��}tj�|��stj|��dSdS)z1Ensure that the parent directory of `path` existsN)rFrlrZr�r�)rlrZs  r'�_ensure_directoryr��sK���g�o�o�d�#�#�G�
�7�=�=��!�!��
��G�������r&c���ddl}|�|��std|z���|�|��}	|���D]�}|j}|�d��sd|vr�#tjj	|g|�
d���R�}|s�Pt|��|�d��sf|�
|d��5}t|d��5}t||��ddd��n#1swxYwYddd��n#1swxYwY��	|���dS#|���wxYw)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file�/z..�rr�)ro�
is_zipfiler.rp�infolistr8r/rFrlr��splitr�r.r�rr
)	r8�extract_dirror�r[r7�
targetpath�source�targets	         r'�_unpack_zipfiler��s����N�N�N����h�'�'�;��.��9�:�:�:�
�/�/�(�
#�
#�C���L�L�N�N�	0�	0�D��=�D����s�#�#�
�t�t�|�|�����k�D�D�J�J�s�O�O�D�D�D�J��
���j�)�)�)��=�=��%�%�
0��X�X�d�C�(�(�0�F��Z��.�.�0�28����/�/�/�0�0�0�0�0�0�0�0�0�0�0����0�0�0�0�0�0�0�0�0�0�0�0�0�0�0����0�0�0�0��	0�$	�	�	��������	�	�������sU�BE� D%�1D�D%�D�D%�D�D%�E�%D)	�)E�,D)	�-E�ErTc��ddl}	|�|��}n #|j$rtd|z���wxYw	|�||���|���dS#|���wxYw)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar filerT)rYr��TarErrorr.�
extractallr
)r8r�r�rY�tarobjs     r'�_unpack_tarfiler��s����N�N�N�J����h�'�'������J�J�J��=��H�J�J�	J�J��������+�f��5�5�5�������������������s��9�A*�*BrIrl)rhr�z.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzc��t���D]+\}}|dD]}|�|��r|ccS��,dS)Nr)r�r�r.)r8r7r[r�s    r'�_find_unpack_formatr�sh��%�+�+�-�-���
��d��a��	�	�I�� � ��+�+�
�������
�	��4r&c�|�tjd|||��|�tj��}tj|��}tj|��}|�i}nd|i}|�i	t
|}n1#t$r$td�|����d�wxYw|d}|||fit|d���|��dSt|��}|�"td�|�����t
|d}tt
|d��|z}|||fi|��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.

    If `filter` is given, it is passed to the underlying
    extraction function.
    zshutil.unpack_archiveNr�zUnknown unpack format '{0}'r�r6zUnknown archive format '{0}')rIr�rFr�r�r�r9rXr��dictr�r.)r8r�r�r��
filter_kwargsr�r�r�s        r'rrso��$�I�%�x��f�E�E�E����i�k�k���)�K�(�(�K��y��"�"�H�
�~��
�
�!�6�*�
�
��	U�)�&�1�K�K���	U�	U�	U��:�A�A�&�I�I�J�J�PT�T�	U�����1�~����X�{�L�L�d�;�q�>�&:�&:�L�m�L�L�L�L�L�%�X�.�.���>��:�A�A�(�K�K�L�L�L��v�&�q�)���o�f�-�a�0�1�1�M�A����X�{�-�-�f�-�-�-�-�-s�!
A/�/.B�statvfs�
disk_usage�usageztotal used freezTotal space in byteszUsed space in byteszFree space in bytesc��tj|��}|j|jz}|j|jz}|j|jz
|jz}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.
        )rFr��f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)rlr��free�total�useds     r'r�r�VsV���Z��
�
���{�R�[�(����b�k�)����b�j�(�B�K�7�� ���d�3�3�3r&c�\�tj|��\}}||z
}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.
        )r�
_getdiskusager�)rlr�r�r�s    r'r�r�gs3���&�t�,�,���t��t�|�� ���d�3�3�3r&c���tjd|||��|�|�td���|}|}|�d}nHt|t��r3t|��}|�"t
d�|�����|�d}nHt|t��s3t|��}|�"t
d�|�����tj|||��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})rIr�rXrir�rA�LookupErrorr��intr;rFr)rl�userrQ�_user�_groups     r'rrrs����I�n�d�D�%�0�0�0��|��
��8�9�9�9��E�
�F��|����	�D�#�	�	�A�������=��2�9�9�$�?�?�@�@�@��}����
��s�
#�
#�C��%�����>��3�:�:�5�A�A�B�B�B��H�T�5�&�!�!�!�!�!r&��P�c�H�	ttjd��}n#ttf$rd}YnwxYw	ttjd��}n#ttf$rd}YnwxYw|dks|dkr�	tjtj�����}n1#tttf$rtj|��}YnwxYw|dkr|jp|d}|dkr|j
p|d}tj||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.
    �COLUMNSr�LINESr�)r�rF�environr9rXrrI�
__stdout__r4�AttributeErrorr6�
terminal_size�columns�lines)�fallbackr�r��sizes    r'rr�sD��(��b�j��+�,�,�����j�!��������������B�J�w�'�(�(�����j�!�������������!�|�|�u��z�z�	.��'���(=�(=�(?�(?�@�@�D�D���
�G�4�	.�	.�	.��#�H�-�-�D�D�D�	.�����a�<�<��l�1�h�q�k�G��A�:�:��J�-�(�1�+�E�
��W�e�,�-�-�-s/�"�8�8�A�A2�1A2�0B3�3+C!� C!c��tj�|��o4tj||��otj�|��Sru)rFrlr�r'r�)rwr�s  r'�
_access_checkr��sD���G�N�N�2���
&�2�9�R��#6�#6�
&��G�M�M�"�%�%�%�'r&c���tj����rt�|��r�SdSt	�t
��}|�[tj�dd��}|�9	tjd��}n##ttf$rtj}YnwxYw|sdS|rFtj|��}|�
tjtj����}n3tj|��}|�
tj��}t jdkr�tj}|rtj|��}||vr|�d|��tjd��pt*}d�|�
tj��D��}|rd�|D��}t-�fd	�|D����r�g}n�fd
�|D��}n�g}t/��}|D]u}	tj�|	��}
|
|vrP|�|
��|D]8}tj�|	|��}t||��r|ccS�9�vdS)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_PATH�win32r�PATHEXTc��g|]}|�|��Sr%r%�r�r�s  r'r�zwhich.<locals>.<listcomp>�s��J�J�J�3�c�J�3�J�J�Jr&c�6�g|]}tj|����Sr%)rF�fsencoder�s  r'r�zwhich.<locals>.<listcomp>�s"��;�;�;�C�r�{�3�'�'�;�;�;r&c3��K�|]=}�����|�����V��>dSru)�lowerr.�r�r��cmds  �r'�	<genexpr>zwhich.<locals>.<genexpr>sA�����D�D�S�s�y�y�{�{�#�#�C�I�I�K�K�0�0�D�D�D�D�D�Dr&c���g|]}�|z��Sr%r%r�s  �r'r�zwhich.<locals>.<listcomp>s���2�2�2�3�S�3�Y�2�2�2r&)rFrlrZr�rirr��get�confstrr�rX�defpathr�r��pathseprrIr*rs�insert�getenv�_WIN_DEFAULT_PATHEXT�anyr�rnr\r�)
r�r�rl�	use_bytesrs�pathext_source�pathext�files�seen�dir�normdir�thefiler7s
`            r'rr�s����
�w���s������d�#�#�	��J��t��3��&�&�I��|��z�~�~�f�d�+�+���<�
"��z�)�,�,����"�J�/�
"�
"�
"��z����
"�������t��&��{�4� � ���z�z�"�+�b�j�1�1�2�2����{�4� � ���z�z�"�*�%�%��
�|�w�������	)��[��(�(�F������K�K��6�"�"�"���9�-�-�E�1E��J�J�.�"6�"6�r�z�"B�"B�J�J�J���	<�;�;�7�;�;�;�G�
�D�D�D�D�G�D�D�D�D�D�	3��E�E�E�2�2�2�2�'�2�2�2�E�E�����5�5�D�� � ���'�"�"�3�'�'���$����H�H�W���� �
 �
 ���w�|�|�C��1�1�� ��t�,�,� ��K�K�K�K�K� ���4s�/B�B$�#B$)r)F)FN)rBrrNNNN)rrNNNN)Nr)NNrrNNN)NN)r�)fr*rFrIrmr��collectionsr:�zlibrUr8rFrV�lzmarWr7r�rrrbrkr*r/rMr�r�__all__r6rr rrr.r5r0r2rCrTr`rrsrxr|r	r
r�rrr
rr�r�stat_resultr�r�rrr�rr�supports_dir_fdr��supports_fdr�rr�avoids_symlink_attacksr!rr%r&r;rArjr~r�rrrrrr�rrr�r�r�r�r�rr��
namedtupler�r�r�r�r�rrr��F_OK�X_OKrr%r&r'�<module>rs�	����
�	�	�	�
�
�
�
�������������������K�K�K���O�O�������O�O�O�������J�J�J���N�N�������N�N�N�������K�K�K���O�O�������O�O�O������7�d�?��
�����7�g����L�L�L�L�
��
�I�I�I�&�5�{�{�I���7�2�z�*�*�O�s�|�/F�/F�w�/O�/O���7�7�7�5�,�7�7��?������	�	�	�	�	�G�	�	�	�@�@�@�@�@�E�@�@�@�;�;�;�;�;�w�;�;�;�6�6�6�6�6��6�6�6�0�0�0�0�0��0�0�0�&�&�&�&�&�I�&�&�&������	����
 � � �(>�>�>�@.:�����&����4�4�4�$E�E�E�R�R�R�+/�>�>�>�>�>�@+/�.�.�.�.�.�2�7�2�{���
�04�������0
�
�
�+/�H�H�H�H�H�T'+������$(,������"
�
�
�7<�@�@�@�@�D!&�d�%�&+�5�.2�.2�.2�.2�`�7�2�>�/�0�0�$�����������$�$�$�0�0�0�>>=�>=�>=�@�g�r�w��	�2�8�<��'�(�<��Z�2�>�1�<��W�� ;�;��
M-�d�M-�M-�M-�M-�M-�b!2���.�.�.�$"'�@�@�@�@�D���G�G�G�
���$���$LM�@D�D�D�D�D�L;<�@D�7�7�7�7�~
�m�0�1�%�t�-���
�D�!.�1E�0F� 2�D�!:��W��,�b�*�d�C��U���;�!.�1F�0G� 3�T�!;��W���8�!.�1C�0D� 0�$�!8��W�����H�H�H�H�*���KL�;?�=�=�=�=�@	�	�	�F�F�F�$CG�')�J�J�J�J�,���������<6:������(�h���-D�
E��h���Z�
8����
�4�!*�F� 3�_�b� 2� 4�O�G���5�!+�W� 5��� 3� 5�O�G���2�!*�F� 3�_�b� 0� 2�O�G�����..�d�..�..�..�..�..�b�7�2�y���!4��N�N�<� � � �.��.�w�8I�J�J��&<���#�%:���"�%:���"�
4�
4�
4�
4��
4��N�N�<� � � �.��.�w�8I�J�J��4�4�4�"�"�"�"�@+.�+.�+.�+.�b'�'�'�
�G�b�g�%�D�N�N�N�N�N�Ns-�$�.�.�:�A�A�A�A�A