1
0
forked from VimPlug/jedi

Merge pull request #141 from tkf/attribute-docstring

Attribute docstring support
This commit is contained in:
David Halter
2013-03-10 13:23:47 -07:00
4 changed files with 55 additions and 1 deletions

View File

@@ -395,6 +395,19 @@ class Parser(object):
self._check_user_stmt(stmt)
# Attribute docstring (PEP 257) support
try:
# If string literal is being parsed
first_tok = stmt.token_list[0]
if (not stmt.set_vars and
not stmt.used_vars and
len(stmt.token_list) == 1 and
first_tok[0] == tokenize.STRING):
# ... then set it as a docstring
self.scope.statements[-1].add_docstr(first_tok[1])
except (IndexError, AttributeError):
pass
if tok in always_break + not_first_break:
self._gen.push_last_back()
return stmt, tok