(self, tarinfo, targetpath, numeric_owner)
Set owner of targetpath according to tarinfo. If numeric_owner
           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
           is False, fall back to .gid/.uid when the search based on name
           fails.
Set owner of targetpath according to tarinfo. If numeric_owner
           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
           is False, fall back to .gid/.uid when the search based on name
           fails.
Set owner of targetpath according to tarinfo . If numeric_owner is True use . gid / . uid instead of . gname / . uname . If numeric_owner is False fall back to . gid / . uid when the search based on name fails .
def chown(self, tarinfo, targetpath, numeric_owner):
        """Set owner of targetpath according to tarinfo. If numeric_owner
           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
           is False, fall back to .gid/.uid when the search based on name
           fails.
        """
        if hasattr(os, "geteuid") and os.geteuid() == 0:
            # We have to be root to do so.
            g = tarinfo.gid
            u = tarinfo.uid
            if not numeric_owner:
                try:
                    if grp:
                        g = grp.getgrnam(tarinfo.gname)[2]
                except KeyError:
                    pass
                try:
                    if pwd:
                        u = pwd.getpwnam(tarinfo.uname)[2]
                except KeyError:
                    pass
            try:
                if tarinfo.issym() and hasattr(os, "lchown"):
                    os.lchown(targetpath, u, g)
                else:
                    os.chown(targetpath, u, g)
            except OSError as e:
                raise ExtractError("could not change owner") from e
def chown ( self , tarinfo , targetpath , numeric_owner ) : if hasattr ( os , "geteuid" ) and os . geteuid ( ) == 0 : # We have to be root to do so. g = tarinfo . gid u = tarinfo . uid if not numeric_owner : try : if grp : g = grp . getgrnam ( tarinfo . gname ) [ 2 ] except KeyError : pass try : if pwd : u = pwd . getpwnam ( tarinfo . uname ) [ 2 ] except KeyError : pass try : if tarinfo . issym ( ) and hasattr ( os , "lchown" ) : os . lchown ( targetpath , u , g ) else : os . chown ( targetpath , u , g ) except OSError as e : raise ExtractError ( "could not change owner" ) from e