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

Function add_newdoc

numpy/core/code_generators/ufunc_docstrings.py:42–62  ·  view source on GitHub ↗
(place, name, doc)

Source from the content-addressed store, hash-verified

40}
41
42def add_newdoc(place, name, doc):
43 doc = textwrap.dedent(doc).strip()
44
45 skip = (
46 # gufuncs do not use the OUT_SCALAR replacement strings
47 'matmul',
48 # clip has 3 inputs, which is not handled by this
49 'clip',
50 )
51 if name[0] != '_' and name not in skip:
52 if '\nx :' in doc:
53 assert '$OUT_SCALAR_1' in doc, "in {}".format(name)
54 elif '\nx2 :' in doc or '\nx1, x2 :' in doc:
55 assert '$OUT_SCALAR_2' in doc, "in {}".format(name)
56 else:
57 assert False, "Could not detect number of inputs in {}".format(name)
58
59 for k, v in subst.items():
60 doc = doc.replace('$' + k, v)
61
62 docdict['.'.join((place, name))] = doc
63
64
65add_newdoc('numpy.core.umath', 'absolute',

Callers 1

Calls 3

stripMethod · 0.80
replaceMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected