MCPcopy Create free account
hub / github.com/git/git / format_size_human_readable

Function format_size_human_readable

git-p4.py:84–94  ·  view source on GitHub ↗

Returns a number of units (typically bytes) formatted as a human-readable string.

(num)

Source from the content-addressed store, hash-verified

82
83
84def format_size_human_readable(num):
85 """Returns a number of units (typically bytes) formatted as a
86 human-readable string.
87 """
88 if num < 1024:
89 return '{:d} B'.format(num)
90 for unit in ["Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"]:
91 num /= 1024.0
92 if num < 1024.0:
93 return "{:3.1f} {}B".format(num, unit)
94 return "{:.1f} YiB".format(num)
95
96
97def p4_build_cmd(cmd):

Callers 2

streamOneP4FileMethod · 0.85
streamP4FilesCbMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected