Spaces:
Running
Running
| def parse_pairs(raw: str) -> dict[str, int]: | |
| """Parse strings like 'a=1,b=2' into a dict.""" | |
| result = {} | |
| if not raw: | |
| return result | |
| for segment in raw.split(","): | |
| key, value = segment.split("=") | |
| # BUG: does not strip whitespace around keys/values. | |
| result[key] = int(value) | |
| return result | |