We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f09e84e commit 578e0ccCopy full SHA for 578e0cc
1 file changed
Lib/profiling/sampling/cli.py
@@ -288,7 +288,19 @@ def _run_with_sync(original_cmd, suppress_output=False):
288
return process
289
290
291
-_RATE_PATTERN = re.compile(r'^(\d+(?:\.\d+)?)(hz|khz|k)?$', re.IGNORECASE)
+_RATE_PATTERN = re.compile(r'''
292
+ ^ # Start of string
293
+ ( # Group 1: The numeric value
294
+ \d+ # One or more digits (integer part)
295
+ (?:\.\d+)? # Optional: decimal point followed by digits
296
+ ) # Examples: "10", "0.5", "100.25"
297
+ ( # Group 2: Optional unit suffix
298
+ hz # "hz" - hertz
299
+ | khz # "khz" - kilohertz
300
+ | k # "k" - shorthand for kilohertz
301
+ )? # Suffix is optional (bare number = Hz)
302
+ $ # End of string
303
+ ''', re.VERBOSE | re.IGNORECASE)
304
305
306
def _parse_sampling_rate(rate_str: str) -> int:
0 commit comments