Anonymous avatar Anonymous committed 4656463

codeassist: using evaluate.get_pyname_in_scope()

Comments (0)

Files changed (2)

rope/base/evaluate.py

     return evaluator.old_result, evaluator.result
 
 
-def get_string_result(scope, string):
-    evaluator = StatementEvaluator(scope)
-    node = ast.parse(string)
-    ast.walk(node, evaluator)
-    return evaluator.result
-
-
 def get_pyname_in_scope(holding_scope, name):
     return get_primary_and_pyname_in_scope(holding_scope, name)[1]
 
     return get_primary_and_result(holding_scope, node)
 
 
+def get_string_result(scope, string):
+    """use `get_pyname_in_scope` instead"""
+    evaluator = StatementEvaluator(scope)
+    node = ast.parse(string)
+    ast.walk(node, evaluator)
+    return evaluator.result
+
+
 class BadIdentifierError(rope.base.exceptions.RopeError):
     pass
 

rope/contrib/codeassist.py

     pymodule = _get_pymodule(project.pycore, source_code,
                              resource, maxfixes=maxfixes)
     scope = pymodule.get_scope().get_inner_scope_for_line(lineno)
-    result = rope.base.evaluate.get_string_result(scope, expression)
+    result = rope.base.evaluate.get_pyname_in_scope(scope, expression)
     new_code = pymodule.source_code
     if result is None or new_code.startswith(source_code[:offset]):
         if offset < len(new_code):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.