mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
pylab imports work
This commit is contained in:
10
parsing.py
10
parsing.py
@@ -145,7 +145,7 @@ class Scope(Simple):
|
||||
|
||||
def get_imports(self):
|
||||
""" Gets also the imports within flow statements """
|
||||
i = self.imports
|
||||
i = [] + self.imports
|
||||
for s in self.statements:
|
||||
if isinstance(s, Scope):
|
||||
i += s.get_imports()
|
||||
@@ -404,6 +404,12 @@ class Flow(Scope):
|
||||
else:
|
||||
return self.get_parent_until(Class, Function).get_set_vars()
|
||||
|
||||
def get_imports(self):
|
||||
i = super(Flow, self).get_imports()
|
||||
if self.next:
|
||||
i += self.next.get_imports()
|
||||
return i
|
||||
|
||||
def set_next(self, next):
|
||||
""" Set the next element in the flow, those are else, except, etc. """
|
||||
if self.next:
|
||||
@@ -1199,7 +1205,7 @@ class PyFuzzyParser(object):
|
||||
while indent <= self.scope.indent \
|
||||
and (token_type == tokenize.NAME or tok in ['(', '['])\
|
||||
and self.scope != self.top:
|
||||
debug.warning('syntax error: dedent @%s - %s<=%s', \
|
||||
debug.dbg('syntax: dedent @%s - %s<=%s', \
|
||||
(self.line_nr, indent, self.scope.indent))
|
||||
self.scope.line_end = self.line_nr
|
||||
self.scope = self.scope.parent
|
||||
|
||||
Reference in New Issue
Block a user