MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / quote

Method quote

imperative/python/megengine/tools/draw_graph.py:18–30  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

16
17 def __str__(self):
18 def quote(s):
19 r = {
20 "\\": "\\\\",
21 "{": r"\{",
22 "}": r"\}",
23 "|": r"\|",
24 "<": r"\<",
25 ">": r"\>",
26 "\n": r"\n",
27 }
28 for k, v in r.items():
29 s = s.replace(k, v)
30 return s
31
32 def pport(d):
33 return "|".join("<{}> {}".format(k, quote(v)) for k, v in d.items())

Callers

nothing calls this directly

Calls 2

itemsMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected