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

Method makefile

Lib/tarfile.py:2672–2686  ·  view source on GitHub ↗

Make a file called targetpath.

(self, tarinfo, targetpath)

Source from the content-addressed store, hash-verified

2670 raise
2671
2672 def makefile(self, tarinfo, targetpath):
2673 """Make a file called targetpath.
2674 """
2675 source = self.fileobj
2676 source.seek(tarinfo.offset_data)
2677 bufsize = self.copybufsize
2678 with bltn_open(targetpath, "wb") as target:
2679 if tarinfo.sparse is not None:
2680 for offset, size in tarinfo.sparse:
2681 target.seek(offset)
2682 copyfileobj(source, target, size, ReadError, bufsize)
2683 target.seek(tarinfo.size)
2684 target.truncate()
2685 else:
2686 copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
2687
2688 def makeunknown(self, tarinfo, targetpath):
2689 """Make a file from a TarInfo object with an unknown type

Callers 2

_extract_memberMethod · 0.95
makeunknownMethod · 0.95

Calls 3

copyfileobjFunction · 0.70
seekMethod · 0.45
truncateMethod · 0.45

Tested by

no test coverage detected