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

Function _needs_add_docstring

numpy/_core/function_base.py:456–471  ·  view source on GitHub ↗

Returns true if the only way to set the docstring of `obj` from python is via add_docstring. This function errs on the side of being overly conservative.

(obj)

Source from the content-addressed store, hash-verified

454
455
456def _needs_add_docstring(obj):
457 """
458 Returns true if the only way to set the docstring of `obj` from python is
459 via add_docstring.
460
461 This function errs on the side of being overly conservative.
462 """
463 Py_TPFLAGS_HEAPTYPE = 1 << 9
464
465 if isinstance(obj, (types.FunctionType, types.MethodType, property)):
466 return False
467
468 if isinstance(obj, type) and obj.__flags__ & Py_TPFLAGS_HEAPTYPE:
469 return False
470
471 return True
472
473
474def _add_docstring(obj, doc, warn_on_python):

Callers 1

_add_docstringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…