def conninfo_parse(conninfo):
    "Conninfo parser routine based on libpq conninfo_parse"
    options = {}
    buf = conninfo + " "
    tmp = pname = ""
    quoted_string = False
    cp = 0
    while cp < len(buf):
        # Skip blanks before the parameter name
        c = buf[cp]
        if c.isspace() and tmp and not quoted_string and pname:
            options[pname] = tmp
            tmp = pname = ""
        elif c == "'":
            quoted_string = not quoted_string
        elif c == '\\':
            cp += 1
            tmp += buf[cp]      
        elif c == "=":
            if not tmp:
                raise RuntimeError(cp % "missing parameter name (conninfo:%s)")
            pname = tmp
            tmp = ""
        elif not c.isspace() or quoted_string:
            tmp += c
        cp += 1
    if quoted_string:
        raise RuntimeError("unterminated quoted string (conninfo:%s)" % cp)
    return options
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pg8000/interface.py/conninfo_parse/swapped operands of `%`