pylab imports work

This commit is contained in:
David Halter
2012-04-17 14:57:20 +02:00
parent dcf83069d9
commit 832a3cb2c0
5 changed files with 79 additions and 57 deletions

View File

@@ -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