Anonymous avatar Anonymous committed ba7f543

evaluate: renamed get_pyname_at() to eval_location

Comments (0)

Files changed (12)

rope/base/evaluate.py

     return pyname_finder.get_primary_and_pyname_at(offset)
 
 
-def get_pyname_at(pymodule, offset):
+def eval_location(pymodule, offset):
     """Find the pyname at the offset"""
     return get_primary_and_pyname_at(pymodule, offset)[1]
 

rope/contrib/codeassist.py

         scope = pymodule.get_scope().get_inner_scope_for_line(lineno)
         return rope.base.evaluate.get_pyname_in_scope(scope, expression)
     def new_pyname():
-        return rope.base.evaluate.get_pyname_at(pymodule, offset)
+        return rope.base.evaluate.eval_location(pymodule, offset)
     new_code = pymodule.source_code
     if new_code.startswith(source_code[:offset + 1]):
         return new_pyname()

rope/contrib/findit.py

     """
     name = worder.get_name_at(resource, offset)
     this_pymodule = project.pycore.resource_to_pyobject(resource)
-    pyname = rope.base.evaluate.get_pyname_at(this_pymodule, offset)
+    pyname = rope.base.evaluate.eval_location(this_pymodule, offset)
     if pyname is not None:
         pyobject = pyname.get_object()
         if not isinstance(pyobject, rope.base.pyobjects.PyFunction) or \

rope/refactor/encapsulate_field.py

         self.pycore = project.pycore
         self.name = worder.get_name_at(resource, offset)
         this_pymodule = self.pycore.resource_to_pyobject(resource)
-        self.pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        self.pyname = evaluate.eval_location(this_pymodule, offset)
         if not self._is_an_attribute(self.pyname):
             raise exceptions.RefactoringError(
                 'Encapsulate field should be performed on class attributes.')

rope/refactor/inline.py

     """
     pycore = project.pycore
     this_pymodule = pycore.resource_to_pyobject(resource)
-    pyname = evaluate.get_pyname_at(this_pymodule, offset)
+    pyname = evaluate.eval_location(this_pymodule, offset)
     message = 'Inline refactoring should be performed on ' \
               'a method, local variable or parameter.'
     if pyname is None:
         self.project = project
         self.pycore = project.pycore
         this_pymodule = self.pycore.resource_to_pyobject(resource)
-        self.pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        self.pyname = evaluate.eval_location(this_pymodule, offset)
         range_finder = worder.Worder(resource.read())
         self.region = range_finder.get_primary_range(offset)
         self.name = range_finder.get_word_at(offset)

rope/refactor/introduce_factory.py

         self.offset = offset
 
         this_pymodule = self.pycore.resource_to_pyobject(resource)
-        self.old_pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        self.old_pyname = evaluate.eval_location(this_pymodule, offset)
         if self.old_pyname is None or not isinstance(self.old_pyname.get_object(),
                                                      rope.base.pyobjects.PyClass):
             raise rope.base.exceptions.RefactoringError(

rope/refactor/introduce_parameter.py

 
     def _get_name_and_pyname(self):
         return (worder.get_name_at(self.resource, self.offset),
-                evaluate.get_pyname_at(self.pymodule, self.offset))
+                evaluate.eval_location(self.pymodule, self.offset))
 
     def get_changes(self, new_parameter):
         definition_info = functionutils.DefinitionInfo.read(self.pyfunction)

rope/refactor/localtofield.py

     def get_changes(self):
         name = worder.get_name_at(self.resource, self.offset)
         this_pymodule = self.pycore.resource_to_pyobject(self.resource)
-        pyname = evaluate.get_pyname_at(this_pymodule, self.offset)
+        pyname = evaluate.eval_location(this_pymodule, self.offset)
         if not self._is_a_method_local(pyname):
             raise exceptions.RefactoringError(
                 'Convert local variable to field should be performed on \n'

rope/refactor/method_object.py

     def __init__(self, project, resource, offset):
         self.pycore = project.pycore
         this_pymodule = self.pycore.resource_to_pyobject(resource)
-        pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        pyname = evaluate.eval_location(this_pymodule, offset)
         if pyname is None or not isinstance(pyname.get_object(),
                                             pyobjects.PyFunction):
             raise exceptions.RefactoringError(

rope/refactor/move.py

     if offset is None:
         return MoveModule(project, resource)
     this_pymodule = project.pycore.resource_to_pyobject(resource)
-    pyname = evaluate.get_pyname_at(this_pymodule, offset)
+    pyname = evaluate.eval_location(this_pymodule, offset)
     if pyname is None:
         raise exceptions.RefactoringError(
             'Move only works on classes, functions, modules and methods.')
         self.project = project
         self.pycore = project.pycore
         this_pymodule = self.pycore.resource_to_pyobject(resource)
-        pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        pyname = evaluate.eval_location(this_pymodule, offset)
         self.method_name = worder.get_name_at(resource, offset)
         self.pyfunction = pyname.get_object()
         if self.pyfunction.get_kind() != 'method':
     def __init__(self, project, resource, offset):
         self.pycore = project.pycore
         this_pymodule = self.pycore.resource_to_pyobject(resource)
-        self.old_pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        self.old_pyname = evaluate.eval_location(this_pymodule, offset)
         self.old_name = self.old_pyname.get_object().get_name()
         pymodule = self.old_pyname.get_object().get_module()
         self.source = pymodule.get_resource()

rope/refactor/rename.py

         self.offset = offset
         self.old_name = worder.get_name_at(resource, offset)
         self.pymodule = self.pycore.resource_to_pyobject(self.resource)
-        self.old_pyname = evaluate.get_pyname_at(self.pymodule, offset)
+        self.old_pyname = evaluate.eval_location(self.pymodule, offset)
 
     def get_old_name(self):
         word_finder = worder.Worder(self.resource.read())

rope/refactor/usefunction.py

         self.project = project
         self.offset = offset
         this_pymodule = project.pycore.resource_to_pyobject(resource)
-        pyname = evaluate.get_pyname_at(this_pymodule, offset)
+        pyname = evaluate.eval_location(this_pymodule, offset)
         if pyname is None:
             raise exceptions.RefactoringError('Unresolvable name selected')
         self.pyfunction = pyname.get_object()
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.