GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Split up regex · python/cpython@578e0cc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib/profiling/sampling
    • cli.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/profiling/sampling/cli.py‎

Copy file name to clipboardExpand all lines: Lib/profiling/sampling/cli.py
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,19 @@ def _run_with_sync(original_cmd, suppress_output=False):
288288
return process
289289

290290

291-
_RATE_PATTERN = re.compile(r'^(\d+(?:\.\d+)?)(hz|khz|k)?$', re.IGNORECASE)
291+
_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)
292304

293305

294306
def _parse_sampling_rate(rate_str: str) -> int:

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.