diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 704efab8..7dc032a3 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -275,7 +275,7 @@ class Script(object): raise NotFoundError() if isinstance(stmt, pr.KeywordStatement): stmt = stmt.stmt - if not isinstance(stmt, pr.Statement): + if not isinstance(stmt, pr.ExprStmt): raise NotFoundError() user_stmt = self._parser.user_stmt() @@ -465,7 +465,7 @@ class Script(object): # The Evaluator.goto function checks for definitions, but since we # use a reverse tokenizer, we have new name_part objects, so we # have to check the user_stmt here for positions. - if isinstance(user_stmt, pr.Statement): + if isinstance(user_stmt, pr.ExprStmt): for name in user_stmt.get_defined_names(): if name.start_pos <= self._pos <= name.end_pos \ and len(name.names) == 1: @@ -497,7 +497,7 @@ class Script(object): # Once Script._goto works correct, we can probably remove this # branch. - if isinstance(user_stmt, pr.Statement): + if isinstance(user_stmt, pr.ExprStmt): c = user_stmt.expression_list()[0] if not isinstance(c, unicode) and self._pos < c.start_pos: # The lookup might be before `=` diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 96fe14c2..c21474ae 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -332,7 +332,7 @@ class BaseDefinition(object): # Functions, classes and modules are already fixed definitions, we # cannot follow them anymore. return [self] - stmt_or_imp = self._definition.get_parent_until((pr.Statement, pr.Import)) + stmt_or_imp = self._definition.get_parent_until((pr.ExprStmt, pr.Import)) call_path = call_path_for_name_part(stmt_or_imp, self._definition) names = self._evaluator.goto(stmt_or_imp, call_path) return [Definition(self._evaluator, n) for n in names] @@ -352,7 +352,7 @@ class BaseDefinition(object): elif isinstance(stripped, pr.Class): stripped = er.Class(self._evaluator, stripped) - if stripped.isinstance(pr.Statement): + if stripped.isinstance(pr.ExprStmt): return self._evaluator.eval_statement(stripped) elif stripped.isinstance(pr.Import): return imports.follow_imports(self._evaluator, [stripped]) @@ -606,7 +606,7 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)): return None elif isinstance(d, pr.Param): name = d.get_name() - elif isinstance(d, pr.Statement): + elif isinstance(d, pr.ExprStmt): try: expression_list = d.assignment_details[0][0] name = expression_list[0].name.names[-1] diff --git a/jedi/cache.py b/jedi/cache.py index b8784c51..fd95670c 100644 --- a/jedi/cache.py +++ b/jedi/cache.py @@ -243,7 +243,7 @@ def save_parser(path, name, parser, pickling=True): class ParserPickling(object): - version = 15 + version = 16 """ Version number (integer) for file system cache. diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 55003f3c..948d085d 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -123,7 +123,7 @@ class Evaluator(object): names are defined in the statement, `seek_name` returns the result for this name. - :param stmt: A `pr.Statement`. + :param stmt: A `pr.ExprStmt`. """ debug.dbg('eval_statement %s (%s)', stmt, seek_name) expression_list = stmt.expression_list() diff --git a/jedi/evaluate/finder.py b/jedi/evaluate/finder.py index 87643644..3e2ea40c 100644 --- a/jedi/evaluate/finder.py +++ b/jedi/evaluate/finder.py @@ -100,7 +100,7 @@ class NameFinder(object): if isinstance(stmt, (pr.Param, pr.Import)) \ or isinstance(name_list_scope, (pr.Lambda, pr.ListComprehension, er.Instance, InterpreterNamespace)) \ or isinstance(scope, compiled.CompiledObject) \ - or isinstance(stmt, pr.Statement) and stmt.is_global(): + or isinstance(stmt, pr.ExprStmt) and stmt.is_global(): # Always reachable. result.append(name) else: @@ -152,7 +152,7 @@ class NameFinder(object): """ Returns True except for nested imports and instance variables. """ - if stmt.isinstance(pr.Statement): + if stmt.isinstance(pr.ExprStmt): if isinstance(name, er.InstanceElement) and not name.is_class_var: return False elif isinstance(stmt, pr.Import) and stmt.is_nested(): @@ -175,7 +175,7 @@ class NameFinder(object): return True def _name_is_array_assignment(self, name, stmt): - if stmt.isinstance(pr.Statement): + if stmt.isinstance(pr.ExprStmt): def is_execution(calls): for c in calls: if isinstance(c, (unicode, str, tokenize.Token)): @@ -224,7 +224,7 @@ class NameFinder(object): types += self._handle_for_loops(typ) elif isinstance(typ, pr.Param): types += self._eval_param(typ) - elif typ.isinstance(pr.Statement): + elif typ.isinstance(pr.ExprStmt): if typ.is_global(): # global keyword handling. types += evaluator.find_types(typ.parent.parent, str(name)) diff --git a/jedi/evaluate/sys_path.py b/jedi/evaluate/sys_path.py index c251c81d..74d4b98b 100644 --- a/jedi/evaluate/sys_path.py +++ b/jedi/evaluate/sys_path.py @@ -112,7 +112,7 @@ def _check_module(evaluator, module): except KeyError: return get_sys_path() sys_path = list(get_sys_path()) # copy - statements = (p for p in possible_stmts if isinstance(p, pr.Statement)) + statements = (p for p in possible_stmts if isinstance(p, pr.ExprStmt)) for stmt in statements: expressions = stmt.expression_list() if len(expressions) == 1 and isinstance(expressions[0], pr.Call):