MCPcopy Index your code
hub / github.com/numpy/numpy / normalize_doc

Function normalize_doc

numpy/_core/code_generators/generate_umath_doc.py:8–17  ·  view source on GitHub ↗
(docstring)

Source from the content-addressed store, hash-verified

6
7
8def normalize_doc(docstring):
9 docstring = textwrap.dedent(docstring).strip()
10 docstring = docstring.encode('unicode-escape').decode('ascii')
11 docstring = docstring.replace(r'"', r'\"')
12 docstring = docstring.replace(r"'", r"\'")
13 # Split the docstring because some compilers (like MS) do not like big
14 # string literal in C code. We split at endlines because textwrap.wrap
15 # do not play well with \n
16 docstring = '\\n\"\"'.join(docstring.split(r"\n"))
17 return docstring
18
19def write_code(target):
20 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.80
splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…