gaps.cli.config.as_script_str#

as_script_str(input_)[source]#

Convert input to how it would appear in a python script.

Essentially this means the input is dumped to json format with some minor replacements (e.g. null -> None, etc.). Importantly, all string inputs are wrapped in double quotes.

Parameters:

input_ (obj) – Any object that can be serialized with json.dumps().

Returns:

str – Input object as it would appear in a python script.

Examples

>>> as_script_str("a")
"a"
>>> as_script_str({"a": None, "b": True, "c": False, "d": 3,
...                "e": [{"t": "hi"}]})
{"a": None, "b": True, "c": False, "d": 3, "e": [{"t": "hi"}]}