X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbup%2Fhelpers.py;fp=lib%2Fbup%2Fhelpers.py;h=300e67eee25dd9123537b73a1b4fc1a3fc72075c;hb=a01949cd7bef41c7f43e6334e6989878d47b29b6;hp=34772368966ccf633aaf70b22fe47a02368fbee5;hpb=c6975c8cc5a3b5286f1416dabe52725f405c34fa;p=bup.git diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py index 3477236..300e67e 100644 --- a/lib/bup/helpers.py +++ b/lib/bup/helpers.py @@ -631,15 +631,15 @@ def chunkyreader(f, count = None): @contextmanager def atomically_replaced_file(name, mode='w', buffering=-1): - """Write to file which will atomically become name when finished. + """Yield a file that will be atomically renamed name when leaving the block. This contextmanager yields an open file object that is backed by a temporary file which will be renamed (atomically) to the target name if everything succeeds. The mode and buffering arguments are handled exactly as with open, - and upon success the resulting file will have very restrictive - permissions, as per mkstemp. + and the yielded file will have have very restrictive permissions, + as per mkstemp. E.g.::