MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / format_duration

Function format_duration

mitmproxy/tools/console/common.py:335–340  ·  view source on GitHub ↗
(duration: float)

Source from the content-addressed store, hash-verified

333
334
335def format_duration(duration: float) -> tuple[str, str]:
336 pretty_duration = human.pretty_duration(duration)
337 style = "gradient_%02d" % int(
338 99 - 100 * min(math.log2(max(1.0, 1000 * duration)) / 12, 0.99)
339 )
340 return pretty_duration, style
341
342
343def format_size(num_bytes: int) -> tuple[str, str]:

Callers 5

test_format_durationsFunction · 0.90
format_http_flow_listFunction · 0.85
format_http_flow_tableFunction · 0.85
format_message_flowFunction · 0.85
format_dns_flowFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_format_durationsFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…