%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/duplicity/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/duplicity/__pycache__/path.cpython-312.pyc

�

�2epo��&�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZddlmZddlm
Z
ddlmZdd	lmZdd
l�daGd�d
e�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zy)z�Wrapper class around a file like "/usr/bin/env"

This class makes certain file operations more convenient and
associates stat information with filenames

�N)�
cached_ops)�config)�dup_time)�file_naming)�gpg)�librsync)�tarfile)�*�c��eZdZdZdZy)�
StatResultz3Used to emulate the output of os.stat() and relatedrN)�__name__�
__module__�__qualname__�__doc__�st_mode���0/usr/lib/python3/dist-packages/duplicity/path.pyr
r
1s��=��Grr
c��eZdZy)�
PathExceptionN)rrrrrrrr9s��rrc���eZdZdZd d�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd!d�Zd�Zd�Zd�Zd�Zd�Z y)"�ROPathz�Read only Path

    Objects of this class doesn't represent real files, so they don't
    have a name.  They are required to be indexed though.

    Nc�l�d\|_|_||_d\|_|_d\|_|_y)zROPath initializer�NNN)�opened�fileobj�index�stat�type�mode�devnums)�selfrrs   r�__init__zROPath.__init__Es3��$.�!���T�\���
�)���	�4�9�",���	�4�<rc�<�|jsd|_|jj}tj|�rd|_n�tj|�rd|_n�tj
|�rd|_n�tj|�rd|_n�tj|�r/ttj|j��dz��tj|�rd|_n(tj|�rd|_ntd	��tj|�|_|jd
vrY	tj!|jj"�tj%|jj"�f|_yy#t($ri}t*j-t/d�tj|j��|jj"fz�d|_Yd}~yd}~wwxYw)
z4Set the value of self.type, self.mode from self.statN�reg�dir�sym�fifozis a socket, unsupported by tar�chr�blkzUnknown type)r*r+z7Warning: %s invalid devnums (0x%X), treating as (0, 0).�rr)rr r�S_ISREG�S_ISDIR�S_ISLNK�S_ISFIFO�S_ISSOCKr�os�fsdecode�get_relative_path�S_ISCHR�S_ISBLK�S_IMODEr!�major�st_rdev�minorr"�	Exception�log�Warn�_)r#r�es   r�
set_from_statzROPath.set_from_statLs����y�y��D�I��)�)�#�#���<�<�� ��D�I�
�\�\�'�
"��D�I�
�\�\�'�
"��D�I�
�]�]�7�
#��D�I�
�]�]�7�
#�����D�,B�,B�,D� E�Hi� i�j�j�
�\�\�'�
"��D�I�
�\�\�'�
"��D�I���/�/��L�L��)��	��9�9��&�

&��H�H�T�Y�Y�.�.�/��H�H�T�Y�Y�.�.�/� ���'���
&�����O�P��{�{�4�#9�#9�#;�<�d�i�i�>O�>O�P�Q�� &�����
&�s�AF)�)	H�2AH�Hc�"�d\|_|_y)z*Black out self - set type and stat to NonerN)r r�r#s r�blankzROPath.blankrs��)���	�4�9rc��|jS)z!True if corresponding file exists�r rBs r�existsz
ROPath.existsvs���y�y�rc� �|jdk(S)z(True if self corresponds to regular filer&rErBs r�isregzROPath.isregz����y�y�E�!�!rc� �|jdk(S)zTrue if self is dirr'rErBs r�isdirzROPath.isdir~rIrc� �|jdk(S)zTrue if self is symr(rErBs r�issymzROPath.issym�rIrc� �|jdk(S)zTrue if self is fifor)rErBs r�isfifoz
ROPath.isfifo�����y�y�F�"�"rc� �|jdk(S)zTrue is self is socket�sockrErBs r�issockz
ROPath.issock�rPrc�B�|jdk(xs|jdk(S)zTrue is self is a device filer*r+rErBs r�isdevzROPath.isdev�s���y�y�E�!�7�T�Y�Y�%�%7�7rc�.�|jjS)z$Return device number path resides on)r�st_devrBs r�	getdevloczROPath.getdevloc�s���y�y���rc�.�|jjS)z'Return length in bytes from stat object)r�st_sizerBs r�getsizezROPath.getsize�s���y�y� � � rc�@�t|jj�S)z"Return mod time of path in seconds)�intr�st_mtimerBs r�getmtimezROPath.getmtime�s���4�9�9�%�%�&�&rc�R�|jrdj|j�Sy)z(Return relative path, created from index�/�.)r�joinrBs rr4zROPath.get_relative_path�s���:�:��9�9�T�Z�Z�(�(�rc�l�|j}|j�d|j�d|jd��S)z(Return permissions mode, owner and group�:� �o)r�st_uid�st_gidr!)r#�s1s  r�getpermszROPath.getperms�s0��
�Y�Y���)�)��A�b�i�i�[��$�)�)�A��7�7rc��|dk(r|jr|jr#J|�d|j�d|j����d|_|jS)z#Return fileobj associated with self�rbrfr�rr�r#r!s  r�openzROPath.open�sO���t�|����T�[�[�h�T�F�!�D�L�L�>�YZ�[_�[f�[f�Zg�Bh�h�@�����|�|�rc�l�|jd�}|j�}|j�rJ�|S)z/Return contents of associated fileobj in stringrm)rp�read�close)r#�fin�bufs   r�get_datazROPath.get_data�s-���i�i��o���h�h�j���9�9�;����
rc�<�|jrJ�||_d|_y)z"Set file object returned by open()Nrn)r#rs  r�
setfileobjzROPath.setfileobj�s���<�<��������rc�2�|j}|tjk(s|tjk(r	d|_�nB|tjk(rtd��|tjk(r]d|_|j|_t|jdj�r�tj|j�|_n�|tjk(r%d|_|j|jf|_n||tj"k(r%d|_|j|jf|_nD|tj$k(rd|_n)|tj&k(rd|_ntd	|����|j(|_t+�|_		t.j0rt2�t5j6|j8�d
|j,_	t.j0rt2�t5j>|j@�d
|j,_!tG|jH�|j,_%|j,jJdkr<tLjOtQd�|jRz�d|j,_%|jT|j,_+y
#t2$r|j<|j,_Y��wxYw#t2$r|jD|j,_!Y��wxYw)z5Set data from tarinfo object (part of tarfile module)r&zHard links not supported yetr(�r*r+r'r)zUnknown tarinfo type �r�.Warning: %s has negative mtime, treating as 0.N),r r	�REGTYPE�AREGTYPE�LNKTYPEr�SYMTYPE�linkname�symtext�
isinstance�	__class__r2�fsencode�CHRTYPE�devmajor�devminorr"�BLKTYPE�DIRTYPE�FIFOTYPEr!r
rr�
numeric_owner�KeyErrorr�getpwnam�unamerh�uid�getgrnam�gnameri�gidr]�mtimer^r<r=r>�uc_name�sizerZ)r#�tarinfor s   r�init_from_tarinfozROPath.init_from_tarinfo�s<���|�|���7�?�?�"�d�g�.>�.>�&>��D�I�
�W�_�_�
$�� >�?�?�
�W�_�_�
$��D�I�"�+�+�D�L��$�,�,����5�!�{�{�4�<�<�8���
�W�_�_�
$��D�I�#�,�,�g�.>�.>�?�D�L�
�W�_�_�
$��D�I�#�,�,�g�.>�.>�?�D�L�
�W�_�_�
$��D�I�
�W�%�%�
%��D�I��"7��v� >�?�?��L�L��	��L��	�	�	+��#�#���)�2�2�7�=�=�A�!�D�D�I�I��	+��#�#���)�2�2�7�=�=�A�!�D�D�I�I��!����/��	�	���9�9����!��H�H�Q�G�H�7�?�?�Z�[�!"�D�I�I��#�L�L��	�	����	+�&�{�{�D�I�I��	+���	+�&�{�{�D�I�I��	+�s&� AK�(AK/�$K,�+K,�/$L�Lc�T�t|j|j�}|j|jc|_|_|j�r|j|_n!|j�r|j|_|j�r|j|_|S)zReturn ropath copy of self)
rrrr r!rMr�rUr"rF)r#�
new_ropaths  r�
get_ropathzROPath.get_ropath�sr���D�J�J��	�	�2�
�+/�9�9�d�i�i�(�
�����:�:�<�!%���J��
�Z�Z�\�!%���J���;�;�=�"�i�i�J�O��rc���tj�}|jr4tj	dj|j��|_nd|_|j�r|xjdz
c_d|_|j�r|j�r2tj|_	|jj|_�nG|j�rtj|_	�n |j�rtj |_	n�|j#�retj$|_	|j&|_t+|j(t,�r�tj	|j(�|_n�|j/�rT|jdk(rtj0|_	ntj2|_	|j4\|_|_n!t;dt=|j�����|j>|_|jj@|jjBc|_"|_#|jjHdkrJtJjMtOd�tj	|jQ��z�d|_)n$tU|jjH�|_)	tWjX|jD�d|_-	tWj^|jF�d|_0|jtj0tj2fvr9tctd	�r)tctd
�r|j4\|_|_|Sd\|_|_|S#t\$r
d|_-Y��wxYw#t\$r
d|_0Y��wxYw)z�Generate a tarfile.TarInfo object based on self

        Doesn't set size based on stat, because we may want to replace
        data wiht other stream.  Size should be set separately by
        calling function.

        ra�.�/rr*zUnrecognized type r|rzr8r:r,)2r	�TarInforr2r3rc�namerKr�r rHr}rrZr�rOr�rMr�r�r�r��bytesrUr�r�r"r�r�r�strr!rhrir�r�r^r<r=r>r4r�r]r�getpwuidr�r��getgrgidr��hasattr)r#�tis  r�get_tarinfozROPath.get_tarinfo�s����_�_�
���:�:��k�k�$�)�)�D�J�J�"7�8�B�G��B�G��:�:�<��G�G�s�N�G�����9�9��z�z�|�!�/�/����)�)�+�+�������!�/�/�������!�*�*�������!�/�/���"�l�l����b�k�k�5�1�"$�+�+�b�k�k�":�B�K������9�9��%�%�o�o�B�G�%�o�o�B�G�+/�<�<�(���R�[�#�&8��T�Y�Y��8H�$I�J�J��i�i�B�G�!�Y�Y�-�-�t�y�y�/?�/?�N�B�F�B�F��y�y�!�!�A�%�����K�L�PR�P[�P[�\`�\r�\r�\t�Pu�v�w�����t�y�y�1�1�2���
�%�.�.�r�v�v�6�q�9���
�%�.�.�r�v�v�6�q�9����w�w�7�?�?�G�O�O�<�<��2�w�'�G�B��,@�/3�|�|�,�B�K����	� $��B�G�R�W��	���
����
���
����
�s$�.'N5�'O�5O�O�O�Oc��|js
|jsy|js|js|js
|jry|j|jk7ry|j�s |j�s|j	�r�|j|�syt
|jj�t
|jj�k(ry|jjdkxr|jjdkS|j�r|j|jk(S|j�r,|j|�xr|j|jk(SJ�)z6Used to compare two ROPaths.  Doesn't look at fileobjsrr)r rrHrKrO�perms_equalr]r^rMr�rUr"�r#�others  r�__eq__z
ROPath.__eq__Cs���y�y������y�y�U�Z�Z�u�z�z�d�i�i���9�9��
�
�"���:�:�<�4�:�:�<�4�;�;�=��#�#�E�*���4�9�9�%�%�&�#�e�j�j�.A�.A�*B�B���9�9�%�%��*�G�u�z�z�/B�/B�a�/G�G�
�Z�Z�\��<�<�5�=�=�0�0�
�Z�Z�\��#�#�E�*�L�t�|�|�u�}�}�/L�L��qrc�&�|j|�S�N)r�r�s  r�__ne__z
ROPath.__ne__\s���;�;�u�%�%�%rc	����fd�}|dury�js
|jsy�js|jr|td��y|js�jr|td��y�j|jk7r+|td�|j�jfz�y�j�s!�j	�s�j��ra�j
|�s3|td	�|j��j�fz�yt�jj�t|jj�k7r��jjdkDs|jjdkDrw|td
�tjt|jj��tjt�jj��fz�y�j�r$�j|�ry|td��yy�j�r��j|jk(s=�jtj!tj"�z|jk(ry|td�|j�jfz�y�j%�r��j
|�s3|td	�|j��j�fz�y�j&|j&k7r+|td
�|j&�j&fz�yyJ�)a'Compare ROPaths like __eq__, but log reason if different

        This is placed in a separate function from __eq__ because
        __eq__ should be very time sensitive, and logging statements
        would slow it down.  Used when verifying.

        Only run if include_data is true.

        c���td��d|��}tj|tj	�j��z�y)NzDifference found:rf)r>r<�Noticer2r3r4)�
log_string�log_strr#s  �r�log_diffz(ROPath.compare_verbose.<locals>.log_diffjs=����.�/�0��*��>�G��J�J�w�"�+�+�d�.D�.D�.F�"G�H�IrFTrzNew file %srzFile %s is missingz!File %%s has type %s, expected %sz(File %%s has permissions %s, expected %sz"File %%s has mtime %s, expected %szData for file %s is differentz%Symlink %%s points to %s, expected %sz+Device file %%s has numbers %s, expected %s)r rr>rHrKrOr�rkr]r^r�timetopretty�compare_datarMr�r2r��seprUr")r#r��include_datar�s`   r�compare_verbosezROPath.compare_verbose_s����	J��5� ���y�y������y�y�U�Z�Z��Q�}�%�&���z�z�d�i�i��Q�+�,�-���9�9��
�
�"��Q�:�;�u�z�z�4�9�9�>U�U�V���:�:�<�4�:�:�<�4�;�;�=��#�#�E�*���E�F�%�.�.�JZ�\`�\i�\i�\k�Il�l�m���D�I�I�&�&�'�3�u�z�z�/B�/B�+C�C��	�	�"�"�Q�&�%�*�*�*=�*=��*A���:�;� �-�-�c�%�*�*�2E�2E�.F�G� �-�-�c�$�)�)�2D�2D�.E�F������z�z�|��$�$�U�+���Q�>�?�@���
�Z�Z�\��|�|�u�}�}�,����r�{�{�2�6�6�?R�0R�V[�Vc�Vc�0c����B�C�u�}�}�VZ�Vb�Vb�Fc�c�d��
�Z�Z�\��#�#�E�*���E�F�%�.�.�JZ�\`�\i�\i�\k�Il�l�m���|�|�u�}�}�,���H�I�U�]�]�\`�\h�\h�Li�i�j����qrc����|jd��|jd����fd�}	�jtj�}�jtj�}||k7r|�y|s|�y�V)z8Compare data from two regular files, return true if samermc�N���j�rJ��j�rJ�yr�)rs)�f1�f2s��rrsz"ROPath.compare_data.<locals>.close�s!����x�x�z�!�>��x�x�z�!�>�zrrr)rprrr�copy_blocksize)r#r�rs�buf1�buf2r�r�s     @@rr�zROPath.compare_data�so���
�Y�Y�t�_��
�Z�Z��
��	"���7�7�6�0�0�1�D��7�7�6�0�0�1�D��t�|��������rc���|j|j}}|j|jk(xr4|j|jk(xr|j|jk(S)z:True if self and other have same permissions and ownership)rr!rirh)r#r�rj�s2s    rr�zROPath.perms_equal�sM�����E�J�J�B���y�y�E�J�J�&�\�2�9�9��	�	�+A�\�b�i�i�SU�S\�S\�F\�\rc��|j�r"|j|jd���n�|j�r!tj|j��nb|j�r�tj|j|j�tjrItj|j|jj|jj�|j!�y|j#�r tj%|j�n�|j'�r=t)j(t(j*�j-|j�nA|j/�r1|j0dk(rd}nd}|j2|g|j4���|j7|�y)z:Copy self to other.  Also copies data.  Other must be PathrmNr*�c�b)rH�writefileobjrprKr2�mkdirr�rM�symlinkr�r�restore_ownership�lchownrrhri�setdatarO�mkfiforS�socket�AF_UNIX�bindrUr �makedevr"�copy_attribs)r#r��devtypes   r�copyzROPath.copy�s���:�:�<����t�y�y���/�
�Z�Z�\��H�H�U�Z�Z� �
�Z�Z�\��J�J�t�|�|�U�Z�Z�0��'�'��	�	�%�*�*�d�i�i�&6�&6��	�	�8H�8H�I��M�M�O��
�[�[�]��I�I�e�j�j�!�
�[�[�]��M�M�&�.�.�)�.�.�u�z�z�:�
�Z�Z�\��y�y�E�!������E�M�M�'�1�D�L�L�1����%� rc�V���t�t�r��j�sg�jr)tj
rtj��fd��tj��fd��tj��fd���j�yt�t�sJ�t�}�jj�jjc|_|_t�jj�|_|�_�j�_y)z'Only copy attributes from self to otherc���tj�j�jj�jj
�Sr�)r2�chownr�rrhri�r�r#s��r�<lambda>z%ROPath.copy_attribs.<locals>.<lambda>�s/���R�X�X�e�j�j�$�)�)�JZ�JZ�\`�\e�\e�\l�\l�5m�rc�X��tj�j�j�Sr�)r2�chmodr�r!r�s��rr�z%ROPath.copy_attribs.<locals>.<lambda>�s������%�*�*�d�i�i�1P�rc���tj�jtj��jj
f�Sr�)r2�utimer��timerr^r�s��rr�z%ROPath.copy_attribs.<locals>.<lambda>�s.������%�*�*�t�y�y�{�TX�T]�T]�Tf�Tf�Fg�1h�rN)r��PathrMrrr��util�maybe_ignore_errorsr�rr
rhrir]r^r!)r#r�rs`` rr�zROPath.copy_attribs�s�����e�T�"��:�:�<��9�9��!9�!9��,�,�-m�n��(�(�)P�Q��(�(�)h�i��M�M�O��e�V�,�,�,��<�D�'+�y�y�'7�'7����9I�9I�$�D�K�����	�	� 2� 2�3�D�M��E�J����E�Jrc�b�dtj|j��d|j�d�S�zReturn string representation�(rf�))r��uindexrr rBs r�__str__zROPath.__str__�s)���4�;�;�t�z�z�*�+�1�T�Y�Y�K�q�9�9rr�)r)!rrrrr$r@rCrFrHrKrMrOrSrUrXr[r_r4rkrprvrxr�r�r�r�r�r�r�r�r�r�r�rrrrr=s����-�$&�L*��"�"�"�#�#�8� �!�'��8�
���4)�l
�B�H�2&�C�J�&]�
!�0#�$:rrc����eZdZdZej
d�Zd�Zd�fd�	Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zdd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd d�Zd�Zd d�Zd�Zd�Z d�Z!�xZ"S)!r�z�
    Path class - wrapper around ordinary local files

    Besides caching stat() results, this class organizes various file
    code.
    z	[\\\"\$`]c���tjr|s|Stjj	tjj
|��}g}|r[|tjvrItjj
|�\}}|jd|�|r|tjvr�I|rFtj|j
tjtj��|zS|S)Nr)
r�renamer2�path�normcaserc�split�insertr�r�)r#rr��tail�extras     r�rename_indexzPath.rename_index�s����}�}�E��L��w�w��������e� 4�5�����t�6�=�=�0��'�'�-�-��-�K�D�%��K�K��5�!��t�6�=�=�0���=�=��&�,�,�R�[�[����-@�A�D�H�H��Lrc���t�|�|�d\|_|_t	|t
�rtj|�}||_|j|�|_
t
jj|g|j���|_
tj|j�|_|j!�y)zPath initializerrN)�superr$rrr�r�r2r��baser�rr�rcr�r3r�r�)r#r�rr�s   �rr$z
Path.__init__s����	�����$.�!���T�\��d�C� ��;�;�t�$�D���	��&�&�u�-��
��G�G�L�L��3��
�
�3��	��{�{�4�9�9�-������rc���	tjr%tj|j�|_n$tj|j�|_|j
�|j�r%tj|j�|_	yy#t$rC}tj|j}|dvrd\|_|_
d|_n�Yd}~yd}~wwxYw)zRefresh stat cache)�ENOENT�ENOTDIR�ELOOP�ENOTCONN�ENODEVrN)r�
copy_linksr2rr��lstatr@rM�readlinkr��OSError�errno�	errorcoder r!)r#r?�
err_strings   rr�zPath.setdatas���	6�� � ��G�G�D�I�I�.��	��H�H�T�Y�Y�/��	�
��� ��z�z�|�!�{�{�4�9�9�5������	�������1�J��Q�Q�'1�$��	�4�9� ��	����		�s�AB!�!	C-�*9C(�(C-c��t|dj�rtj|�}|j|j|j
|fz�S)z'Return new Path with ext added to indexrz)r�r�r2r�r�r)r#�exts  r�appendzPath.append,s>���c�2�<�<�(��+�+�c�"�C��~�~�d�i�i����s�f�)<�=�=rc�:�|j|j|�S)z Return new Path with index index)r�r�)r#rs  r�	new_indexzPath.new_index2s���~�~�d�i�i��/�/rc�@�tj|j�S)z#Return list generated by os.listdir)r2�listdirr�rBs rrzPath.listdir6s���z�z�$�)�)�$�$rc�H�|j�xr|j�S)z/Return true if path is a directory and is empty)rKrrBs r�
isemptydirzPath.isemptydir:s���z�z�|�2�D�L�L�N� 2�2rc��t|dj�rtj|�}|j	�xr||j�vS)z5Return true if path is a directory and contains childrz)r�r�r2r�rKr)r#�childs  r�containsz
Path.contains>s<���e�R�\�\�*��K�K��&�E��z�z�|�7������ 7�7rc��|jrJ�|jr|j}|St|j|�}|S)z�
        Return fileobj associated with self

        Usually this is just the file data on disk, but can be
        replaced with arbitrary data using the setfileobj method.
        )rrrpr�)r#r!�results   rrpz	Path.openFs>���;�;����<�<��\�\�F��
��$�)�)�T�*�F��
rc���d|j|t|�t|�g}tjtjd|�dk7rtd|����|j
�y)z8Make a device file with specified type, major/minor nums�mknodrzError running N)r�r�r2�spawnvp�P_WAITrr�)r#r r8r:�cmdlists     rr�zPath.makedevTsR���D�I�I�t�S��Z��U��D��
�:�:�b�i�i��'�2�a�7��.��	� :�;�;����rc�*�tjtd�|jz�	tj|j�|j�y#t$r,tjstd|j��d��Y�EwxYw)z#Make directory(s) at specified pathzMaking directory %szError creating directory �N)r<�Infor>r�r2�makedirsr�r�r�forcerr�rBs rr�z
Path.mkdir[sw������(�)�D�L�L�8�9�	S��K�K��	�	�"�	
������	S��<�<�#�&?����~�$N�PQ�R�R� �	S�s�A�2B�Bc�T�tjtd�|jz�|j	�r/t
j
tj|j�n.t
j
tj|j�|j�y)zRemove this filezDeleting %sN)r<rr>r�rKr��ignore_missingr2�rmdirr��unlinkr�rBs r�deletezPath.deletees^������=�!�D�L�L�0�1��:�:�<�������$�)�)�4�����	�	�4�9�9�5����rc��tjtd�|jz�|j	d�}|j�y)z#Open the file, write 0 bytes, closezTouching %s�wbN)r<rr>r�rprs)r#�fps  r�touchz
Path.touchns2������=�!�D�L�L�0�1�
�Y�Y�t�_��
���
rc�4�ddlm}tjt	d�|j
z�t
tg�}|j|�j�D]}||j|��|j�|j�y)z2Remove self by recursively deleting files under itr��	selectionzDeleting tree %sN)
�	duplicityr%r<rr>r��IterTreeReducer�PathDeleter�Select�set_iterr�Finishr�)r#r%�itrr�s    r�deltreezPath.deltreetso��'�����%�&����5�6��k�2�.���$�$�T�*�3�3�5�	"�D���
�
�D�!�	"��
�
�����rc��|jr#t|j|jdd�S|jjd�}t	|�dk(r|dstd�Stdj|dd��S)z Return directory that self is inN���rar{r)rr�r�r��lenrc�r#�
componentss  r�get_parent_dirzPath.get_parent_dirsl���:�:���	�	�4�:�:�c�r�?�3�3�������.�J��:��!�#�J�q�M��D�z�!��D�I�I�j��"�o�6�7�7rc��|jd�}	|jtj�}|sn|j	|��4|j�s|j�rt
d��|j�y)z4Copy file object fin to self.  Close both when done.r zError closing file objectN)rprrrr��writersrr�)r#rt�foutrus    rr�zPath.writefileobj�sd���y�y������(�(�6�0�0�1�C����J�J�s�O�	�
�9�9�;�$�*�*�,�� ;�<�<����rc��tj|j|j�|j�|j�y)z(Rename file at current path to new_path.N)�shutil�mover�r��r#�new_paths  rr�zPath.rename�s-�����D�I�I�x�}�}�-��������rc�F�|j|�|j�y)z;Like rename but destination may be on different file systemN)r�rr:s  rr9z	Path.move�s���	�	�(�����
rc�d�tj|j|�|j�y)zChange permissions of the pathN)r2r�r�r�ros  rr�z
Path.chmod�s��
������D�!����rc��|j�r|j�sJ�|j�}|jd�}|jd�}tj||�}|j|�|j
�rJ�|j
�rJ�|j|�|j|�y)z2Patch self with diff and then copy attributes overrmN)	rH�get_temp_in_same_dirrpr�PatchedFiler�rsr�r�)r#�diff_ropath�	temp_path�fbase�fdiff�
patch_fileobjs      r�patch_with_attribszPath.patch_with_attribs�s����z�z�|�� 1� 1� 3�3�3��-�-�/�	��	�	�$���� � ��&�� �,�,�U�E�:�
����}�-��;�;�=� � ��;�;�=� � �� � ��+�����rc���|j�}	|jdtt����}|js|Stdz
atdksJd|j
�����V)z7Return temp non existent path in same directory as selfzduplicity_temp.ri'z(Warning too many temp files created for )r3rr��_tmp_path_counterr r�)r#�
parent_dirrBs   rr?zPath.get_temp_in_same_dir�ss���(�(�*�
��"�)�)�O�C�@Q�<R�;S�*T�U�I��>�>� � ���"��$�u�,�g�0X�Y]�Ye�Ye�Xf�.g�g�,�rc��ddlm}|j|�j�}|j|�j�}tj|||�S)z7Compare self to other Path, descending down directoriesrr$)r&r%r)r*�Iter�equal)r#r��verboser%�selfsel�othersels      r�compare_recursivezPath.compare_recursive�sJ��'��"�"�4�(�1�1�3���#�#�E�*�3�3�5���z�z�'�8�W�5�5rc�V�d|j�d|j�d|j�d�Sr�)rr�r rBs r�__repr__z
Path.__repr__�s)���4�:�:�,�a����~�Q�t�y�y�k��;�;rc�^�|s|j}d|jjd�|�zS)z�
        Return quoted version of s (defaults to self.name)

        The output is meant to be interpreted with shells, so can be
        used with os.system.
        z"%s"c�*�d|jd���S)N�\r)�group)�ms rr�zPath.quote.<locals>.<lambda>�s��"�Q�W�W�Q�Z�L�@Q�r)r��regex_chars_to_quote�sub)r#�ss  r�quotez
Path.quote�s0������A���1�1�5�5�6Q�ST�U�U�Urc���|d|dcxk(rdk(sJ�J�d}d}|t|�dz
kr8||dk(r|||dzz
}|dz
}n
|||z
}|dz
}|t|�dz
kr�8|S)z?Return unquoted version of string s, as quoted by above quote()rr/�"rzrrUr{)r0)r#rZr�is    r�unquotezPath.unquote�s�����t�q��u�#��#�#�#�#�#���
���#�a�&�1�*�n���t�t�|��!�A��E�(�"���Q����!�A�$����Q���
�#�a�&�1�*�n��
rc�T�|jjd�}|r|dsJ�|dS)z!Return filename of last componentrar/)r�r�r1s  r�get_filenamezPath.get_filename�s-���Y�Y�_�_�T�*�
��j��n�,�,��"�~�rc���dj|jjd�D�cgc]
}|s�|dk7s�|��c}�}|jddk(rd|zS|r|Sycc}w)z�
        Return string of canonical version of path

        Remove ".", and trailing slashes where possible.  Note that
        it's harder to remove "..", as "foo/bar/.." is not necessarily
        "foo", so we can't use path.normpath()
        rarbrr�)rcr�r�r�)r#�x�newpaths   r�
get_canonicalzPath.get_canonical�s]���)�)��	�	����(=�Q�1��q�D�y�Q�Q�R���<�<��?�c�!��'�>�!�
��N���
Rs�A�A�A)r)rmr�)#rrrr�re�compilerXr�r$r�rrrr
r
rpr�r�rr"r-r3r�r�r9r�rFr?rPrRr[r_rare�
__classcell__)r�s@rr�r��s�����&�2�:�:�o�6����*6�*>�0�%�3�8������	�	8�
���
�
�	h�6�<�	V���rr�c� �eZdZdZdd�Zdd�Zy)�DupPathz�
    Represent duplicity data files

    Based on the file name, files that are compressed or encrypted
    will have different open() methods.
    Nc���|r||_n@t|�dk(sJ�tj|d�|_|jsJd��tj|||�y)z�
        DupPath initializer

        The actual filename (no directory) must be the single element
        of the index, unless parseresults is given.

        rrz%must be a recognizable duplicity fileN)�prr0r�parser�r$)r#r�r�parseresultss    rr$zDupPath.__init__sV���"�D�G��u�:��?�"�?�!�'�'��a��1�D�G��7�7�C�C�C�7��
�
�d�D�%�(rc��|js|jrJ�|jjr|jjrJ�|r|jjsJ�|jjr tj|j|�S|jjrK|stj}|dk(rtjd||�S|dk(rtjd||�Sy|j|�S)z�
        Return fileobj with appropriate encryption/compression

        If encryption is specified but no gpg_profile, use
        config.default_profile.
        rmFr TN)
rrrl�	encrypted�
compressed�gzip�GzipFiler�r�gpg_profiler�GPGFilerp)r#r!rts   r�
filtered_openzDupPath.filtered_opens����;�;�t�|�|�3�3��G�G�%�%�$�'�'�*<�*<�=�=���7�7�$�$�$�$��7�7����=�=����D�1�1�
�W�W�
�
��$�0�0���t�|��{�{�5�$��<�<�����{�{�4��{�;�;���9�9�T�?�"r)rN)rmN)rrrrr$rvrrrrjrj�s���)�"#rrjc�(�eZdZdZd�Zd�Zd�Zd�Zy)r(z+Delete a directory.  Called by Path.deltreec��||_yr�)r��r#rr�s   r�
start_processzPathDeleter.start_process/s	����	rc�8�|jj�yr�)r�rrBs r�end_processzPathDeleter.end_process2s���	�	���rc�$�|j�Sr�)rKrys   r�can_fast_processzPathDeleter.can_fast_process5s���:�:�<��rc�$�|j�yr�)rrys   r�fast_processzPathDeleter.fast_process8s�����
rN)rrrrrzr|r~r�rrrr(r(,s��5��� �rr()rr�rrrfr8r�rr�r&rrrrrrr	�duplicity.lazyrH�objectr
r;rrr�rj�	ITRBranchr(rrr�<module>r�s���,�
��	�
�
��� ���!����������	�I�	�k:�V�k:�\
L�6�L�^/#�d�/#�d
�)�
r

Zerion Mini Shell 1.0