duplicity.dup_temp module

Manage temporary files

class duplicity.dup_temp.Block(data)[source]

Bases: object

Data block to return from SrcIter

__init__(data)[source]
class duplicity.dup_temp.FileobjHooked(fileobj, tdp=None, dirpath=None, partname=None, permname=None, remname=None)[source]

Bases: object

Simulate a file, but add hook on close

__init__(fileobj, tdp=None, dirpath=None, partname=None, permname=None, remname=None)[source]

Initializer. fileobj is the file object to simulate

addhook(hook)[source]

Add hook (function taking no arguments) to run upon closing

close()[source]

Close fileobj, running hooks right afterwards

flush()[source]

Flush fileobj and force sync.

get_name()[source]

Return the name of the file

property name

Return the name of the file

read(length=-1)[source]

Read fileobj, return result of read()

seek(offset)[source]

Seeks to a location of fileobj

tell()[source]

Returns current location of fileobj

to_final()[source]

We are finished, rename to final, gzip if needed.

to_partial()[source]

We have achieved the first checkpoint, make file visible and permanent.

to_remote()[source]

We have written the last checkpoint, now encrypt or compress and send a copy of it to the remote for final storage.

write(buf)[source]

Write fileobj, return result of write()

class duplicity.dup_temp.SrcIter(src)[source]

Bases: object

Iterate over source and return Block of data.

__init__(src)[source]
get_read_size()[source]
class duplicity.dup_temp.TempDupPath(base, index=(), parseresults=None)[source]

Bases: DupPath

Like TempPath, but build around DupPath

delete()[source]

Forget and delete

filtered_open_with_delete(mode)[source]

Returns a filtered fileobj. When that is closed, delete file

open_with_delete(mode='rb')[source]

Returns a fileobj. When that is closed, delete file

class duplicity.dup_temp.TempPath(base, index=())[source]

Bases: Path

Path object used as a temporary file

delete()[source]

Forget and delete

open_with_delete(mode)[source]

Returns a fileobj. When that is closed, delete file

duplicity.dup_temp.get_fileobj_duppath(dirpath, partname, permname, remname, overwrite=False)[source]

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.

duplicity.dup_temp.new_tempduppath(parseresults)[source]

Return a new TempDupPath, using settings from parseresults

duplicity.dup_temp.new_temppath()[source]

Return a new TempPath