File tree Expand file tree Collapse file tree 3 files changed +14
-26
lines changed
Expand file tree Collapse file tree 3 files changed +14
-26
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2- import regex as re
2+ import re
33from string import Template
44
5- def test (a , b = "ahoj ): # svete" ):
6- pass
75
86# TODO: class
97# TODO: class will have func, 'one_tab' to return indent of one tab more
10- # TODO: template different docstrings
11- def google (arguments , funcdef_indent , indent ):
12- indent1 = '' .join ([funcdef_indent , indent ]) # 'one tab' more indented than funcdef
13- indent2 = '' .join ([indent1 , indent ])
14-
15- argstring = '\n ' .join (['{ind2}{name}: ' .format (ind2 = indent2 , name = arg ) for arg in arguments ])
16- docstring = '{ind}"""\n {ind}\n {ind}\n {ind}\n {ind}Args:\n {args}\n {ind}\n {ind}Returns:\n {ind2}\n {ind}\n {ind}"""' .format (\
17- ind = indent1 , ind2 = indent2 , args = argstring )
18- return docstring
19-
208def substitute_list (list_name , template , list_ ):
219 result_lines = []
2210 for line in template .split ('\n ' ):
Original file line number Diff line number Diff line change 1- $i"""
2- $i
3- $i
4- $i
5- ${i}Args:
6- #args:{${i}${i2}$item: ()\n}
7- $i
8- ${i}Returns:
9- $i$i2
10- $i
11- $i"""
1+ $i$i2"""
2+ $i$i2
3+ $i$i2
4+ $i$i2
5+ ${i}${i2}Args:
6+ #args:{${i}${i2}${i2}$item: ()\n}
7+ ${i}${i2}Returns:
8+ $i$i2$i2
9+ $i$i2
10+ $i$i2"""
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2- import regex as re
3-
2+ import re
3+ import ast
4+ from string import Template
45class MethodDocGenerator :
56
67 def __init__ (self , signature ):
You can’t perform that action at this time.
0 commit comments