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

Method _block

Lib/tarfile.py:1646–1656  ·  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

1644 return value.decode(fallback_encoding, fallback_errors)
1645
1646 def _block(self, count):
1647 """Round up a byte count by BLOCKSIZE and return it,
1648 e.g. _block(834) => 1024.
1649 """
1650 # Only non-negative offsets are allowed
1651 if count < 0:
1652 raise InvalidHeaderError("invalid offset")
1653 blocks, remainder = divmod(count, BLOCKSIZE)
1654 if remainder:
1655 blocks += 1
1656 return blocks * BLOCKSIZE
1657
1658 def isreg(self):
1659 '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 2

InvalidHeaderErrorClass · 0.85
divmodFunction · 0.50

Tested by

no test coverage detected