@@ -1006,7 +1006,7 @@ returns=Name(id='str', ctx=Load())
10061006Here, we simplify by assuming that the return type annotation is provided and only handling the cases of ` ast.Constant ` and ` ast.Name ` nodes:
10071007
10081008``` python [highlight-lines="1-9|3-4|6-7"][class="hide-line-numbers"]
1009- def _extract_return_annotation (node : ast.AST ) -> str :
1009+ def extract_return_annotation (node : ast.AST ) -> str :
10101010
10111011 if isinstance (node, ast.Constant):
10121012 return str (node.value)
@@ -1046,10 +1046,10 @@ __return_type__
10461046 The <code>suggest_docstring()</code> function will construct docstrings based on function nodes in the AST:
10471047 </p >
10481048 <p class =" fragment fade-in-then-out " data-fragment-index =" 0 " >
1049- It formats the output from the <code>_extract_arguments ()</code> function into a parameters section (if the function has parameters):
1049+ It formats the output from the <code>extract_arguments ()</code> function into a parameters section (if the function has parameters):
10501050 </p >
10511051 <p class =" fragment fade-in-then-out " data-fragment-index =" 1 " >
1052- Next, it uses the output from the <code>_extract_returns ()</code> function to make a returns section:
1052+ Next, it uses the output from the <code>extract_return_annotation ()</code> function to make a returns section:
10531053 </p >
10541054 <p class =" fragment fade-in-then-out " data-fragment-index =" 2 " >
10551055 Everything is then combined with some placeholders and triple quotes to become a docstring template:
@@ -1076,7 +1076,7 @@ def suggest_docstring(
10761076 args = []
10771077
10781078 returns = (
1079- _extract_return_annotation (node.returns)
1079+ extract_return_annotation (node.returns)
10801080 + '\n __description__'
10811081 )
10821082
0 commit comments