%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�2e#���ddlZddlZddlmZddlmZddlmZddlmZGd�dej�Z	ejde	�y)	�N)�backend)�config)�log)�BackendExceptionc�d�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�Par2Backendz�This backend wrap around other backends and create Par2 recovery files
    before the file and the Par2 files are transfered with the wrapped backend.

    If a received file is corrupt it will try to repair it on the fly.
    c�:�tjj||�||_	tj
|_	tj|_		tj�d�|_tj|j�|_dD]3}t|j|�s�t!||t#||dd���5|j$|_y#t$r
d|_Y��wxYw#t$r
d|_	Y��wxYw#t$r
d|_Y��wxYw)N�
�z -q -qz-q -q)�_get�_put�_list�_delete�_delete_list�_query�_query_list�_retry_cleanup�_error_code�_move�_close)r�Backend�__init__�
parsed_urlr�par2_redundancy�
redundancy�AttributeError�par2_volumes�volumes�par2_options�common_options�get_backend_object�
url_string�wrapped_backend�hasattr�setattr�getattr�delete_listr)�selfr�attrs   �@/usr/lib/python3/dist-packages/duplicity/backends/par2backend.pyrzPar2Backend.__init__%s����� � ��z�2�$���	!�$�4�4�D�O�	�!�.�.�D�L�	*�%+�%8�%8�$9��"@�D�� '�9�9�*�:O�:O�P���
�	=�D��t�+�+�T�2���d�G�D�$�q�r�(�$;�<�	=�$!�,�,����C�	!� �D�O�	!��
�	��D�L�	��
�	*�")�D��	*�s4�C�C1�D�C.�-C.�1D�D�D�Dc�(�|j�}|j�|j|�}|j�}tj
j
|�sEtj
jt	jt	j��|�}t	j||j��|j�tjd�dt|j��dt|j ��d|j"�dt	j$|j���d�	}|j'|�\}}	}
|r�tj(d�dt|j��d|j"�dt	j$|j���d�}|j'|�\}}	}
|stj(d	�|j+�g}|s6|j-�D]"}|j|j|���$n!tj.d
t|����|||�|D]}|||j1���|j3�y)a3create Par2 files and transfer the given file and the Par2 files
        with the wrapped backend.

        Par2 must run on the real filename or it would restore the
        temp-filename later on. So first of all create a tempdir and symlink
        the soure_path with remote_filename into this.
        zCreate Par2 recovery filesz	par2 c -rz -n� � "�"zDFailed to create par2 file with requested options, retrying with -n1z -n1 z'Successfully created par2 file with -n1z+FAILED to create par2 file with returncode N)�get_temp_in_same_dir�mkdir�append�
get_canonical�os�path�isabs�join�fsencode�getcwd�symlink�setdatar�Info�intrrr �fsdecode�subprocess_popen�Warn�delete�listdir�Error�get_filename�deltree)
r(�method�source_path�remote_filename�par2temp�source_symlink�
source_target�
par2create�
returncode�out�err�files_to_transfer�files
             r*�transferzPar2Backend.transferNs)���3�3�5������!����9��#�1�1�3�
��w�w�}�}�]�+��G�G�L�L����R�Y�Y�[�)A�=�Q�M�
�
�
�=�.�">�">�"@�A���� ����-�.���D�O�O�,�-�S��T�\�\�1B�0C�1�T�EX�EX�DY�Z����N�8�8�:�;�<�A�
?�	� $�4�4�Z�@��
�C����H�H�[�\��C����0�1��t�7J�7J�6K�L��K�K�� <� <� >�?�@��C�
�$(�#8�#8��#D� �J��S�����B�C�������� �(�(�*�
@��!�(�(�����)>�?�
@�
�I�I�C�C�
�O�CT�U�V��{�O�,�%�	.�D��4��*�*�,�-�	.�	����c�R�|j|jj||�y�N)rQr#r
�r(�local�remotes   r*�putzPar2Backend.put~s���
�
�d�*�*�/�/���?rRc�R�|j|jj||�yrT)rQr#rrUs   r*�movezPar2Backend.move�s���
�
�d�*�*�0�0�%��@rRc	�n�|j�}|j�|j|�}|jj	||�	|j|dz�}|jj	|j�|�d|j�dtj|j���dtj|j���d�}|j|�\}}}	|�r^tjd|���tj|j��d��}
|jj!�D�cgc])}|
j#tj|��s�(|��+}}|D]/}
|j|
�}|jj	|
|��1d|j�dtj|j���dtj|j���d�}|j|�\}}}	|rtj$d	|���ntjd
|���|j)|�|j+�ycc}w#t&$rY�2wxYw#|j)|�|j+�wxYw)atransfer remote_filename and the related .par2 file into
        a temp-dir. remote_filename will be renamed into local_path before
        finishing.

        If "par2 verify" detect an error transfer the Par2-volumes into the
        temp-dir and try to repair.
        s.par2zpar2 v r,r-r.zFile is corrupt. Try to repair z\.vol[\d+]*\.par2zpar2 r zFailed to repair zRepair successful N)r/r0r1r#rrCr r3r=r2r>rr?�re�compile�decoder�matchrBr�renamerD)r(rG�
