duplicity.lazy module
Define some lazy data structures and functions acting on them
- class duplicity.lazy.ITRBranch[source]
Bases:
object
Helper class for IterTreeReducer above
There are five stub functions below: start_process, end_process, branch_process, fast_process, and can_fast_process. A class that subclasses this one will probably fill in these functions to do more.
- base_index = None
- caught_exception = None
- finished = None
- index = None
- start_successful = None
- class duplicity.lazy.Iter[source]
Bases:
object
Hold static methods for the manipulation of lazy iterators
- static equal(iter1, iter2, verbose=None, operator=<function Iter.<lambda>>)[source]
True if iterator 1 has same elements as iterator 2
Use equality operator, or == if it is unspecified.
- static multiplex(iter, num_of_forks, final_func=None, closing_func=None)[source]
Split a single iterater into a number of streams
The return val will be a list with length num_of_forks, each of which will be an iterator like iter. final_func is the function that will be called on each element in iter just as it is being removed from the buffer. closing_func is called when all the streams are finished.
- class duplicity.lazy.IterMultiplex2(iter)[source]
Bases:
object
Multiplex an iterator into 2 parts
This is a special optimized case of the Iter.multiplex function, used when there is no closing_func or final_func, and we only want to split it into 2. By profiling, this is a time sensitive class.
- class duplicity.lazy.IterTreeReducer(branch_class, branch_args)[source]
Bases:
object
Tree style reducer object for iterator - stolen from rdiff-backup
The indicies of a RORPIter form a tree type structure. This class can be used on each element of an iter in sequence and the result will be as if the corresponding tree was reduced. This tries to bridge the gap between the tree nature of directories, and the iterator nature of the connection between hosts and the temporal order in which the files are processed.
This will usually be used by subclassing ITRBranch below and then call the initializer below with the new class.