MCPcopy Create free account
hub / github.com/numpy/numpy / _c_string_literal

Function _c_string_literal

numpy/distutils/system_info.py:224–232  ·  view source on GitHub ↗

Convert a python string into a literal suitable for inclusion into C code

(s)

Source from the content-addressed store, hash-verified

222
223
224def _c_string_literal(s):
225 """
226 Convert a python string into a literal suitable for inclusion into C code
227 """
228 # only these three characters are forbidden in C strings
229 s = s.replace('\\', r'\\')
230 s = s.replace('"', r'\"')
231 s = s.replace('\n', r'\n')
232 return '"{}"'.format(s)
233
234
235def libpaths(paths, bits):

Callers 3

get_atlas_versionFunction · 0.85
calc_infoMethod · 0.85
calc_infoMethod · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected