MCPcopy
hub / github.com/SirVer/ultisnips / conv

Function conv

pythonx/UltiSnips/vim_helper.py:100–113  ·  view source on GitHub ↗

Convert obj.

(obj)

Source from the content-addressed store, hash-verified

98 dicts, lists and strings."""
99
100 def conv(obj):
101 """Convert obj."""
102 if isinstance(obj, list):
103 rv = "[" + ",".join(conv(o) for o in obj) + "]"
104 elif isinstance(obj, dict):
105 rv = (
106 "{"
107 + ",".join([f"{conv(key)}:{conv(value)}" for key, value in obj.items()])
108 + "}"
109 )
110 else:
111 escaped = obj.replace('"', '\\"')
112 rv = f'"{escaped}"'
113 return rv
114
115 return conv(inp)
116

Callers 1

escapeFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected