Serialize ``obj`` to a VDF formatted ``str``.
(obj, pretty=False, escaped=True)
| 246 | |
| 247 | |
| 248 | def dumps(obj, pretty=False, escaped=True): |
| 249 | """Serialize ``obj`` to a VDF formatted ``str``.""" |
| 250 | if not isinstance(obj, Mapping): |
| 251 | raise TypeError("Expected data to be an instance of``dict``") |
| 252 | if not isinstance(pretty, bool): |
| 253 | raise TypeError("Expected pretty to be of type bool") |
| 254 | if not isinstance(escaped, bool): |
| 255 | raise TypeError("Expected escaped to be of type bool") |
| 256 | |
| 257 | return "".join(_dump_gen(obj, pretty, escaped)) |
| 258 | |
| 259 | |
| 260 | def dump(obj, fp, pretty=False, escaped=True): |