Helper to convert values to old .opts format.
>>> print(toOpt('some "text"'))
"some \\"text\\""
>>> print(toOpt('first\\nsecond'))
"first
second"
>>> print(toOpt({'a': [1, 2, '3']}))
{"a": [1, 2, "3"]}
Definition at line 162 of file Main.py.
164 Helper to convert values to old .opts format. 166 >>> print(toOpt('some "text"')) 168 >>> print(toOpt('first\\nsecond')) 171 >>> print(toOpt({'a': [1, 2, '3']})) 174 if isinstance(value, six.string_types):
175 return '"{0}"'.
format(value.replace(
'"',
'\\"'))
176 elif isinstance(value, dict):
177 return '{{{0}}}'.
format(
', '.join(
179 elif hasattr(value,
'__iter__'):
180 return '[{0}]'.
format(
', '.join(
map(toOpt, value)))
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
struct GAUDI_API map
Parametrisation class for map-like implementation.