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

Function normalize_doc

numpy/core/code_generators/generate_umath_doc.py:10–19  ·  view source on GitHub ↗
(docstring)

Source from the content-addressed store, hash-verified

8sys.path.pop(0)
9
10def normalize_doc(docstring):
11 docstring = textwrap.dedent(docstring).strip()
12 docstring = docstring.encode('unicode-escape').decode('ascii')
13 docstring = docstring.replace(r'"', r'\"')
14 docstring = docstring.replace(r"'", r"\'")
15 # Split the docstring because some compilers (like MS) do not like big
16 # string literal in C code. We split at endlines because textwrap.wrap
17 # do not play well with \n
18 docstring = '\\n\"\"'.join(docstring.split(r"\n"))
19 return docstring
20
21def write_code(target):
22 with open(target, 'w') as fid:

Callers 1

write_codeFunction · 0.85

Calls 6

stripMethod · 0.80
decodeMethod · 0.80
encodeMethod · 0.80
replaceMethod · 0.80
joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected