From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 22 Dec 2025 14:15:57 +0000 (+0200) Subject: gh-142927: Tachyon: Comma separate thousands and fix singular/plurals (#142934) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff7f62eb2333ac2a2ce2726ba1763bf2fa1956e2;p=thirdparty%2FPython%2Fcpython.git gh-142927: Tachyon: Comma separate thousands and fix singular/plurals (#142934) --- diff --git a/Lib/profiling/sampling/_format_utils.py b/Lib/profiling/sampling/_format_utils.py new file mode 100644 index 000000000000..237a4f4186bf --- /dev/null +++ b/Lib/profiling/sampling/_format_utils.py @@ -0,0 +1,5 @@ +import locale + + +def fmt(value: int | float, decimals: int = 1) -> str: + return locale.format_string(f'%.{decimals}f', value, grouping=True) diff --git a/Lib/profiling/sampling/_heatmap_assets/heatmap.js b/Lib/profiling/sampling/_heatmap_assets/heatmap.js index 90b5b111d36a..53928b7b20fb 100644 --- a/Lib/profiling/sampling/_heatmap_assets/heatmap.js +++ b/Lib/profiling/sampling/_heatmap_assets/heatmap.js @@ -577,10 +577,12 @@ function populateBytecodePanel(panel, button) { else if (specPct >= 33) specClass = 'medium'; // Build specialization summary + const instruction_word = instructions.length === 1 ? 'instruction' : 'instructions'; + const sample_word = totalSamples === 1 ? 'sample' : 'samples'; let html = `