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

Function make_escapes

tools/python-3.11.9-amd64/Tools/i18n/pygettext.py:206–224  ·  view source on GitHub ↗
(pass_nonascii)

Source from the content-addressed store, hash-verified

204
205
206def make_escapes(pass_nonascii):
207 global escapes, escape
208 if pass_nonascii:
209 # Allow non-ascii characters to pass through so that e.g. 'msgid
210 # "H�he"' would result not result in 'msgid "H\366he"'. Otherwise we
211 # escape any character outside the 32..126 range.
212 mod = 128
213 escape = escape_ascii
214 else:
215 mod = 256
216 escape = escape_nonascii
217 escapes = [r"\%03o" % i for i in range(mod)]
218 for i in range(32, 127):
219 escapes[i] = chr(i)
220 escapes[ord('\\')] = r'\\'
221 escapes[ord('\t')] = r'\t'
222 escapes[ord('\r')] = r'\r'
223 escapes[ord('\n')] = r'\n'
224 escapes[ord('\"')] = r'\"'
225
226
227def escape_ascii(s, encoding):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected