File size: 350 Bytes
03a907a
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
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