From 13d5ee88c73c147b1769b6aa64a02b9117d93e2d Mon Sep 17 00:00:00 2001 From: Mahmoud Hashemi Date: Fri, 14 Aug 2015 18:45:23 -0700 Subject: [PATCH] AtomicSaver: improve docstring and remove extra import --- boltons/fileutils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/boltons/fileutils.py b/boltons/fileutils.py index bfa0b8f..4b2577b 100644 --- a/boltons/fileutils.py +++ b/boltons/fileutils.py @@ -11,7 +11,6 @@ import re import stat import errno import fnmatch -import tempfile from shutil import copy2, copystat, Error @@ -266,7 +265,16 @@ class AtomicSaver(object): part_perms (int): Integer representation of file permissions of the short-lived part file. + Practically, the AtomicSaver serves a few purposes: + + * Avoiding overwriting an existing, valid file with a partially + written one. + * Providing a reasonable guarantee that a part file only has one + writer at a time. + * Optional recovery of partial data in failure cases. + .. _context manager: https://docs.python.org/2/reference/compound_stmts.html#with + """ # TODO: option to abort if target file modify date has changed since start? def __init__(self, dest_path, **kwargs):