PyfileParser
PyfileParser(path)
Bases: NodeVisitor
Attributes:
Name | Type | Description |
---|---|---|
modulename |
str
|
the name of the module without the .py extension |
content |
dict
|
a dictionnary with two keys : |
Constructor method of the class. Args: path (str): The full path to a python file that has been parsed. Returns: mkds_pyfile_parser : An instance of this class.
Attributes
auto_fast_docs.auto_doc.PyfileParser.content
instance-attribute
content = {'functions': [], 'classes': []}
auto_fast_docs.auto_doc.PyfileParser.context
instance-attribute
context = [modulename]
auto_fast_docs.auto_doc.PyfileParser.modulename
instance-attribute
modulename = splitext(split(path)[1])[0]
auto_fast_docs.auto_doc.PyfileParser.path
instance-attribute
path = path
auto_fast_docs.auto_doc.PyfileParser.visit_AsyncFunctionDef
class-attribute
instance-attribute
visit_AsyncFunctionDef = visit_FunctionDef
Functions
auto_fast_docs.auto_doc.PyfileParser.aggreg_context
aggreg_context()
auto_fast_docs.auto_doc.PyfileParser.check_exclusion
check_exclusion(node, exclusion_context)
auto_fast_docs.auto_doc.PyfileParser.is_empty
is_empty()
Returns:
Name | Type | Description |
---|---|---|
bool |
DESCRIPTION. |
auto_fast_docs.auto_doc.PyfileParser.visit
visit(generic_arg=None)
Takes as argument the output of ast.parse().
Itself takes as argument the str returned by reading a whole .py
file.
This method is the way we visit every node of the file and on the way,
we register the classes and functions names.
Returns:
NoneType : Returns None. Use to be able to fill content
with the classes and methods of the file.
Example:
parser = mkds_pyfile_parser(filepath)
parser.visit()
print(parser.content)
EXCLUDE_FUNC_OR_CLASS_FROM_MKDOCSTRINGS
anywhere in the doctring of your function/class.
In the same way, a whole module can be excluded by including the balise
<EXCLUDE_MODULE_FROM_MKDOCSTRINGS
> (with angle brackets)
anywhere in the boilerplate at the top of your module.
auto_fast_docs.auto_doc.PyfileParser.visit_ClassDef
visit_ClassDef(node)
auto_fast_docs.auto_doc.PyfileParser.visit_FunctionDef
visit_FunctionDef(node) -> Any
auto_fast_docs.auto_doc.PyfileParser.visit_Lambda
visit_Lambda(node)
auto_fast_docs.auto_doc.PyfileParser.visit_Module
visit_Module(node)