https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/duplicity/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/duplicity/__pycache__/manifest.cpython-310.pyc
o

��`+H�@s�dZddlmZddlmZddlmZddlZddlZddlmZddlm	Z	ddlmZddlm
Z
Gd	d
�d
e�ZGdd�de�Z
Gd
d�de�ZGdd�de�Ze�d�Zdd�Zdd�Zdd�ZdS)z-Create and edit manifest for session contents�)�map)�range)�objectN)�config)�log)�utilc@�eZdZdZdS)�
ManifestErrorz5
    Exception raised when problem with manifest
    N��__name__�
__module__�__qualname__�__doc__�rr�4/usr/lib/python3/dist-packages/duplicity/manifest.pyr	%�r	c@s~eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
e
Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�Manifestz8
    List of volumes and information about each one
    NcCs"d|_d|_i|_||_g|_dS)z�
        Create blank Manifest

        @param fh: fileobj for manifest
        @type fh: DupPath

        @rtype: Manifest
        @return: manifest
        N)�hostname�
local_dirname�volume_info_dict�fh�
files_changed)�selfrrrr�__init__0s


zManifest.__init__cCsTtj|_tjj|_|jr(|jr|j�d|j���|jr(|j�dt|j��|S)z�
        Set information about directory from config,
        and write to manifest file.

        @rtype: Manifest
        @return: manifest
        �Hostname %s
�Localdir %s
)	rr�
local_path�namerr�write�encode�Quote�rrrr�set_dirinfo@s
zManifest.set_dirinfocCs�tjrdS|jr1|jtjkr1|jtjkr1td�tj|jf}tjj}dt�	tj�t�	|j�f}n+|j
rZ|j
tjjkrZtd�tjj|j
f}tjj
}dt�	tjj�t�	|j
�f}ndSt�|dtd�||�dS)z�
        Return None if dirinfo is the same, otherwise error message

        Does not raise an error message if hostname or local_dirname
        are not available.

        @rtype: string
        @return: None or error message
        NzWFatal Error: Backup source host has changed.
Current hostname: %s
Previous hostname: %sz%s %sz^Fatal Error: Backup source directory has changed.
Current directory: %s
Previous directory: %sz

z�Aborting because you may have accidentally tried to backup two different data sets to the same remote location, or using the same archive directory.  If this is not a mistake, use the --allow-source-mismatch switch to avoid seeing this message)r�allow_source_mismatchr�fqdn�_r�	ErrorCode�hostname_mismatchr�escaperrr�source_dir_mismatch�
FatalError)r�errmsg�code�
code_extrarrr�
check_dirinfoQs0

��
�
��zManifest.check_dirinfocCsZ|r||_|jr)|j�dt|j��|jD]}|j�d|dt|d�f�qdSdS)N�Filelist %d
�
    %-7s  %s
�r)rrr�lenr )rr�fileinforrr�set_files_changed_info{s
"�zManifest.set_files_changed_infocCs2|j}||j|<|jr|j�|��d�dSdS)z�
        Add volume info vi to manifest and write to manifest

        @param vi: volume info to add
        @type vi: VolumeInfo

        @return: void
        �
N)�
volume_numberrrr�	to_string)r�vi�vol_numrrr�add_volume_info�s
	
�zManifest.add_volume_infocCs,z|j|=WdStytd|f��w)z�
        Remove volume vol_num from the manifest

        @param vol_num: volume number to delete
        @type vi: int

        @return: void
        z!Volume %d not present in manifestN)r�	Exceptionr	)rr9rrr�del_volume_info�s
	�zManifest.del_volume_infocs�d}�jr|d�j��7}�jr|dt�j�7}|dt�j�7}�jD]}|d|dt|d�f7}q&t�j���}|�	��fdd	�}d
|d�
t||��f}|S)z�
        Return string version of self (just concatenate vi strings)

        @rtype: string
        @return: self in string form
        �rrr/r0r1rcs�j|��S�N)rr7)r9r!rr�vol_num_to_string�sz-Manifest.to_string.<locals>.vol_num_to_strings%s%s
r5)rrrr r2r�listr�keys�sort�joinr)r�resultr3�vol_num_listr?rr!rr7�s
�zManifest.to_stringc
s��fdd�}|d�|_|jdur|j��|_|d�|_d}d}t�dtj�}|���}|D]!}t��|�	d��}|�
|�|j}t||�}t
�td	�|�q-t|d|d�D]}	|�|	�qXt
�td
�|�d}
tjdur�t�dtjtjB�}|���}|r�t|�	d��}
|
dkr�d
d�}tt||�	d��d���|_|
t|j�kr�t
�td|jr�|jjnd|
t|j�f��d|_ |S)z<
        Initialize self from string s, return self
        cs<t|t�s	|��}t�d|�tj�}|sdSt|�d��S)zW
            Return the value of a field by parsing s, or None if no field
            s(^|\n)%s\s(.*?)
N�)�
isinstance�bytesr�re�search�I�Unquote�group)�	fieldname�m��srr�	get_field�s
z'Manifest.from_string.<locals>.get_fieldrN�localdirrs.(?:^|\n)(volume\s.*(?:\n.*)*?)(?=\nvolume\s|$)r1zFound manifest volume %szFound %s volumes in manifests-(^|\n)filelist\s([0-9]+)\n(.*?)(\nvolume\s|$)rFcSs&|����}|dd�|dd��fS)Nrr=r1)�strip�splitrC)�liner3rrr�parse_fileinfo�sz,Manifest.from_string.<locals>.parse_fileinfo�r5zHManifest file '%s' is corrupt: File count says %d, File list contains %d�T)!r�decoderrI�compilerK�finditer�
VolumeInfo�from_stringrMr:r6�maxr�Debugr%rr<�Infor�file_changed�SrJ�intr@rrUrr2�Errorr�base�corrupt_filelist)
rrQrR�highest_vol�
latest_vol�	vi_regexp�vi_iterator�matchr8�i�	filecount�filelist_regexprWrrPrr^�sB







�zManifest.from_stringcCs|jSr>)rr!rrr�get_files_changed�szManifest.get_files_changedcCs�t|j���}|��t|j���}|��||kr#t�td��dStt|��D]}||||ks=t�td��dSq)|j	|j	ksJ|j
|j
krSt�td��dSdS)zO
        Two manifests are equal if they contain the same volume infos
        z4Manifests not equal because different volume numbersFz/Manifests not equal because volume lists differz7Manifests not equal because hosts or directories differT)r@rrArBr�Noticer%rr2rr)r�other�vi_list1�vi_list2rmrrr�__eq__�s"�zManifest.__eq__cC�|�|�S)zN
        Defines !=.  Not doing this always leads to annoying bugs...
        �ru�rrrrrr�__ne__�zManifest.__ne__cCs<|��rJ�|�d�}|�|���|��rJ�|��dS)z@
        Write string version of manifest to given path
        �wbN)�exists�openrr7�close�setdata)r�path�foutrrr�
write_to_paths

zManifest.write_to_pathcsHt��dkrt�ddj�r�d��f���fdd�t�j���D�S)zM
        Return list of volume numbers that may contain index_prefix
        r1rrYcs g|]}�j|���r|�qSr)r�contains)�.0r9��index_prefixrrr�
<listcomp>*s
�z3Manifest.get_containing_volumes.<locals>.<listcomp>)r2rG�	__class__rr@rrA)rr�rr�r�get_containing_volumes$szManifest.get_containing_volumesr>)rrr
rrr"r.r4r:r<r7�__str__r^rpruryr�r�rrrrr,s 
*	<
rc@r)�VolumeInfoErrorzN
    Raised when there is a problem initializing a VolumeInfo from string
    Nr
rrrrr�.rr�c@s^eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
dd�Zdd�Zddd�Z
dS)r]z+
    Information about a single volume
    cCs(d|_d|_d|_d|_d|_i|_dS)zVolumeInfo initializerN)r6�start_index�start_block�	end_index�	end_block�hashesr!rrrr9s
zVolumeInfo.__init__cCs"||_||_||_||_||_|S)z�
        Set essential VolumeInfo information, return self

        Call with starting and ending paths stored in the volume.  If
        a multivol diff gets split between volumes, count it as being
        part of both volumes.
        )r6r�r�r�r�)r�
vol_numberr�r�r�r�rrr�set_infoBs
zVolumeInfo.set_infocCs2t|t�r	|��}t|t�r|��}||j|<dS)zF
        Set the value of hash hash_name (e.g. "MD5") to data
        N)rGrHrZr�)r�	hash_name�datarrr�set_hashTs


zVolumeInfo.set_hashcCsd|jsdSzd|jdfWStyYnwzd|jdfWSty(Ynwt|j���dS)z�
        Return pair (hash_type, hash_data)

        SHA1 is the best hash, and MD5 is the second best hash.  None
        is returned if no hash is available.
        N�SHA1�MD5r)r��KeyErrorr@�itemsr!rrr�
get_best_hash^s��zVolumeInfo.get_best_hashcCs�dd�}dd�}d|jg}d}|�d|||j�||j�f�|�d|||j�||j�f�|jD]}|�d	||��|j|��f�q3d
�|�S)zJ
        Return nicely formatted string reporting all information
        cSs|rd�|�}t|�SdS)z8Return printable version of index without any whitespace�/�.)rCr )�indexrQrrr�index_to_stringus
z-VolumeInfo.to_string.<locals>.index_to_stringcSs|durdSt|���S)N� )�strr)�xrrr�bfmt}sz"VolumeInfo.to_string.<locals>.bfmts
Volume %d:s    s%sStartingPath   %s %ss%sEndingPath     %s %ss%sHash %s %sr5)	r6�appendr�r�r�r�r�rrC)rr�r��slist�
whitespace�keyrrrr7qs��
�
zVolumeInfo.to_stringc	CsVdd�}|���d�}t�d|dtj�}|s td|df��t|�d��|_|dd�D]l}|s3q.|����}|d�	�}|dd�}|d	krRt
�td
��nI|dkro||d�|_
t|�dkrkt|d�|_q.d|_q.|dkr�||d�|_t|�dkr�t|d�|_q.d|_q.|d
kr�|�|d|d�q.|j
dus�|jdur�td��|S)zG
        Initialize self from string s as created by to_string
        cSs"t|�}|dkr
dSt|�d��S)z8
            Return tuple index from string
            r�rr�)rL�tuplerUrPrrr�string_to_index�sz/VolumeInfo.from_string.<locals>.string_to_indexr5s^Volume ([0-9]+):rzBad first line '%s'r1NsVolumez&Warning, found extra Volume identifiersstartingpaths
endingpathshashzStart or end index not set)rTrUrIrJrKr�rdrMr6�lowerr�Warnr%r�r2r�r�r�r�)	rrQr��linelistrOrV�
line_split�
field_name�other_fieldsrrrr^�s>	�zVolumeInfo.from_stringcCs�t|t�st�td��dS|j|jkrt�td��dS|j|jkr,t�td��dS|j|jkr;t�td��dSt|j	�
��}|��t|j	�
��}|��||kr^t�td��dSdS)z$
        Used in test suite
        zOther is not VolumeInfoNzVolume numbers don't matchzstart_indicies don't matchzend_index don't matchzHashes don't matchr1)rGr]rrqr%r6r�r�r@r�r�rB)rrr�
hash_list1�
hash_list2rrrru�s(
zVolumeInfo.__eq__cCrv)z
        Defines !=
        rwrxrrrry�rzzVolumeInfo.__ne__r1cCsH|r|jdt|��|ko|jkSS|j|ko!|jkSS)a
        Return true if volume might contain index

        If recursive is true, then return true if any index starting
        with index_prefix could be contained.  Otherwise, just check
        if index_prefix itself is between starting and ending
        indicies.
        N)r�r2r�)rr��	recursiverrrr��s	�
�zVolumeInfo.containsN)r1)rrr
rrr�r�r�r7r�r^ruryr�rrrrr]5s	
2r]s(\s|[\\"'])cCslt�|�s|Sg}tdt|��D]}|||d�}t�|�r)|�dt|��q|�|�qdd�|�S)zM
    Return quoted version of s safe to put in a manifest or volume info
    rr1s\x%02xs"%s"r=)�nonnormal_char_rerJrr2r��ordrC)rQr�rm�charrrrr �s

r cCstjjdkr
t|�S|S)NrX)�sys�version_info�major�chr)�chrrr�	maybe_chrsr�cCst|d�dkrt|d�dkr|S|d|dksJ�g}d}|t|�dkr�|||d�}|dkrut||d�dks@J�tjjdkr^|�t||d	|d
���d�jddd
��n|�t	t||d	|d
�d���|d
7}n	|�|�|d7}|t|�dks(d�
|�S)zE
    Return original string from quoted_string produced by above
    r�"�'���r1�\r�rXrF���big)�	byteorderr=)r�r2r�r�r�r�rdrZ�to_bytesr�rC)�
quoted_string�return_listrmr�rrrrL
s" 0$

�

rL)r�builtinsrrrrIr��	duplicityrrrr;r	rr�r]r[r�r r�rLrrrr�<module>s*
<

https://t.me/RX1948 - 2025