(self)
Provide an iterator object.
Provide an iterator object.
Provide an iterator object .
def __iter__(self):
        """Provide an iterator object.
        """
        if self._loaded:
            yield from self.members
            return

        # Yield items using TarFile's next() method.
        # When all members have been read, set TarFile as _loaded.
        index = 0
        # Fix for SF #1100429: Under rare circumstances it can
        # happen that getmembers() is called during iteration,
        # which will have already exhausted the next() method.
        if self.firstmember is not None:
            tarinfo = self.next()
            index += 1
            yield tarinfo

        while True:
            if index < len(self.members):
                tarinfo = self.members[index]
            elif not self._loaded:
                tarinfo = self.next()
                if not tarinfo:
                    self._loaded = True
                    return
            else:
                return
            index += 1
            yield tarinfo
def __iter__ ( self ) : if self . _loaded : yield from self . members return # Yield items using TarFile's next() method. # When all members have been read, set TarFile as _loaded. index = 0 # Fix for SF #1100429: Under rare circumstances it can # happen that getmembers() is called during iteration, # which will have already exhausted the next() method. if self . firstmember is not None : tarinfo = self . next ( ) index += 1 yield tarinfo while True : if index < len ( self . members ) : tarinfo = self . members [ index ] elif not self . _loaded : tarinfo = self . next ( ) if not tarinfo : self . _loaded = True return else : return index += 1 yield tarinfo