NumpyDocParser
Bases: AbstractDocstringParser
Parse documentation in the NumpyDoc format.
Notes
This class is not thread-safe. Each thread should create its own instance.
References
.. [1] https://numpydoc.readthedocs.io/en/latest/format.html
Source code in src/library_analyzer/processing/api/docstring_parsing/_numpydoc_parser.py
__cached_docstring: Docstring | None = None
instance-attribute
¶
__cached_function_node: astroid.FunctionDef | None = None
instance-attribute
¶
__get_cached_function_numpydoc_string(function_node, docstring)
¶
Return the NumpyDocString for the given function node.
It is only recomputed when the function node differs from the previous one that was passed to this function. This avoids reparsing the docstring for the function itself and all of its parameters.
On Lars's system this caused a significant performance improvement: Previously, 8.382s were spent inside the
function get_parameter_documentation when parsing sklearn. Afterwards, it was only 2.113s.