The Gaudi Framework  v28r2p1 (f1a77ff4)
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 207 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 214 of file GaudiTest.py.

214  def __init__(self, suffix='', prefix='tmp', dir=None, text=False, keep = False):
215  self.file = None
216  self.name = None
217  self._keep = keep
218 
219  self._fd, self.name = tempfile.mkstemp(suffix,prefix,dir,text)
220  self.file = os.fdopen(self._fd,"r+")
221 
def __init__(self, suffix='', prefix='tmp', dir=None, text=False, keep=False)
Definition: GaudiTest.py:214
def GaudiTest.TempFile.__del__ (   self)

Definition at line 225 of file GaudiTest.py.

225  def __del__(self):
226  if self.file:
227  self.file.close()
228  if self.name and not self._keep:
229  os.remove(self.name)
230 
def __del__(self)
Definition: GaudiTest.py:225

Member Function Documentation

def GaudiTest.TempFile.__getattr__ (   self,
  attr 
)

Definition at line 231 of file GaudiTest.py.

231  def __getattr__(self,attr):
232  return getattr(self.file,attr)
233 
def __getattr__(self, attr)
Definition: GaudiTest.py:231
def GaudiTest.TempFile.__str__ (   self)

Definition at line 222 of file GaudiTest.py.

222  def __str__(self):
223  return self.name
224 
def __str__(self)
Definition: GaudiTest.py:222

Member Data Documentation

GaudiTest.TempFile._keep
private

Definition at line 217 of file GaudiTest.py.

GaudiTest.TempFile.file

Definition at line 215 of file GaudiTest.py.

GaudiTest.TempFile.name

Definition at line 216 of file GaudiTest.py.


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