local_pathrH�local_path_temp�par2file�
par2verifyrLrMrN�c�f�par2volumes�filenamerP�
par2repairs                r*�getzPar2Backend.get�sv���2�2�4������"�/�/�/�:�����!�!�/�?�C�"	������'A�B�H�� � �%�%�h�&;�&;�&=�x�H��$�-�-�.�a����H�<R�<R�<T�0U�/V�W��K�K�� =� =� ?�@�A��D�
�$(�#8�#8��#D� �J��S�����:�?�:K�L�M��J�J�/�"8�"8�":�!;�;O�P�Q��*.�*>�*>�*D�*D�*F�b�Q�!�'�'�RT�R]�R]�^_�R`�Ja�q�b��b� +�>�H�#�?�?�8�4�D��(�(�-�-�h��=�>�
�d�1�1�2�!�B�K�K��@V�@V�@X�4Y�3Z�[����O�$A�$A�$C�D�E�Q�H��(,�'<�'<�Z�'H�$�
�C����I�I� 1�/�1B�C�D��H�H�1�/�1B�C�D�

�"�"�:�.������+c��  �	��	��
�"�"�:�.�����s>�DJ�)I=�I=�CJ�=J�	J�J�
J�J�#J4c�d�|jj|�|j�}tjtj|��d��}|D]U}|jtj|��s�(|jjtj|���Wy)z)delete given filename and its .par2 files�(?:\.vol[\d+]*)?\.par2N)	r#r�unfiltered_listr\r]r3r=r_r7)r(rh�remote_listrerGs     r*r@zPar2Backend.delete�s������$�$�X�.��*�*�,���J�J�"�+�+�h�/�0�0I�J�K��*�	K�O��w�w�r�{�{�?�3�4��$�$�,�,�R�[�[��-I�J�	KrRc��|j�}|ddD]k}tjtj|��d��}|D]9}|jtj|��s�(|j
d|��;�mt|jd�r|jj|�S|D]}|jj|��y)zBdelete given filename_list and all .par2 files that belong to themNrlrr)rmr\r]r3r=r_�insertr$r#rr)r(�
filename_listrnrhrerGs      r*r'zPar2Backend.delete_list�s����*�*�,��%�a�(�	=�H��
�
�b�k�k�(�3�4�4M�N�O�A�#.�
=���7�7�2�;�;��7�8�!�(�(��O�<�
=�	=��4�'�'��8��'�'�4�4�]�C�C�)�
7���$�$�,�,�X�6�
7rRc���|jj�}tjd�}g}|D]8}|j	tj|��s�(|j|��:|S)z�
        Return list of filenames (byte strings) present in backend

        Files ending with ".par2" will be excluded from the list.
        z
(?!.*\.par2$))r#rr\r]r_r3r=r1)r(rnre�
filtered_listrhs     r*�listzPar2Backend.list�sf���*�*�0�0�2���J�J�'�(���
�#�	/�H��w�w�r�{�{�8�,�-��$�$�X�.�	/��rRc�6�|jj�SrT)r#r�r(s r*rmzPar2Backend.unfiltered_list�s���#�#�)�)�+�+rRc�8�|jj�yrT)r#rrvs r*�
retry_cleanupzPar2Backend.retry_cleanup�s�����+�+�-rRc�:�|jj||�SrT)r#r)r(�	operation�es   r*�
error_codezPar2Backend.error_code�s���#�#�/�/�	�1�=�=rRc�8�|jj|�SrT�r#r)r(rhs  r*�queryzPar2Backend.query�s���#�#�*�*�8�4�4rRc�8�|jj|�SrTr~)r(rqs  r*�
query_listzPar2Backend.query_list�s���#�#�*�*�=�9�9rRc�8�|jj�yrT)r#rrvs r*�closezPar2Backend.close�s�����#�#�%rRN)�__name__�
__module__�__qualname__�__doc__rrQrXrZrjr@r'rtrmrxr|rr�r��rRr*rrsS���'-�R.�`@�A�1�f	K�7�"
�,�.�>�5�:�&rRr�par2)r3r\�	duplicityrrr�duplicity.errorsrrr�register_backend_prefixr�rRr*�<module>r�s@��*
�	����-�T&�'�/�/�T&�n ������4rR

Zerion Mini Shell 1.0