Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.tarfile.TarIter Class Reference

List of all members.

Public Member Functions

def __init__
def __iter__
def next

Public Attributes

 tarfile
 index

Detailed Description

Iterator Class.

   for tarinfo in TarFile(...):
       suite...

Definition at line 2044 of file tarfile.py.


Constructor & Destructor Documentation

def MoinMoin.support.tarfile.TarIter.__init__ (   self,
  tarfile 
)
Construct a TarIter object.

Definition at line 2051 of file tarfile.py.

02051 
02052     def __init__(self, tarfile):
02053         """Construct a TarIter object.
02054         """
02055         self.tarfile = tarfile
        self.index = 0

Member Function Documentation

Return iterator object.

Definition at line 2056 of file tarfile.py.

02056 
02057     def __iter__(self):
02058         """Return iterator object.
02059         """
        return self
Return the next item using TarFile's next() method.
   When all members have been read, set TarFile as _loaded.

Definition at line 2060 of file tarfile.py.

02060 
02061     def next(self):
02062         """Return the next item using TarFile's next() method.
02063            When all members have been read, set TarFile as _loaded.
02064         """
02065         # Fix for SF #1100429: Under rare circumstances it can
02066         # happen that getmembers() is called during iteration,
02067         # which will cause TarIter to stop prematurely.
02068         if not self.tarfile._loaded:
02069             tarinfo = self.tarfile.next()
02070             if not tarinfo:
02071                 self.tarfile._loaded = True
02072                 raise StopIteration
02073         else:
02074             try:
02075                 tarinfo = self.tarfile.members[self.index]
02076             except IndexError:
02077                 raise StopIteration
02078         self.index += 1
02079         return tarinfo
02080 
# Helper classes for sparse file support

Here is the caller graph for this function:


Member Data Documentation

Definition at line 2055 of file tarfile.py.

Definition at line 2054 of file tarfile.py.


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