Beispiel #1
0
 def find_lineno(self):
     if self.info.variable and not self.info.make_global:
         return self._get_before_line()
     if self.info.make_global or self.info.global_:
         toplevel = self._find_toplevel(self.info.scope)
         ast = self.info.pymodule.get_ast()
         newlines = sorted(self.matched_lines + [toplevel.get_end() + 1])
         return suites.find_visible(ast, newlines)
     return self._get_after_scope()
Beispiel #2
0
 def _get_before_line(self):
     ast = self.info.scope.pyobject.get_ast()
     return suites.find_visible(ast, self.matched_lines)