MCPcopy Index your code
hub / github.com/RustPython/RustPython / getcomptype

Method getcomptype

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

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.45

Calls 1

startswithMethod · 0.45

Tested by

no test coverage detected