duplicity.util module

Miscellaneous utilities.

class duplicity.util.BlackHoleList(iterable=(), /)[source]

Bases: list

append(x)[source]

Append object to the end of the list.

class duplicity.util.FakeTarFile[source]

Bases: object

close()[source]
debug = 0
duplicity.util.casefold_compat(s)[source]

Compatability function for casefolding which provides an acceptable for older pythons. Can likely be removed once python2 support is no longer o any interest.

duplicity.util.copyfileobj(infp, outfp, byte_count=-1)[source]

Copy byte_count bytes from infp to outfp, or all if byte_count < 0

Returns the number of bytes actually written (may be less than byte_count if find eof. Does not close either fileobj.

duplicity.util.csv_args_to_dict(arg)[source]

Given the string arg in single line csv format, split into pairs (key, val) and produce a dictionary from those key:val pairs.

duplicity.util.escape(string)[source]

Convert a (bytes) filename to a format suitable for logging (quoted utf8)

duplicity.util.exception_traceback(limit=50)[source]
@return A string representation in typical Python format of the

currently active/raised exception.

duplicity.util.get_tarinfo_name(ti)[source]
duplicity.util.ignore_missing(fn, filename)[source]

Execute fn on filename. Ignore ENOENT errors, otherwise raise exception.

@param fn: callable @param filename: string

duplicity.util.make_tarfile(mode, fp)[source]
duplicity.util.maybe_ignore_errors(fn)[source]

Execute fn. If the global configuration setting ignore_errors is set to True, catch errors and log them but do continue (and return None).

@param fn: A callable. @return Whatever fn returns when called, or None if it failed and ignore_errors is true.

duplicity.util.merge_dicts(*dict_args)[source]

Given any number of dictionaries, shallow copy and merge into a new dict, precedence goes to key-value pairs in latter dictionaries.

duplicity.util.release_lockfile()[source]
duplicity.util.start_debugger()[source]
duplicity.util.uexc(e)[source]

Returns the exception message in Unicode

duplicity.util.uindex(index)[source]

Convert an index (a tuple of path parts) to unicode for printing

duplicity.util.which(program)[source]

Return absolute path for program name. Returns None if program not found.