The Gaudi Framework  v30r3 (a5ef0a68)
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 216 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 224 of file GaudiTest.py.

224  def __init__(self, suffix='', prefix='tmp', dir=None, text=False, keep=False):
225  self.file = None
226  self.name = None
227  self._keep = keep
228 
229  self._fd, self.name = tempfile.mkstemp(suffix, prefix, dir, text)
230  self.file = os.fdopen(self._fd, "r+")
231 
def __init__(self, suffix='', prefix='tmp', dir=None, text=False, keep=False)
Definition: GaudiTest.py:224
def GaudiTest.TempFile.__del__ (   self)

Definition at line 235 of file GaudiTest.py.

235  def __del__(self):
236  if self.file:
237  self.file.close()
238  if self.name and not self._keep:
239  os.remove(self.name)
240 
def __del__(self)
Definition: GaudiTest.py:235

Member Function Documentation

def GaudiTest.TempFile.__getattr__ (   self,
  attr 
)

Definition at line 241 of file GaudiTest.py.

241  def __getattr__(self, attr):
242  return getattr(self.file, attr)
243 
244 
def __getattr__(self, attr)
Definition: GaudiTest.py:241
def GaudiTest.TempFile.__str__ (   self)

Definition at line 232 of file GaudiTest.py.

232  def __str__(self):
233  return self.name
234 
def __str__(self)
Definition: GaudiTest.py:232

Member Data Documentation

GaudiTest.TempFile._keep
private

Definition at line 227 of file GaudiTest.py.

GaudiTest.TempFile.file

Definition at line 225 of file GaudiTest.py.

GaudiTest.TempFile.name

Definition at line 226 of file GaudiTest.py.


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