MCPcopy Index your code
hub / github.com/python/cpython / getcomptype

Method getcomptype

Lib/tarfile.py:595–605  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

593 return self.buf
594
595 def getcomptype(self):
596 if self.buf.startswith(b"\x1f\x8b\x08"):
597 return "gz"
598 elif self.buf[0:3] == b"BZh" and self.buf[4:10] == b"1AY&SY":
599 return "bz2"
600 elif self.buf.startswith((b"\x5d\x00\x00\x80", b"\xfd7zXZ")):
601 return "xz"
602 elif self.buf.startswith(b"\x28\xb5\x2f\xfd"):
603 return "zst"
604 else:
605 return "tar"
606
607 def close(self):
608 self.fileobj.close()

Callers 1

__init__Method · 0.45

Calls 1

startswithMethod · 0.45

Tested by

no test coverage detected