MCPcopy
hub / github.com/MinishLab/semble / _format_token_count

Function _format_token_count

src/semble/stats.py:145–151  ·  view source on GitHub ↗

Format a token count with k/M suffix, keeping the ~ prefix for estimates.

(tokens: int)

Source from the content-addressed store, hash-verified

143
144
145def _format_token_count(tokens: int) -> str:
146 """Format a token count with k/M suffix, keeping the ~ prefix for estimates."""
147 if tokens >= 1_000_000:
148 return f"~{tokens / 1_000_000:.1f}M"
149 if tokens >= 1_000:
150 return f"~{tokens / 1_000:.1f}k"
151 return f"~{tokens}"
152
153
154def _format_calls(calls: int) -> str:

Callers 1

format_savings_reportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected