X-Git-Url: https://git.rkrishnan.org/?a=blobdiff_plain;f=src%2Fallmydata%2Futil%2Ffileutil.py;h=a2c3841f7837d28032988b4656e266209eb9056d;hb=a9b152780e3c4d875100853477a006edf49964ec;hp=20f5c34e7571001b574d7d5603497e09c6d16671;hpb=61e2ae4aa8f4c010254aa404d831163a81780dd5;p=tahoe-lafs%2Ftahoe-lafs.git diff --git a/src/allmydata/util/fileutil.py b/src/allmydata/util/fileutil.py index 20f5c34e..a2c3841f 100644 --- a/src/allmydata/util/fileutil.py +++ b/src/allmydata/util/fileutil.py @@ -87,34 +87,6 @@ class ReopenableNamedTemporaryFile: def shutdown(self): remove(self.name) -class NamedTemporaryDirectory: - """ - This calls tempfile.mkdtemp(), stores the name of the dir in - self.name, and rmrf's the dir when it gets garbage collected or - "shutdown()". - """ - def __init__(self, cleanup=True, *args, **kwargs): - """ If cleanup, then the directory will be rmrf'ed when the object is shutdown. """ - self.cleanup = cleanup - self.name = tempfile.mkdtemp(*args, **kwargs) - - def __repr__(self): - return "<%s instance at %x %s>" % (self.__class__.__name__, id(self), self.name) - - def __str__(self): - return self.__repr__() - - def __del__(self): - try: - self.shutdown() - except: - import traceback - traceback.print_exc() - - def shutdown(self): - if self.cleanup and hasattr(self, 'name'): - rm_dir(self.name) - class EncryptedTemporaryFile: # not implemented: next, readline, readlines, xreadlines, writelines