NumpyDocParser
Bases: AbstractDocumentationParser
Parses documentation in the NumpyDoc format. See https://numpydoc.readthedocs.io/en/latest/format.html for more information.
This class is not thread-safe. Each thread should create its own instance.
Source code in library_analyzer/processing/api/documentation_parsing/_NumpyDocParser.py
__cached_function_node: Optional[astroid.FunctionDef] = None
instance-attribute
¶
__cached_numpydoc_string: Optional[NumpyDocString] = None
instance-attribute
¶
__get_cached_function_numpydoc_string(function_node, docstring)
¶
Returns 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.