Did I find the right examples for you? yes no

All Samples(6)  |  Call(2)  |  Derive(0)  |  Import(4)

        def string2dict(raw_content, encoding="utf-8"):
    """
    convert a string into a dictionary. e.g.:

    >>> string2dict('key1="value1" key2="value2"')
    {'key2': 'value2', 'key1': 'value1'}
    
    See test_creole2html.TestString2Dict()
    """
    if not PY3 and isinstance(raw_content, TEXT_TYPE):
        # shlex.split doesn't work with unicode?!?
        raw_content = raw_content.encode(encoding)

    parts = shlex.split(raw_content)

    result = {}
    for part in parts:
        key, value = part.split("=", 1)

        if value in KEYWORD_MAP:
            # True False or None
            value = KEYWORD_MAP[value]
        else:
            # A number?
            try:
                value = int(value.strip("'\""))
            except ValueError:
                pass

        result[key] = value

    return result
        


src/p/y/python-creole-1.1.1/creole/creole2html/emitter.py   python-creole(Download)
from creole.creole2html.parser import CreoleParser
from creole.py3compat import TEXT_TYPE, repr2
from creole.shared.utils import string2dict
 
 
        args = node.macro_args
        try:
            macro_kwargs = string2dict(args)
        except ValueError as e:
            exc_info = sys.exc_info()

src/p/y/python-creole-HEAD/creole/creole2html/emitter.py   python-creole(Download)
from creole.creole2html.parser import CreoleParser
from creole.py3compat import TEXT_TYPE, repr2
from creole.shared.utils import string2dict
 
 
        args = node.macro_args
        try:
            macro_kwargs = string2dict(args)
        except ValueError as e:
            exc_info = sys.exc_info()

src/p/y/python-creole-HEAD/creole/tests/test_creole2html.py   python-creole(Download)
from creole import creole2html
from creole.shared import example_macros
from creole.shared.utils import string2dict, dict2string
 
 

src/p/y/python-creole-1.1.1/creole/tests/test_creole2html.py   python-creole(Download)
from creole import creole2html
from creole.shared import example_macros
from creole.shared.utils import string2dict, dict2string