MCPcopy
hub / github.com/Andyyyy64/whichllm / _normalize_gpu_name

Function _normalize_gpu_name

src/whichllm/hardware/gpu_simulator.py:122–129  ·  view source on GitHub ↗

Normalize user input: 'GTX1080' → 'GTX 1080', 'RX7900XTX' → 'RX 7900 XTX'.

(name: str)

Source from the content-addressed store, hash-verified

120
121
122def _normalize_gpu_name(name: str) -> str:
123 """Normalize user input: 'GTX1080' → 'GTX 1080', 'RX7900XTX' → 'RX 7900 XTX'."""
124 # Insert space between letters and digits
125 name = re.sub(r"([A-Za-z])(\d)", r"\1 \2", name)
126 # Insert space between digits and letters
127 name = re.sub(r"(\d)([A-Za-z])", r"\1 \2", name)
128 # Collapse multiple spaces
129 return re.sub(r"\s+", " ", name).strip()
130
131
132def _substring_search(db, name: str):

Callers 1

_lookup_dbgpuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected