(paramstr, value_parsers={})
return result
Parses a parameter string (used for rgbgrandiant).

    :param str paramstr: The parameter string.
    :param dict value_parsers: Additional parsers to parse values.
    :rtype: dict

    Example syntax::

       myparam(foo=1; bar=hello; baz=a, b, c)

    Once parsed, it will return this::

       {
           "myparam": {
               "foo": "1",
               "bar": "hello",
               "baz": "a, b, c",
           }
       }

    Additional parsers can be provided to parse the values, see examples
    bellow.

    >>> parse_param_string("hello(name=world)")
    {'hello': {'name': 'world'}}
    >>> parse_param_string("hello(name=world;)")
    {'hello': {'name': 'world'}}
    >>> parse_param_string("hello(name=world ) ;;")
    {'hello': {'name': 'world'}}
    >>> parse_param_string("foo(a=42; b=3.14)", value_parsers={
    ...     "foo": {
    ...         "a": int,
    ...         "b": float,
    ...     },
    ... })
    {'foo': {'a': 42, 'b': 3.14}}
    >>> parse_param_string("foobar[a=1]")
    Traceback (most recent call last):
        ...
    ValueError: invalid parameter string 'foobar[a=1]'
Parses a parameter string (used for rgbgrandiant).
Parses a parameter string ( used for rgbgrandiant ) .
def parse_param_string(paramstr, value_parsers={}):
    """Parses a parameter string (used for rgbgrandiant).

    :param str paramstr: The parameter string.
    :param dict value_parsers: Additional parsers to parse values.
    :rtype: dict

    Example syntax::

       myparam(foo=1; bar=hello; baz=a, b, c)

    Once parsed, it will return this::

       {
           "myparam": {
               "foo": "1",
               "bar": "hello",
               "baz": "a, b, c",
           }
       }

    Additional parsers can be provided to parse the values, see examples
    bellow.

    >>> parse_param_string("hello(name=world)")
    {'hello': {'name': 'world'}}
    >>> parse_param_string("hello(name=world;)")
    {'hello': {'name': 'world'}}
    >>> parse_param_string("hello(name=world ) ;;")
    {'hello': {'name': 'world'}}
    >>> parse_param_string("foo(a=42; b=3.14)", value_parsers={
    ...     "foo": {
    ...         "a": int,
    ...         "b": float,
    ...     },
    ... })
    {'foo': {'a': 42, 'b': 3.14}}
    >>> parse_param_string("foobar[a=1]")
    Traceback (most recent call last):
        ...
    ValueError: invalid parameter string 'foobar[a=1]'
    """
    if not REGEXP_PARAM_STRING.match(paramstr):
        raise ValueError("invalid parameter string '%s'" % paramstr)

    name = REGEXP_PARAM_STRING.match(paramstr).group(1)
    params = REGEXP_PARAM_STRING.match(paramstr).group(2)

    try:
        result = {
            name: {
                k.strip(): v.strip()
                for k, v in [p.split("=") for p in params.split(";")]
            }
        }
    except ValueError:
        raise ValueError("invalid parameter string '%s'" % paramstr)

    if value_parsers:
        for key, value in result[name].items():
            if name in value_parsers and key in value_parsers[name]:
                result[name][key] = value_parsers[name][key](value)

    return result
def parse_param_string ( paramstr , value_parsers = { } ) : if not REGEXP_PARAM_STRING . match ( paramstr ) : raise ValueError ( "invalid parameter string '%s'" % paramstr ) name = REGEXP_PARAM_STRING . match ( paramstr ) . group ( 1 ) params = REGEXP_PARAM_STRING . match ( paramstr ) . group ( 2 ) try : result = { name : { k . strip ( ) : v . strip ( ) for k , v in [ p . split ( "=" ) for p in params . split ( ";" ) ] } } except ValueError : raise ValueError ( "invalid parameter string '%s'" % paramstr ) if value_parsers : for key , value in result [ name ] . items ( ) : if name in value_parsers and key in value_parsers [ name ] : result [ name ] [ key ] = value_parsers [ name ] [ key ] ( value ) return result