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

Method _block

Lib/tarfile.py:1665–1675  ·  view source on GitHub ↗

Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024.

(self, count)

Source from the content-addressed store, hash-verified

1663 return value.decode(fallback_encoding, fallback_errors)
1664
1665 def _block(self, count):
1666 """Round up a byte count by BLOCKSIZE and return it,
1667 e.g. _block(834) => 1024.
1668 """
1669 # Only non-negative offsets are allowed
1670 if count < 0:
1671 raise InvalidHeaderError("invalid offset")
1672 blocks, remainder = divmod(count, BLOCKSIZE)
1673 if remainder:
1674 blocks += 1
1675 return blocks * BLOCKSIZE
1676
1677 def isreg(self):
1678 'Return True if the Tarinfo object is a regular file.'

Callers 4

_proc_builtinMethod · 0.95
_proc_gnulongMethod · 0.95
_proc_sparseMethod · 0.95
_proc_paxMethod · 0.95

Calls 1

InvalidHeaderErrorClass · 0.85

Tested by

no test coverage detected