forked from VimPlug/jedi
Merge pull request #141 from tkf/attribute-docstring
Attribute docstring support
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user