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)
| 454 | |
| 455 | |
| 456 | def _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 | |
| 474 | def _add_docstring(obj, doc, warn_on_python): |
no outgoing calls
no test coverage detected
searching dependent graphs…