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__/librsync.cpython-310.pyc
o

�~�_("�@s�dZddlmZddlmZddlZddlZddlZddlmZej	�
d�dkr5ddlZddlZe�
�e_ejZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)z�Provides a high-level interface to some librsync functions

This is a python wrapper around the lower-level _librsync module,
which is written in C.  The goal was to use C as little as possible...

�)�object)�strN�)�	_librsync�READTHEDOCS�Truec@seZdZdZdS)�
librsyncErrora/Signifies error in internal librsync processing (bad signature, etc.)

    underlying _librsync.librsyncError's are regenerated using this
    class because the C-created exceptions are by default
    unPickleable.  There is probably a way to fix this in _librsync,
    but this scheme was easier.

    N)�__name__�
__module__�__qualname__�__doc__�r
r
�4/usr/lib/python3/dist-packages/duplicity/librsync.pyr.src@sNeZdZdZdZdZddd�Zddd�Zdd	d
�Zdd�Z	d
d�Z
dd�ZdS)�LikeFilez:File-like object used by SigFile, DeltaFile, and PatchFile�rbNcCs@|�||�||_d|_|_d|_t�d�|_d|_|_dS)z1LikeFile initializer - zero buffers, set eofs offN��b)	�
check_file�infile�closed�
infile_closed�inbuf�array�outbuf�eof�
infile_eof)�selfr�	need_seekr
r
r�__init__BszLikeFile.__init__cCsBt|d�s	td��t|d�std��|rt|d�std��dSdS)z:Raise type error if file doesn't have necessary attributes�readz$Basis file must have a read() method�closez%Basis file must have a close() method�seekz$Basis file must have a seek() methodN)�hasattr�	TypeError)r�filerr
r
rrKs

�zLikeFile.check_file���cCs�|dkr|js|��|jrt|j�}n |js,t|j�|kr,|��|js,t|j�|kst|t|j��}tjjdkrD|jd|���}n	|jd|��	�}|jd|�=|S)z/Build up self.outbuf, return first length bytesr%�N)
r�_add_to_outbuf_once�lenr�min�sys�version_info�major�tobytes�tostring)r�length�real_len�
return_valr
r
rrTs��z
LikeFile.readc
Cs�|js|��z
|j�|j�\|_}}Wntjy'}ztt|���d}~ww|j|d�|_t	j
jdkr>|j�
|�dS|j�|�dS)z.Add one cycle's worth of output to self.outbufNr&)r�
_add_to_inbuf�maker�cyclerrrrrr*r+r,r�	frombytes�
fromstring)r�len_inbuf_read�	cycle_out�er
r
rr'fs��zLikeFile._add_to_outbuf_oncecCsj|jrJ�t|j�tkr3|j�t�}|s#d|_|j��rJ�d|_dS|j|7_t|j�tksdSdS)z&Make sure len(self.inbuf) >= blocksizerN)rr(r�	blocksizerrr r)r�new_inr
r
rr2ts
�zLikeFile._add_to_inbufcCs|js
|j��r
J�d|_dS)zClose infilerN)rrr r�rr
r
rr �s
zLikeFile.close)N)r%)r	r
rr�moder3rrrr'r2r r
r
r
rr:s

	
	rc@seZdZdZejfdd�ZdS)�SigFilezCFile-like object which incrementally generates a librsync signaturec
CsFt�||�z	t�|�|_WdStjy"}ztt|���d}~ww)z�SigFile initializer - takes basis file

        basis file only needs to have read() and close() methods.  It
        will be closed when we come to the end of the signature.

        N)rrr�new_sigmakerr3rr)rrr:r9r
r
rr�s��zSigFile.__init__N)r	r
rrr�RS_DEFAULT_BLOCK_LENrr
r
r
rr>�sr>c@�eZdZdZdd�ZdS)�	DeltaFilez?File-like object which incrementally generates a librsync deltac
Cstt�||�t|t�r|}n|�|�|��}|��rJ�z	t�|�|_	WdStj
y9}zt
t|���d}~ww)a
DeltaFile initializer - call with signature and new file

        Signature can either be a string or a file with read() and
        close() methods.  New_file also only needs to have read() and
        close() methods.  It will be closed when self is closed.

        N)rr�
isinstance�bytesrrr r�new_deltamakerr3rr)r�	signature�new_file�
sig_stringr9r
r
rr�s

��zDeltaFile.__init__N�r	r
rrrr
r
r
rrB��rBc@rA)�PatchedFilez=File-like object which applies a librsync delta incrementallyc
Cs�t�||�z|��Wn	t|d�r t|jd�r |j}nttd���Yz	t�|�|_	WdStj
yC}zt
t|���d}~ww)z�PatchedFile initializer - call with basis delta

        Here basis_file must be a true Python file, because we may
        need to seek() around in it a lot, and this is done in C.
        delta_file only needs read() and close() methods.

        r$�filenozebasis_file must be a (true) file or an object whose file attribute is the underlying true file objectN)rrrLr"r$r#�_r�new_patchmakerr3rr)r�
basis_file�
delta_filer9r
r
rr�s���zPatchedFile.__init__NrIr
r
r
rrK�rJrKc@s6eZdZdZejfdd�Zdd�Zdd�Zdd	�Z	d
S)�SigGeneratorz�Calculate signature.

    Input and output is same as SigFile, but the interface is like md5
    module, not filelike object

    c
CsNzt�|�|_Wntjy}ztt|���d}~wwd|_d|_g|_dS)zReturn new signature instanceNr)rr?�	sig_makerrr�gotsig�buffer�sigstring_list)rr:r9r
r
rr�s��
zSigGenerator.__init__cCsP|jrtd��|j|7_t|j�tkr&|��rtd��t|j�tksdSdS)z6Add buf to data that signature will be calculated overz'SigGenerator already provided signaturez%Premature EOF received from sig_makerN)rSrrTr(r:�process_buffer)r�bufr
r
r�update�s�zSigGenerator.updatec
Cs`z|j�|j�\}}}Wntjy}ztt|���d}~ww|j|d�|_|j�|�|S)z9Run self.buffer through sig_maker, add to self.sig_stringN)rRr4rTrrrrU�append)rr�len_buf_readr8r9r
r
rrV�s��zSigGenerator.process_buffercCs|��s		|��rd�|j�S)z Return signature over given datar)rV�joinrUr<r
r
r�getsig�s�zSigGenerator.getsigN)
r	r
rrrr@rrXrVr\r
r
r
rrQ�s
	
rQ)r�builtinsrrr�osr*�r�environ�get�mock�	duplicity�	MagicMock�RS_JOB_BLOCKSIZEr:�	Exceptionrrr>rBrKrQr
r
r
r�<module>s$
M

https://t.me/RX1948 - 2025