FunctionAnalyzer
AST analyzer for ast.FunctionDef records.
Handsdown API Index / Handsdown / AST Parser / Analyzers / FunctionAnalyzer
Auto-generated documentation for handsdown.ast_parser.analyzers.function_analyzer module.
FunctionAnalyzer
Show source in function_analyzer.py:12
AST analyzer for ast.FunctionDef records.
Signature
See also
FunctionAnalyzer().generic_visit
Show source in function_analyzer.py:161
Do nothing for unknown ast.AST nodes.
Arguments
node- AST node.
Signature
FunctionAnalyzer().visit_AsyncFunctionDef
Show source in function_analyzer.py:142
Entrypoint for the analyzer for asynchronous functions.
Visits each node from node.args.
Adds new ast.expr entry to decorator_nodes for each node
from node.decorator_list.
Sets return_type_hint to node.returns if it defined.
Examples
Arguments
node- AST node.
Signature
FunctionAnalyzer().visit_FunctionDef
Show source in function_analyzer.py:123
Entrypoint for the analyzer.
Visits each node from node.args.
Adds new ast.expr entry to decorator_nodes for each node
from node.decorator_list.
Sets return_type_hint to node.returns if it defined.
Examples
Arguments
node- AST node.
Signature
FunctionAnalyzer().visit_arguments
Show source in function_analyzer.py:38
Parse info about class method statements.
Adds new ArgumentRecord entry to argument_records for each argument.
Examples
# simple arguments
def my_func(
arg1,
arg_default="value",
*args,
**kwargs,
):
pass
# type annotated arguments
def my_func_typed(
arg1: str,
arg_default: str = "value",
):
pass
# keyword-only arguments
def my_func_kw_only(
*,
kw_only_arg
):
pass
# pos-only arguments for py38
def my_func_kw_only(
pos_only_arg,
/
):
pass
Arguments
node- AST node.