Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
tempfile._TemporaryFileWrapper Class Reference

List of all members.

Public Member Functions

def __init__
def __getattr__
def __enter__
def __iter__
def close
def __del__
def __exit__
def __exit__

Public Attributes

 file
 name
 close_called
 delete

Static Public Attributes

 unlink = _os.unlink

Detailed Description

Temporary file wrapper

This class provides a wrapper around files opened for
temporary use.  In particular, it seeks to automatically
remove the file when it is no longer needed.

Definition at line 340 of file tempfile.py.


Constructor & Destructor Documentation

def tempfile._TemporaryFileWrapper.__init__ (   self,
  file,
  name,
  delete = True 
)

Definition at line 348 of file tempfile.py.

00348 
00349     def __init__(self, file, name, delete=True):
00350         self.file = file
00351         self.name = name
00352         self.close_called = False
00353         self.delete = delete

Here is the caller graph for this function:

Definition at line 392 of file tempfile.py.

00392 
00393         def __del__(self):
00394             self.close()


Member Function Documentation

Definition at line 366 of file tempfile.py.

00366 
00367     def __enter__(self):
00368         self.file.__enter__()
00369         return self

def tempfile._TemporaryFileWrapper.__exit__ (   self,
  exc,
  value,
  tb 
)

Definition at line 397 of file tempfile.py.

00397 
00398         def __exit__(self, exc, value, tb):
00399             result = self.file.__exit__(exc, value, tb)
00400             self.close()
            return result

Here is the caller graph for this function:

def tempfile._TemporaryFileWrapper.__exit__ (   self,
  exc,
  value,
  tb 
)

Definition at line 402 of file tempfile.py.

00402 
00403         def __exit__(self, exc, value, tb):
00404             self.file.__exit__(exc, value, tb)
00405 

Here is the call graph for this function:

Here is the caller graph for this function:

def tempfile._TemporaryFileWrapper.__getattr__ (   self,
  name 
)

Definition at line 354 of file tempfile.py.

00354 
00355     def __getattr__(self, name):
00356         # Attribute lookups are delegated to the underlying file
00357         # and cached for non-numeric results
00358         # (i.e. methods are cached, closed and friends are not)
00359         file = self.__dict__['file']
00360         a = getattr(file, name)
00361         if not isinstance(a, int):
00362             setattr(self, name, a)
00363         return a

Here is the call graph for this function:

Definition at line 371 of file tempfile.py.

00371 
00372     def __iter__(self):
00373         return iter(self.file)

Definition at line 385 of file tempfile.py.

00385 
00386         def close(self):
00387             if not self.close_called:
00388                 self.close_called = True
00389                 self.file.close()
00390                 if self.delete:
00391                     self.unlink(self.name)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 351 of file tempfile.py.

Definition at line 352 of file tempfile.py.

Definition at line 349 of file tempfile.py.

Definition at line 350 of file tempfile.py.

Definition at line 383 of file tempfile.py.


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