duplicity.util module
Miscellaneous utilities.
- 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.ignore_missing(fn, filename)[source]
Execute fn on filename. Ignore ENOENT errors, otherwise raise exception.
@param fn: callable @param filename: string
- 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.