MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / escape_char

Method escape_char

tools/python-3.11.9-amd64/Lib/ast.py:1117–1125  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

1115 Returns the tuple (string literal to write, possible quote types).
1116 """
1117 def escape_char(c):
1118 # \n and \t are non-printable, but we only escape them if
1119 # escape_special_whitespace is True
1120 if not escape_special_whitespace and c in "\n\t":
1121 return c
1122 # Always escape backslashes and other non-printable characters
1123 if c == "\\" or not c.isprintable():
1124 return c.encode("unicode_escape").decode("ascii")
1125 return c
1126
1127 escaped_string = "".join(map(escape_char, string))
1128 possible_quotes = quote_types

Callers

nothing calls this directly

Calls 3

isprintableMethod · 0.80
decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected