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

Function _needs_add_docstring

numpy/core/function_base.py:465–480  ·  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

463
464
465def _needs_add_docstring(obj):
466 """
467 Returns true if the only way to set the docstring of `obj` from python is
468 via add_docstring.
469
470 This function errs on the side of being overly conservative.
471 """
472 Py_TPFLAGS_HEAPTYPE = 1 << 9
473
474 if isinstance(obj, (types.FunctionType, types.MethodType, property)):
475 return False
476
477 if isinstance(obj, type) and obj.__flags__ & Py_TPFLAGS_HEAPTYPE:
478 return False
479
480 return True
481
482
483def _add_docstring(obj, doc, warn_on_python):

Callers 1

_add_docstringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected