MCPcopy Create free account
hub / github.com/celery/celery / hfloat

Function hfloat

celery/utils/debug.py:119–127  ·  view source on GitHub ↗

Convert float to value suitable for humans. Arguments: f (float): The floating point number. p (int): Floating point precision (default is 5).

(f, p=5)

Source from the content-addressed store, hash-verified

117
118
119def hfloat(f, p=5):
120 """Convert float to value suitable for humans.
121
122 Arguments:
123 f (float): The floating point number.
124 p (int): Floating point precision (default is 5).
125 """
126 i = int(f)
127 return i if i == f else '{0:.{p}}'.format(f, p=p)
128
129
130def humanbytes(s):

Callers 1

humanbytesFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected