MCPcopy Index your code
hub / github.com/idank/explainshell / fmt_tokens

Function fmt_tokens

explainshell/util.py:134–140  ·  view source on GitHub ↗

Format token count for display (e.g. 878K, 1.8M).

(n: int)

Source from the content-addressed store, hash-verified

132
133
134def fmt_tokens(n: int) -> str:
135 """Format token count for display (e.g. 878K, 1.8M)."""
136 if n >= 1_000_000:
137 return f"{n / 1_000_000:.1f}M"
138 if n >= 1_000:
139 return f"{n / 1_000:.0f}K"
140 return str(n)
141
142
143def git_metadata() -> dict:

Callers 1

_process_one_batchFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected