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

Function format_size

crates/wasm/Lib/whlimport.py:88–97  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

86
87
88def format_size(bytes):
89 # type: (float) -> str
90 if bytes > 1000 * 1000:
91 return "{:.1f} MB".format(bytes / 1000.0 / 1000)
92 elif bytes > 10 * 1000:
93 return "{} kB".format(int(bytes / 1000))
94 elif bytes > 1000:
95 return "{:.1f} kB".format(bytes / 1000.0)
96 else:
97 return "{} bytes".format(int(bytes))
98
99
100class ZipFinder:

Callers 1

_load_packageFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected