1
0
forked from VimPlug/jedi

Add support for PEP 0526.

This makes it possible to assign variables like

    asdf: typing.List[int] = []
This commit is contained in:
Dave Halter
2017-01-08 03:57:35 +01:00
parent 6d00a5702f
commit 3f09f3a304
3 changed files with 36 additions and 4 deletions

View File

@@ -1531,9 +1531,14 @@ class ExprStmt(BaseNode, DocstringMixin):
__slots__ = ()
def get_defined_names(self):
return list(chain.from_iterable(_defined_names(self.children[i])
for i in range(0, len(self.children) - 2, 2)
if '=' in self.children[i + 1].value))
names = []
if self.children[1].type == 'annassign':
names = _defined_names(self.children[0])
return list(chain.from_iterable(
_defined_names(self.children[i])
for i in range(0, len(self.children) - 2, 2)
if '=' in self.children[i + 1].value)
) + names
def get_rhs(self):
"""Returns the right-hand-side of the equals."""