| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | Private Attributes | List of all members
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

## ◆ __init__()

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

Definition at line 226 of file GaudiTest.py.

226 def __init__(self,
227 suffix='',
228 prefix='tmp',
229 dir=None,
230 text=False,
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

## ◆ __del__()

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

## Member Function Documentation

## ◆ __getattr__()

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

## ◆ __str__()

def GaudiTest.TempFile.__str__ | ( |  | self | ) |

Definition at line 239 of file GaudiTest.py.

239 def __str__(self):
240 return self.name
241
GaudiPython.HistoUtils.__str__
__str__
Definition: HistoUtils.py:510

## Member Data Documentation

## ◆ _keep

GaudiTest.TempFile._keep
| private

Definition at line 229 of file GaudiTest.py.

## ◆ file

GaudiTest.TempFile.file

Definition at line 227 of file GaudiTest.py.

## ◆ name

GaudiTest.TempFile.name

Definition at line 228 of file GaudiTest.py.

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

- GaudiPolicy/qmtest_classes/GaudiTest.py