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

�~�_= �@sdZddlmZddlmZe��ddlmZddlZddl	Z	ddl
Z
ddlmZddlm
Z
ddlmZdd	lmZdd
lmZddlmZdd
�ZGdd�de
j�Zddd�Zdd�ZGdd�de
j�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)zManage temporary files�)�print_function)�standard_library)�objectN)�log)�path)�file_naming)�tempdir)�config)�gpgcCst����}t|�S)z
    Return a new TempPath
    )r�default�mktemp�TempPath)�filename�r�4/usr/lib/python3/dist-packages/duplicity/dup_temp.py�new_temppath)src@s eZdZdZdd�Zdd�ZdS)r
z.
    Path object used as a temporary file
    cC� tj�|�t���|j�dS�z#
        Forget and delete
        N)r�Path�deleterr�forget�name��selfrrrr5�zTempPath.deletecC�"ttj�||��}|�|j�|S)�F
        Returns a fileobj.  When that is closed, delete file
        )�
FileobjHookedrr�open�addhookr�r�mode�fhrrr�open_with_delete<�zTempPath.open_with_deleteN)�__name__�
__module__�__qualname__�__doc__rr#rrrrr
1sr
Fc	s�tjs$t��j������t�t���d��t	��
d����||d�}ntj�j�fd�}d}|r3d}t	|�
|�d��||d�}�����fdd�}tjsR|�
|�|S)	a
    Return a file object open for writing, will write to filename

    Data will be processed and written to a temporary file.  When the
    return fileobject is closed, rename to final position.  filename
    must be a recognizable duplicity data file.
    ��parseresults�wb)�tdp�dirpath�partname�permname�remname)�index�abNcs�����������dS�N)�rename�appendrr�r-r.�tdr,�tdpnamerr�rename_and_forget[sz.get_fileobj_duppath.<locals>.rename_and_forget)r	�restartr�TemporaryDirectoryrr�TempDupPathr�parser�
filtered_openr�DupPathr)	r-r.r/r0�	overwriter"�dpr!r9rr6r�get_fileobj_duppathEs$��
rBcCst����}t||d�S)zD
    Return a new TempDupPath, using settings from parseresults
    r))rrrr<)r*rrrr�new_tempduppathesrCc@s*eZdZdZdd�Zdd�Zd
dd�Zd	S)r<z1
    Like TempPath, but build around DupPath
    cCrr)rr?rrrrrrrrrrqrzTempDupPath.deletecCr)zO
        Returns a filtered fileobj.  When that is closed, delete file
        )rrr?r>rrr rrr�filtered_open_with_deletexr$z%TempDupPath.filtered_open_with_delete�rbcCs.|dksJ�ttj�||��}|�|j�|S)rrE)rrr?rrrr rrrr#�szTempDupPath.open_with_deleteN)rE)r%r&r'r(rrDr#rrrrr<ms
r<c@s�eZdZdZ		ddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zee�ZdS)rz0
    Simulate a file, but add hook on close
    NcCs4||_d|_g|_||_||_||_||_||_dS)zF
        Initializer.  fileobj is the file object to simulate
        FN)�fileobj�closed�hooklistr,r-r.r/r0)rrFr,r-r.r/r0rrr�__init__�s
zFileobjHooked.__init__cC�|j�|�S)z9
        Write fileobj, return result of write()
        )rF�write)r�bufrrrrK��zFileobjHooked.writecCs|j��t�|j���dS)z/
        Flush fileobj and force sync.
        N)rF�flush�os�fsync�filenorrrrrN�s
zFileobjHooked.flushcCs6tjrJ�|j�|j�|j��|j��|j	d=dS)zY
        We have achieved the first checkpoint, make file visible and permanent.
        rN)
r	r:r,r4r-r5r.rFrNrHrrrr�
to_partial�s

zFileobjHooked.to_partialcCs�t�|j�}|j�|j�}|j�|j�}t|�}|jr&tj	||j
tjd�n|j
r6tj||j
tjtjd�nt�|j
|j
�tj�|�dS)z�
        We have written the last checkpoint, now encrypt or compress
        and send a copy of it to the remote for final storage.
        ��sizeN)rr=r0r-r5r.�SrcIter�
compressedr
�
GzipWriteFiler�sys�maxsize�	encrypted�GPGWriteFiler	�gpg_profile�shutil�copyfile�backend�move)r�pr�src�tgt�src_iterrrr�	to_remote�szFileobjHooked.to_remotecCsn|j�|j�}|j�|j�}t|�}t�|j�}|jr-tj	||j
tjd�t
�|j
�dSt
�|j
|j
�dS)zC
        We are finished, rename to final, gzip if needed.
        rSN)r-r5r.r/rUrr=rVr
rWrrXrYrO�unlinkr4)rrbrcrdrarrr�to_final�szFileobjHooked.to_final���cCrJ)z7
        Read fileobj, return result of read()
        )rF�read)r�lengthrrrri�rMzFileobjHooked.readcCs
|j��S)z5
        Returns current location of fileobj
        )rF�tellrrrrrk�s
zFileobjHooked.tellcCrJ)z0
        Seeks to a location of fileobj
        )rF�seek)r�offsetrrrrl�rMzFileobjHooked.seekcCs$|j��rJ�|jD]}|�q
dS)z?
        Close fileobj, running hooks right afterwards
        N)rF�closerH�r�hookrrrrn�s
�zFileobjHooked.closecCs|j�|�dS)zM
        Add hook (function taking no arguments) to run upon closing
        N)rHr5rorrrr�szFileobjHooked.addhookcCs|jjS)z-
        Return the name of the file
        )rFrrrrr�get_name�szFileobjHooked.get_name)NNNNN)rh)r%r&r'r(rIrKrNrRrergrirkrlrnrrq�propertyrrrrrr�s"
�	
rc@seZdZdZdd�ZdS)�Blockz+
    Data block to return from SrcIter
    cCs
||_dSr3)�data)rrtrrrrI�s
zBlock.__init__N)r%r&r'r(rIrrrrrs�srsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rUz7
    Iterate over source and return Block of data.
    cCs||_|�d�|_dS)NrE)rbr�fp)rrbrrrrIszSrcIter.__init__c	Cshzt|j�|����}Wnty't�td�|jj	t
��ftjj
�Ynw|js2|j��t�|S)NzFailed to read %s: %s)rsruri�
get_read_size�	Exceptionr�
FatalError�_rb�uc_namerX�exc_info�	ErrorCode�genericrtrn�
StopIteration)r�resrrr�__next__
s
���
zSrcIter.__next__cC�dS)Nirrrrrrv�zSrcIter.get_read_sizecCr�)N�rrrrr�
get_footerr�zSrcIter.get_footerN)r%r&r'r(rIr�rvr�rrrrrUsrU)F)r(�
__future__r�futurer�install_aliases�builtinsrrOrXr]�	duplicityrrrrr	r
rrr
rBrCr?r<rrsrUrrrr�<module>s,
 p

https://t.me/RX1948 - 2025