MCPcopy Index your code
hub / github.com/MatrixTM/MHDDoS / humanformat

Method humanformat

start.py:255–262  ·  view source on GitHub ↗
(num: int, precision: int = 2)

Source from the content-addressed store, hash-verified

253
254 @staticmethod
255 def humanformat(num: int, precision: int = 2):
256 suffixes = ['', 'k', 'm', 'g', 't', 'p']
257 if num > 999:
258 obje = sum(
259 [abs(num / 1000.0 ** x) >= 1 for x in range(1, len(suffixes))])
260 return f'{num / 1000.0 ** obje:.{precision}f}{suffixes[obje]}'
261 else:
262 return num
263
264 @staticmethod
265 def sizeOfRequest(res: Response) -> int:

Callers 2

runConsoleMethod · 0.80
start.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected