The Gaudi Framework  v31r0 (aeb156f0)
GaudiTest.TempFile Class Reference

Public Member Functions

def __init__ (self, suffix='', prefix='tmp', dir=None, text=False, keep=False)
 
def __str__ (self)
 
def __del__ (self)
 
def __getattr__ (self, attr)
 

Public Attributes

 file
 
 name
 

Private Attributes

 _keep
 

Detailed Description

Small class for temporary files.
When instantiated, it creates a temporary directory and the instance
behaves as the string containing the directory name.
When the instance goes out of scope, it removes all the content of
the temporary directory (automatic clean-up).

Definition at line 218 of file GaudiTest.py.

Constructor & Destructor Documentation

def GaudiTest.TempFile.__init__ (   self,
  suffix = '',
  prefix = 'tmp',
  dir = None,
  text = False,
  keep = False 
)

Definition at line 231 of file GaudiTest.py.

231  keep=False):
232  self.file = None
233  self.name = None
234  self._keep = keep
235 
236  self._fd, self.name = tempfile.mkstemp(suffix, prefix, dir, text)
237  self.file = os.fdopen(self._fd, "r+")
238 
def GaudiTest.TempFile.__del__ (   self)

Definition at line 242 of file GaudiTest.py.

242  def __del__(self):
243  if self.file:
244  self.file.close()
245  if self.name and not self._keep:
246  os.remove(self.name)
247 
def __del__(self)
Definition: GaudiTest.py:242

Member Function Documentation

def GaudiTest.TempFile.__getattr__ (   self,
  attr 
)

Definition at line 248 of file GaudiTest.py.

248  def __getattr__(self, attr):
249  return getattr(self.file, attr)
250 
251 
def __getattr__(self, attr)
Definition: GaudiTest.py:248
def GaudiTest.TempFile.__str__ (   self)

Definition at line 239 of file GaudiTest.py.

239  def __str__(self):
240  return self.name
241 
def __str__(self)
Definition: GaudiTest.py:239

Member Data Documentation

GaudiTest.TempFile._keep
private

Definition at line 234 of file GaudiTest.py.

GaudiTest.TempFile.file

Definition at line 232 of file GaudiTest.py.

GaudiTest.TempFile.name

Definition at line 233 of file GaudiTest.py.


The documentation for this class was generated from the following file: