(self, member)
Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file or
           a link, an io.BufferedReader object is returned. For all other
           existing members, None is returned. If `member' does not appear
           in the archive, KeyError is raised.
Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file or
           a link, an io.BufferedReader object is returned. For all other
           existing members, None is returned. If `member' does not appear
           in the archive, KeyError is raised.
Extract a member from the archive as a file object . member may be a filename or a TarInfo object . If member is a regular file or a link an io . BufferedReader object is returned . For all other existing members None is returned . If member does not appear in the archive KeyError is raised .
def extractfile(self, member):
        """Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file or
           a link, an io.BufferedReader object is returned. For all other
           existing members, None is returned. If `member' does not appear
           in the archive, KeyError is raised.
        """
        self._check("r")

        if isinstance(member, str):
            tarinfo = self.getmember(member)
        else:
            tarinfo = member

        if tarinfo.isreg() or tarinfo.type not in SUPPORTED_TYPES:
            # Members with unknown types are treated as regular files.
            return self.fileobject(self, tarinfo)

        elif tarinfo.islnk() or tarinfo.issym():
            if isinstance(self.fileobj, _Stream):
                # A small but ugly workaround for the case that someone tries
                # to extract a (sym)link as a file-object from a non-seekable
                # stream of tar blocks.
                raise StreamError("cannot extract (sym)link as file object")
            else:
                # A (sym)link's file object is its target's file object.
                return self.extractfile(self._find_link_target(tarinfo))
        else:
            # If there's no data associated with the member (directory, chrdev,
            # blkdev, etc.), return None instead of a file object.
            return None
def extractfile ( self , member ) : self . _check ( "r" ) if isinstance ( member , str ) : tarinfo = self . getmember ( member ) else : tarinfo = member if tarinfo . isreg ( ) or tarinfo . type not in SUPPORTED_TYPES : # Members with unknown types are treated as regular files. return self . fileobject ( self , tarinfo ) elif tarinfo . islnk ( ) or tarinfo . issym ( ) : if isinstance ( self . fileobj , _Stream ) : # A small but ugly workaround for the case that someone tries # to extract a (sym)link as a file-object from a non-seekable # stream of tar blocks. raise StreamError ( "cannot extract (sym)link as file object" ) else : # A (sym)link's file object is its target's file object. return self . extractfile ( self . _find_link_target ( tarinfo ) ) else : # If there's no data associated with the member (directory, chrdev, # blkdev, etc.), return None instead of a file object. return None