MCPcopy
hub / github.com/sphinx-doc/sphinx / visit_FunctionDef

Method visit_FunctionDef

sphinx/pycode/parser.py:484–498  ·  view source on GitHub ↗

Handles FunctionDef node and set context.

(self, node: ast.FunctionDef)

Source from the content-addressed store, hash-verified

482 self.current_classes.pop()
483
484 def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
485 """Handles FunctionDef node and set context."""
486 if self.current_function is None:
487 # should be called before setting self.current_function
488 self.add_entry(node.name)
489 if self.is_final(node.decorator_list):
490 self.add_final_entry(node.name)
491 if self.is_overload(node.decorator_list):
492 self.add_overload_entry(node)
493 self.context.append(node.name)
494 self.current_function = node
495 for child in node.body:
496 self.visit(child)
497 self.context.pop()
498 self.current_function = None
499
500 def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None:
501 """Handles AsyncFunctionDef node and set context."""

Callers 1

Calls 8

add_entryMethod · 0.95
is_finalMethod · 0.95
add_final_entryMethod · 0.95
is_overloadMethod · 0.95
add_overload_entryMethod · 0.95
visitMethod · 0.95
popMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected