Return a deep copy of self with the given attributes replaced.
(self, *,
name=_KEEP, mtime=_KEEP, mode=_KEEP, linkname=_KEEP,
uid=_KEEP, gid=_KEEP, uname=_KEEP, gname=_KEEP,
deep=True, _KEEP=_KEEP)
| 974 | return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) |
| 975 | |
| 976 | def replace(self, *, |
| 977 | name=_KEEP, mtime=_KEEP, mode=_KEEP, linkname=_KEEP, |
| 978 | uid=_KEEP, gid=_KEEP, uname=_KEEP, gname=_KEEP, |
| 979 | deep=True, _KEEP=_KEEP): |
| 980 | """Return a deep copy of self with the given attributes replaced. |
| 981 | """ |
| 982 | if deep: |
| 983 | result = copy.deepcopy(self) |
| 984 | else: |
| 985 | result = copy.copy(self) |
| 986 | if name is not _KEEP: |
| 987 | result.name = name |
| 988 | if mtime is not _KEEP: |
| 989 | result.mtime = mtime |
| 990 | if mode is not _KEEP: |
| 991 | result.mode = mode |
| 992 | if linkname is not _KEEP: |
| 993 | result.linkname = linkname |
| 994 | if uid is not _KEEP: |
| 995 | result.uid = uid |
| 996 | if gid is not _KEEP: |
| 997 | result.gid = gid |
| 998 | if uname is not _KEEP: |
| 999 | result.uname = uname |
| 1000 | if gname is not _KEEP: |
| 1001 | result.gname = gname |
| 1002 | return result |
| 1003 | |
| 1004 | def get_info(self): |
| 1005 | """Return the TarInfo's attributes as a dictionary. |