Return a tar header as a string of 512 byte blocks.
(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape")
| 979 | return info |
| 980 | |
| 981 | def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"): |
| 982 | """Return a tar header as a string of 512 byte blocks. |
| 983 | """ |
| 984 | info = self.get_info() |
| 985 | for name, value in info.items(): |
| 986 | if value is None: |
| 987 | raise ValueError("%s may not be None" % name) |
| 988 | |
| 989 | if format == USTAR_FORMAT: |
| 990 | return self.create_ustar_header(info, encoding, errors) |
| 991 | elif format == GNU_FORMAT: |
| 992 | return self.create_gnu_header(info, encoding, errors) |
| 993 | elif format == PAX_FORMAT: |
| 994 | return self.create_pax_header(info, encoding) |
| 995 | else: |
| 996 | raise ValueError("invalid format") |
| 997 | |
| 998 | def create_ustar_header(self, info, encoding, errors): |
| 999 | """Return the object as a ustar header block. |
no test coverage detected