Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 1f21307

Browse files
committed
Saving astroid stuff.
1 parent 0c11410 commit 1f21307

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

requirements/runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
astroid
1+
astroid

src/pydocstyle/parser.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,19 @@ def parse(self, filelike, filename):
536536
None)
537537

538538
def handle_function(self, parent, node):
539+
source_lines = node.root().source_code.split('\n')[node.lineno:node.tolineno]
540+
tokens = TokenStream(StringIO('\n'.join(
541+
node.root().source_code.split('\n')[
542+
node.lineno - 1:node.tolineno])))
543+
544+
for token in tokens:
545+
if token.value != 'def':
546+
continue
547+
539548
return Function(node.name,
540-
parent.source_code[node.fromlineno:node.tolineno],
541-
node.fromlineno, node.tolineno, node.decorators or [], node.doc,
549+
node.root().source_code[node.fromlineno:node.tolineno],
550+
node.fromlineno, node.tolineno, node.decorators or [],
551+
node.doc,
542552
[], parent)
543553

544554
# TODO: remove

0 commit comments

Comments
 (0)