We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e1b9599 + 84b2b29 commit 37914acCopy full SHA for 37914ac
python/pydocstring.py
@@ -129,7 +129,16 @@ def _object_tree(self):
129
sig_line = last_row
130
131
# remove obj_indent from the beginning of all lines
132
- data = '\n'.join([re.sub('^'+obj_indent, '', l) for l in lines])
+ lines = [re.sub('^'+obj_indent, '', l) for l in lines]
133
+ for i, l in enumerate(reversed(lines)):
134
+ if l.strip() == '':
135
+ lines.pop()
136
+ else:
137
+ break
138
+ if len(lines) == 1:
139
+ lines.append(f'{self.env.python_indent}pass')
140
+
141
+ data = '\n'.join(lines)
142
try:
143
tree = ast.parse(data)
144
except Exception as e:
0 commit comments