Commits

Anonymous committed 957385d

0.5m1

  • Participants
  • Parent commits 615ce03

Comments (0)

Files changed (21)

 Overview
 ========
 
-`rope`_ is a python refactoring IDE and library.  Its main goal is to
-provide features like refactoring, auto-completion, code assist and
-outline views.  It is written in python and uses Tkinter library.
+`rope`_ is a python refactoring IDE and library.  The IDE uses the
+library for providing features like refactoring, code assist, and
+auto-completion.  It is written in python.  The IDE uses `Tkinter`
+library.
 
 .. _`rope`: http://rope.sf.net/
 
 New Features
 ============
 
-* 
+* Replace method with method object refactoring
+* Changing editor font and keybinding in ``~/.rope``
+* Handling ``with`` statements
+* Having two keybindings emacs/normal
+* Performing change signature in class hierarchies
+* Supporting builtin `zip` and `enumerate`
+* Execute command; ``M-x``
+* Removing extra spaces and lines; ``C-c C-f``
+
+From this release, rope reads preferences from ``~/.rope`` file.  You
+can edit this file to do things like changing the keybindings and
+changing the font.  The good thing about this file is that it is in
+python.  So you can do anything you like there before rope starts.
+For example you can register your own `Actions` (see
+`rope.ui.extension` module for more information) there.  You can
+edit ``~/.rope`` using rope itself, too. (``Edit ~/.rope`` in ``Edit``
+menu or ``edit_dot_rope`` action in execute_command.)
+
+One of the main problems new users of rope had was that rope used
+emacs keybinding and those not familiar with it had a hard time working
+with rope.  This release adds a normal keybinding.  You can use it
+by editing ``edit_to_rope`` file and setting ``i_like_emacs`` variable
+to `False`.  The emacs keybinding has been enhanced very much.  But
+be careful! Once you get used to it, you'll be addicted to rope!
+
+The names of some the refactoring classes have been changed.  Those
+who used rope library probably have to update their code.  The base
+parts of rope has been enhanced maybe as much as the UI parts.
+Introduce Method object refactoring has been added.  Some of the old
+refactorings have been enhanced and the occurrence finding got notably
+faster.
 
 
 Getting Started
 .. _`docs/index.txt`: docs/index.html
 .. _`docs/dev/contributing.txt`: docs/dev/contributing.html
 .. _`docs/dev/library.txt`: docs/dev/library.html
-

docs/dev/contributing.txt

 
 Rope was started because of the lack of good refactoring tools for
 python.  But after observing python IDE limitations we grew bigger
-ideas in our head.
+ideas in our heads.
 
 If you want to have more a powerful python IDE and have big ideas
 in your head, you are welcome to get involved.

docs/dev/done.txt

 ===========
 
 
+> Public Release 0.5m1 : February 18, 2007
+
+
 - Handling ``with`` statements : February 15, 2007
 
 
 - Fixing removing imports that eat the blank lines : February 8, 2007
 
 
-- Removing extra spaces and lines; ``C-F`` : February 7, 2007
+- Removing extra spaces and lines; ``C-c C-f`` : February 7, 2007
 
 
 > Public Release 0.4 : February 4, 2007
 
 - Highlighting keywords : March 21, 2006
   Only python files(``*.py``) should be highlighted.
-

docs/dev/issues.txt

 Or maybe we can use a strategy object for searching.
 
 
+Reducing `PyName.get_object()` Calls
+====================================
+
+For finding occurrences of a `PyName` we use `FilteredOccurrenceFinder`.
+For deciding whether two `PyName`\s are the same or not it it compares
+`PyName.get_object()`\s and this methods performs type inference.  We
+can probably remove such calls most of the time.  But more testing is
+required to decide about that.  So this will be delayed till ``0.5m2``.
+
+The only place that comparing objects seem needed is when we are
+comparing `ImportedModule`\s and `ImportedName`\s.  Maybe we can
+eliminate the need for comparing imported names by addin a new
+`get_imported_pyname` to them.  But it seems to cause problems when
+we are importing an already imported name.
+
+
 Allowing Non-Existent Resources
 ===============================
 

docs/dev/stories.txt

 * Extracting methods from pieces with only one return/yield statement
 
 
-* Moving field/method
-
-
 * Inlining a single occurrence
 
 
 * Renaming textual matches
 
 
+* Analyzing function decorators
+
+
 * Performing import action only on one import statement
 
 
-* Analyzing function decorators
+> Public Release 0.5m2 : March 4, 2007
 
 
-> Public Release 0.5m1 : February 18, 2007
+* Moving methods
+
+
+* Sorting names in from import list
+
+
+* Extract class

docs/dev/workingon.txt

 Small Stories
 =============
 
-- Handling with statements
+- Reducing the number of times `PyName.get_object()` gets called in
+  `FilteredOccurrenceFinder`.
+- Extracting ``long_description`` in ``setup.py`` from ``README.txt``
+- Refactor `importutils` package
 
-  - With variable
-  - handling with variable type
-  - Duplication between `_ForAssignVisitor` and `_WithAssignVisitor`
-    and `AssignVisitor`
-  - Duplication between `ForName` and `WithName`
+  - Rename long methods
+  - Rename action names(ui, importutils, dot_rope.py, overview)
 
-- Mixed assignment; ``self.a, b = (1, 2)``
-- Mixed assignment; ``a[0], b = (1, 2)``
-- Mixed assignment; ``a[0:1], b = (1, 2)``
-- Assigning nested tuples; ``a, (b, c) = (1, (2, 3))``
-
+* Separate change from query in `importutils`
+* Can't we use inline methon for move method?
 * Using tuples instead of _Assigned
 * Checking the vars and function parameters in the defining scope::
 
 
 * Moving `ObjectInfer.infer_assign_object()` and `evaluate_object()`
 * Reporting multiple definition problems
-* Extracting ``long_description`` in ``setup.py`` from ``README.txt``
-* Sorting names in from import list
-
-
-For ``0.5m1``
-=============
-
-* Document the new name of refactoring classes
-* Include changes in ``setup.py`` for cheeseshop
 
 
 Remaining Small Stories

docs/user/overview.txt

 close project               C-x p k
 show project tree           C-x p t        M-Q r
 validate project files      C-x p v        F5
---------------------------  -------------  -------------  
+--------------------------  -------------  -------------
 new module                  C-x n m
 new package                 C-x n p
 new file                    C-x n f
 exit                        C-x C-c        C-W
 run active editor           C-c x p        M-X p
 run unit-tests              C-c x t        M-X t
---------------------------  -------------  -------------  
+--------------------------  -------------  -------------
 forward character           C-f
 backward character          C-b
 next line                   C-n
 organize imports            C-c i o        C-O
 expand star imports         C-c i x
 relatives to absolutes      C-c i a
-froms to normals            C-c i n
+froms to imports            C-c i i
 handle long imports         C-c i l
 --------------------------  -------------  -------------
 about                       C-h a

rope/base/codeanalyze.py

                     dot_count += 1
                 else:
                     break
-        return rope.base.pynames.ImportedModule(self.module_scope.pyobject,
-                                           module_name[dot_count:], dot_count)
+        return rope.base.pynames.ImportedModule(
+            self.module_scope.pyobject, module_name[dot_count:], dot_count)
 
     def get_pyname_in_scope(self, holding_scope, name):
         #ast = compiler.parse(name)

rope/base/oi/objectinfer.py

             if lineno is None and hasattr(assign_node, 'lineno') and \
                assign_node.lineno is not None:
                 lineno = assign_node.lineno
+            if lineno is None:
+                lineno = 1
             holding_scope = pymodule.get_scope().get_inner_scope_for_line(lineno)
             pyname = evaluate.get_statement_result(holding_scope, assign_node)
             if pyname is not None:

rope/refactor/__init__.py

     def _transform_relatives_to_absolute(self, resource):
         pymodule = self.pycore.resource_to_pyobject(resource)
         import_tools = rope.refactor.importutils.ImportTools(self.pycore)
-        return import_tools.transform_relative_imports_to_absolute(pymodule)
+        return import_tools.relatives_to_absolutes(pymodule)
 
 
 class ImportOrganizer(object):
 
     def _perform_command_on_module_with_imports(self, resource, method):
         pymodule = self.pycore.resource_to_pyobject(resource)
-        module_with_imports = self.import_tools.get_module_with_imports(pymodule)
+        module_with_imports = self.import_tools.get_module_imports(pymodule)
         method(module_with_imports)
         result = module_with_imports.get_changed_source()
         return result
             changes.add_change(ChangeContents(resource, source))
             return changes
 
-    def transform_froms_to_imports(self, resource):
+    def froms_to_imports(self, resource):
         return self._perform_command_on_import_tools(
-            self.import_tools.transform_froms_to_normal_imports, resource)
+            self.import_tools.froms_to_imports, resource)
 
-    def transform_relatives_to_absolute(self, resource):
+    def relatives_to_absolutes(self, resource):
         return self._perform_command_on_import_tools(
-            self.import_tools.transform_relative_imports_to_absolute, resource)
+            self.import_tools.relatives_to_absolutes, resource)
 
     def handle_long_imports(self, resource):
         return self._perform_command_on_import_tools(

rope/refactor/importutils/__init__.py

         return FromImport(module_name, 0, ((name, None),),
                           module.get_resource().parent, self.pycore)
 
-    def get_module_with_imports(self, module):
+    def get_module_imports(self, module):
         return module_imports.ModuleImports(self.pycore, module)
 
-    def transform_froms_to_normal_imports(self, pymodule):
+    def froms_to_imports(self, pymodule):
         resource = pymodule.get_resource()
         pymodule = self._clean_up_imports(pymodule)
-        module_imports = self.get_module_with_imports(pymodule)
+        module_imports = self.get_module_imports(pymodule)
         for import_stmt in module_imports.get_import_statements():
-            if not self._can_import_be_transformed_to_normal_import(import_stmt.import_info):
+            if not self._can_import_be_transformed_to_normal_import(
+                import_stmt.import_info):
                 continue
             pymodule = self._from_to_normal(pymodule, import_stmt)
 
         # Adding normal imports in place of froms
-        module_imports = self.get_module_with_imports(pymodule)
+        module_imports = self.get_module_imports(pymodule)
         for import_stmt in module_imports.get_import_statements():
             if self._can_import_be_transformed_to_normal_import(import_stmt.import_info):
                 import_stmt.import_info = \
         resource = pymodule.get_resource()
         from_import = import_stmt.import_info
         module_name = from_import.module_name
-        imported_pymodule = self.pycore.get_module(module_name)
         for name, alias in from_import.names_and_aliases:
             imported = name
             if alias is not None:
                 imported = alias
             occurrence_finder = occurrences.FilteredOccurrenceFinder(
-                self.pycore, imported, [imported_pymodule.get_attribute(name)],
+                self.pycore, imported, [pymodule.get_attribute(imported)],
                 imports=False)
-            source = rename.rename_in_module(occurrence_finder, module_name + '.' + name,
-                                             pymodule=pymodule, replace_primary=True)
+            source = rename.rename_in_module(
+                occurrence_finder, module_name + '.' + name,
+                pymodule=pymodule, replace_primary=True)
             if source is not None:
                 pymodule = self.pycore.get_string_module(source, resource)
         return pymodule
 
     def _clean_up_imports(self, pymodule):
         resource = pymodule.get_resource()
-        module_with_imports = self.get_module_with_imports(pymodule)
+        module_with_imports = self.get_module_imports(pymodule)
         module_with_imports.expand_stars()
         source = module_with_imports.get_changed_source()
         if source is not None:
             pymodule = self.pycore.get_string_module(source, resource)
-        source = self.transform_relative_imports_to_absolute(pymodule)
+        source = self.relatives_to_absolutes(pymodule)
         if source is not None:
             pymodule = self.pycore.get_string_module(source, resource)
 
-        module_with_imports = self.get_module_with_imports(pymodule)
+        module_with_imports = self.get_module_imports(pymodule)
         module_with_imports.remove_duplicates()
         module_with_imports.remove_unused_imports()
         source = module_with_imports.get_changed_source()
             pymodule = self.pycore.get_string_module(source, resource)
         return pymodule
 
-    def transform_relative_imports_to_absolute(self, pymodule):
-        module_with_imports = self.get_module_with_imports(pymodule)
+    def relatives_to_absolutes(self, pymodule):
+        module_with_imports = self.get_module_imports(pymodule)
         to_be_absolute_list = module_with_imports.get_relative_to_absolute_list()
-        source = module_with_imports.get_changed_source()
-        if source is not None:
-            pymodule = self.pycore.get_string_module(source, pymodule.get_resource())
         for name, absolute_name in to_be_absolute_list:
             pymodule = self._rename_in_module(pymodule, name, absolute_name)
-        return pymodule.source_code
+        module_with_imports = self.get_module_imports(pymodule)
+        module_with_imports.get_relative_to_absolute_list()
+        source = module_with_imports.get_changed_source()
+        if source is None:
+            source = pymodule.source_code
+        return source
 
     def _can_import_be_transformed_to_normal_import(self, import_info):
         if not isinstance(import_info, FromImport):
         return True
 
     def organize_imports(self, pymodule):
-        module_imports = self.get_module_with_imports(pymodule)
+        module_imports = self.get_module_imports(pymodule)
         module_imports.remove_unused_imports()
         module_imports.remove_duplicates()
-        before_removing_self_import = module_imports.get_changed_source()
-        to_be_fixed, to_be_renamed = module_imports.get_self_import_fix_and_rename_list()
         source = module_imports.get_changed_source()
         if source is not None:
             pymodule = self.pycore.get_string_module(source, pymodule.get_resource())
+        pymodule = self._remove_self_imports(pymodule)
+        return self.sort_imports(pymodule)
+
+    def _remove_self_imports(self, pymodule):
+        module_imports = self.get_module_imports(pymodule)
+        to_be_fixed, to_be_renamed = module_imports.get_self_import_fix_and_rename_list()
         for name in to_be_fixed:
             try:
                 pymodule = self._rename_in_module(pymodule, name, '', till_dot=True)
             except ValueError:
                 # There is a self import with direct access to it
-                return before_removing_self_import
+                return pymodule
         for name, new_name in to_be_renamed:
             pymodule = self._rename_in_module(pymodule, name, new_name)
-        return self.sort_imports(pymodule)
+        module_imports = self.get_module_imports(pymodule)
+        module_imports.get_self_import_fix_and_rename_list()
+        source = module_imports.get_changed_source()
+        if source is not None:
+            pymodule = self.pycore.get_string_module(source, pymodule.get_resource())
+        return pymodule
 
     def _rename_in_module(self, pymodule, name, new_name, till_dot=False):
         old_name = name.split('.')[-1]
         return pymodule
 
     def sort_imports(self, pymodule):
-        module_imports = self.get_module_with_imports(pymodule)
+        module_imports = self.get_module_imports(pymodule)
         module_imports.sort_imports()
         return module_imports.get_changed_source()
 
     def handle_long_imports(self, pymodule, maxdots=2, maxlength=27):
         # adding new from imports
-        module_imports = self.get_module_with_imports(pymodule)
+        module_imports = self.get_module_imports(pymodule)
         to_be_fixed = module_imports.handle_long_imports(maxdots, maxlength)
         # performing the renaming
         pymodule = self.pycore.get_string_module(

rope/refactor/importutils/actions.py

 
 from rope.base import pyobjects, exceptions
 from rope.refactor.importutils import importinfo
-from rope.base import exceptions
 
 
 class ImportInfoVisitor(object):

rope/refactor/introduce_factory.py

             if changed_code is not None:
                 if global_factory:
                     new_pymodule = self.pycore.get_string_module(changed_code, self.resource)
-                    module_with_imports = import_tools.get_module_with_imports(new_pymodule)
+                    module_with_imports = import_tools.get_module_imports(new_pymodule)
                     module_with_imports.add_import(new_import)
                     changed_code = module_with_imports.get_changed_source()
                 changes.add_change(ChangeContents(file_, changed_code))

rope/refactor/introduce_parameter.py

             raise exceptions.RefactoringError(
                 'Introduce parameter should be performed inside functions')
         self.pyfunction = scope.pyobject
+        self.name, self.pyname = self._get_name_and_pyname()
+        if self.pyname is None:
+            raise exceptions.RefactoringError(
+                'Cannot find the definition of <%s>', self.name)
 
     def _get_primary(self):
         word_finder = codeanalyze.WordRangeFinder(self.resource.read())
 
     def _change_function_occurances(self, change_collector, function_start,
                                     function_end, new_name):
-        name, pyname = self._get_name_and_pyname()
-        finder = occurrences.FilteredOccurrenceFinder(self.pycore, name, [pyname])
+        finder = occurrences.FilteredOccurrenceFinder(self.pycore, self.name,
+                                                      [self.pyname])
         for occurrence in finder.find_occurrences(resource=self.resource):
             start, end = occurrence.get_primary_range()
             if function_start <= start < function_end:

rope/refactor/move.py

         pass
 
     def _add_imports_to_module(self, pymodule, new_imports):
-        module_with_imports = self.import_tools.get_module_with_imports(pymodule)
+        module_with_imports = self.import_tools.get_module_imports(pymodule)
         for new_import in new_imports:
             module_with_imports.add_import(new_import)
         return module_with_imports.get_changed_source()
 
     def _remove_old_pyname_imports(self, pymodule):
         old_source = pymodule.source_code
-        module_with_imports = self.import_tools.get_module_with_imports(pymodule)
+        module_with_imports = self.import_tools.get_module_imports(pymodule)
         class CanSelect(object):
             changed = False
             old_name = self.old_name
         pymodule, has_changed = self._remove_old_pyname_imports(pymodule)
         pymodule, has_changed = self._add_imports_to_module2(pymodule, imports)
 
-        module_with_imports = self.import_tools.get_module_with_imports(pymodule)
+        module_with_imports = self.import_tools.get_module_imports(pymodule)
         source = pymodule.source_code
         if module_with_imports.get_import_statements():
             start = pymodule.lines.get_line_end(
         pymodule = self.pycore.get_string_module(moving, self.source)
         pymodule, has_changed = self._add_imports_to_module2(pymodule, new_imports)
 
-        source = self.import_tools.transform_relative_imports_to_absolute(pymodule)
+        source = self.import_tools.relatives_to_absolutes(pymodule)
         if source is not None:
             pymodule = self.pycore.get_string_module(source, self.source)
-        source = self.import_tools.transform_froms_to_normal_imports(pymodule)
+        source = self.import_tools.froms_to_imports(pymodule)
         module_with_imports = self._get_module_with_imports(source, self.source)
         imports = [import_stmt.import_info
                    for import_stmt in module_with_imports.get_import_statements()]
 
     def _get_module_with_imports(self, source_code, resource):
         pymodule = self.pycore.get_string_module(source_code, resource)
-        return self.import_tools.get_module_with_imports(pymodule)
+        return self.import_tools.get_module_imports(pymodule)
 
     def _get_moving_element(self):
         lines = self.pycore.resource_to_pyobject(self.source).lines
 
     def _get_used_imports_by_the_moving_element(self):
         pymodule = self.pycore.resource_to_pyobject(self.source)
-        module_with_imports = self.import_tools.get_module_with_imports(pymodule)
+        module_with_imports = self.import_tools.get_module_imports(pymodule)
         return module_with_imports.get_used_imports(self.old_pyname.get_object())
 
     def _change_other_modules(self, changes):
         if not self.source.is_folder():
             is_changed = False
             pymodule = self.pycore.resource_to_pyobject(self.source)
-            source = self.import_tools.transform_relative_imports_to_absolute(pymodule)
+            source = self.import_tools.relatives_to_absolutes(pymodule)
             if source is not None:
                 pymodule = self.pycore.get_string_module(source, self.source)
                 is_changed = True

rope/refactor/occurrences.py

 import re
 
-import rope.base.codeanalyze
+from rope.base import pynames, codeanalyze
 
 
 class OccurrenceFinder(object):
         return False
 
     def _are_pynames_the_same(self, pyname1, pyname2):
-        return pyname1 == pyname2 or \
-               (pyname1 is not None and pyname2 is not None and
-                pyname1.get_object() == pyname2.get_object() and
-                pyname1.get_definition_location() == pyname2.get_definition_location())
+        if pyname1 is None or pyname2 is None:
+            return False
+        if pyname1 == pyname2:
+            return True
+        if type(pyname1) not in (pynames.ImportedModule, pynames.ImportedName) and \
+           type(pyname2) not in (pynames.ImportedModule, pynames.ImportedName):
+            return False
+        return pyname1.get_object() == pyname2.get_object() and \
+               pyname1.get_definition_location() == pyname2.get_definition_location()
 
 
 class _OccurrenceToolsCreator(object):
         if self._name_finder is None:
             if self.pymodule is None:
                 self.pymodule = self.pycore.resource_to_pyobject(self.resource)
-            self._name_finder = rope.base.codeanalyze.ScopeNameFinder(self.pymodule)
+            self._name_finder = codeanalyze.ScopeNameFinder(self.pymodule)
         return self._name_finder
 
     def get_source_code(self):
 
     def get_word_finder(self):
         if self._word_finder is None:
-            self._word_finder = rope.base.codeanalyze.WordRangeFinder(
+            self._word_finder = codeanalyze.WordRangeFinder(
                 self.get_source_code())
         return self._word_finder
 

rope/ui/dot_rope.py

 #core.set('show_status_bar', False)
 
 
-# If you don't like emacs keybinding, change this to False
+# If you don't like emacs keybindings, change this to False
 i_like_emacs = True
 if not i_like_emacs:
     core.rebind_action('open_project', 'C-P')
     core.rebind_action('move_current_module', None)
     core.rebind_action('organize_imports', 'C-O')
     core.rebind_action('expand_star_imports', None)
-    core.rebind_action('relative_to_absolute', None)
-    core.rebind_action('from_to_import', None)
+    core.rebind_action('relatives_to_absolutes', None)
+    core.rebind_action('froms_to_imports', None)
     core.rebind_action('handle_long_imports', None)
 
     core.rebind_action('readme', None)

rope/ui/refactor.py

 
 
 def transform_froms_to_imports(context):
-    _import_action(context, ImportOrganizer.transform_froms_to_imports)
+    _import_action(context, ImportOrganizer.froms_to_imports)
 
 
 def transform_relatives_to_absolute(context):
-    _import_action(context, ImportOrganizer.transform_relatives_to_absolute)
+    _import_action(context, ImportOrganizer.relatives_to_absolutes)
 
 
 def handle_long_imports(context):
                             ConfirmEditorsAreSaved(change_signature), 'C-c r c',
                             MenuAddress(['Refactor', 'Change Method Signature'], 'c'),
                             ['python']))
+
 actions.append(SimpleAction('introduce_factory',
                             ConfirmEditorsAreSaved(introduce_factory), 'C-c r f',
                             MenuAddress(['Refactor', 'Introduce Factory Method'], 'f', 1),
                             ConfirmEditorsAreSaved(inline_argument_default), None,
                             MenuAddress(['Refactor', 'Inline Argument Default'], 'g', 1),
                             ['python']))
-actions.append(SimpleAction('module_to_package',
-                            ConfirmEditorsAreSaved(transform_module_to_package), 'C-c r 1 p',
-                            MenuAddress(['Refactor', 'Transform Module to Package'], 't', 1),
-                            ['python']))
 actions.append(SimpleAction('rename_current_module',
                             ConfirmEditorsAreSaved(rename_module), 'C-c r 1 r',
                             MenuAddress(['Refactor', 'Rename Current Module'], None, 1),
                             ConfirmEditorsAreSaved(move_module), 'C-c r 1 v',
                             MenuAddress(['Refactor', 'Move Current Module'], None, 1),
                             ['python']))
+actions.append(SimpleAction('module_to_package',
+                            ConfirmEditorsAreSaved(transform_module_to_package), 'C-c r 1 p',
+                            MenuAddress(['Refactor', 'Transform Module to Package'], 't', 1),
+                            ['python']))
+
 actions.append(SimpleAction('organize_imports',
                             ConfirmEditorsAreSaved(organize_imports, all=False), 'C-c i o',
                             MenuAddress(['Refactor', 'Organize Imports'], 'o', 2), ['python']))
                             ConfirmEditorsAreSaved(expand_star_imports, all=False), 'C-c i x',
                             MenuAddress(['Refactor', 'Expand Star Imports'], 'p', 2),
                             ['python']))
-actions.append(SimpleAction('relative_to_absolute',
+actions.append(SimpleAction('relatives_to_absolutes',
                             ConfirmEditorsAreSaved(transform_relatives_to_absolute, all=False), 'C-c i a',
                             MenuAddress(['Refactor', 'Transform Relatives to Absolute'], 'a', 2),
                             ['python']))
-actions.append(SimpleAction('from_to_import',
-                            ConfirmEditorsAreSaved(transform_froms_to_imports, all=False), 'C-c i n',
+actions.append(SimpleAction('froms_to_imports',
+                            ConfirmEditorsAreSaved(transform_froms_to_imports, all=False), 'C-c i i',
                             MenuAddress(['Refactor', 'Transform Froms to Imports'], 'r', 2),
                             ['python']))
 actions.append(SimpleAction('handle_long_imports',

ropetest/refactor/__init__.py

         self._introduce_parameter(offset, 'p1')
         self.assertEquals('var = 1\ndef f(p1=var):\n    b = p1\n', self.mod.read())
 
+    @testutils.assert_raises(RefactoringError)
     def test_unknown_variables(self):
         self.mod.write('def f():\n    b = var + c\n')
         offset = self.mod.read().rindex('var')

ropetest/refactor/importutilstest.py

     def test_get_import_statements(self):
         self.mod.write('import pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals('import pkg1',
                           imports[0].import_info.get_import_statement())
     def test_get_import_statements_with_alias(self):
         self.mod.write('import pkg1.mod1 as mod1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals('import pkg1.mod1 as mod1',
                           imports[0].import_info.get_import_statement())
     def test_get_import_statements_for_froms(self):
         self.mod.write('from pkg1 import mod1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals('from pkg1 import mod1',
                           imports[0].import_info.get_import_statement())
     def test_get_multi_line_import_statements_for_froms(self):
         self.mod.write('from pkg1 \\\n    import mod1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals('from pkg1 import mod1',
                           imports[0].import_info.get_import_statement())
     def test_get_import_statements_for_from_star(self):
         self.mod.write('from pkg1 import *\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals('from pkg1 import *',
                           imports[0].import_info.get_import_statement())
     def test_get_import_statements_for_new_relatives(self):
         self.mod2.write('from .mod3 import *\n')
         pymod = self.pycore.get_module('pkg2.mod2')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals('from .mod3 import *',
                           imports[0].import_info.get_import_statement())
     def test_ignoring_indented_imports(self):
         self.mod.write('if True:\n    import pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals(0, len(imports))
 
     def test_import_get_names(self):
         self.mod.write('import pkg1 as pkg\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals(['pkg'], imports[0].import_info.get_imported_names())
 
         self.mod1.write('def a_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import *\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_import_statements()
         self.assertEquals(['a_func'], imports[0].import_info.get_imported_names())
 
     def test_empty_getting_used_imports(self):
         self.mod.write('')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_used_imports(pymod)
         self.assertEquals(0, len(imports))
 
     def test_empty_getting_used_imports2(self):
         self.mod.write('import pkg\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_used_imports(pymod)
         self.assertEquals(0, len(imports))
 
     def test_simple_getting_used_imports(self):
         self.mod.write('import pkg\nprint pkg\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_used_imports(pymod)
         self.assertEquals(1, len(imports))
         self.assertEquals('import pkg', imports[0].get_import_statement())
     def test_simple_getting_used_imports2(self):
         self.mod.write('import pkg\ndef a_func():\n    print pkg\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_used_imports(pymod)
         self.assertEquals(1, len(imports))
         self.assertEquals('import pkg', imports[0].get_import_statement())
     def test_getting_used_imports_for_nested_scopes(self):
         self.mod.write('import pkg1\nprint pkg1\ndef a_func():\n    pass\nprint pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_used_imports(
             pymod.get_attribute('a_func').get_object())
         self.assertEquals(0, len(imports))
     def test_getting_used_imports_for_nested_scopes2(self):
         self.mod.write('from pkg1 import mod1\ndef a_func():\n    print mod1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         imports = module_with_imports.get_used_imports(
             pymod.get_attribute('a_func').get_object())
         self.assertEquals(1, len(imports))
     def test_empty_removing_unused_imports(self):
         self.mod.write('import pkg1\nprint pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('import pkg1\nprint pkg1\n',
                           module_with_imports.get_changed_source())
     def test_simple_removing_unused_imports(self):
         self.mod.write('import pkg1\n\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('', module_with_imports.get_changed_source())
 
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import a_func, another_func\n\na_func()\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import a_func\n\na_func()\n',
                           module_with_imports.get_changed_source())
     def test_simple_removing_unused_imports_for_from_stars(self):
         self.mod.write('from pkg1.mod1 import *\n\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('', module_with_imports.get_changed_source())
 
         self.mod1.write('def a_func():\n    pass\n')
         self.mod.write('import pkg1.mod1\npkg1.mod1.a_func()')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('import pkg1.mod1\npkg1.mod1.a_func()',
                           module_with_imports.get_changed_source())
     def test_removing_unused_imports_and_functions_of_the_same_name(self):
         self.mod.write('def a_func():\n    pass\ndef a_func():\n    pass\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('def a_func():\n    pass\ndef a_func():\n    pass\n',
                           module_with_imports.get_changed_source())
         self.mod.write('a_var = 1\n')
         self.mod1.write('from mod import a_var as myvar\na_var = myvar\n')
         pymod = self.pycore.resource_to_pyobject(self.mod1)
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from mod import a_var as myvar\na_var = myvar\n',
                           module_with_imports.get_changed_source())
                '    def f(self):\n        a_var = pkg1\n'
         self.mod.write(code)
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals(code, module_with_imports.get_changed_source())
 
     def test_adding_imports(self):
         self.mod.write('\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         new_import = self.import_tools.get_import_for_module(
             self.pycore.resource_to_pyobject(self.mod1))
         module_with_imports.add_import(new_import)
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import a_func\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         new_import = self.import_tools.get_from_import_for_module(
             self.pycore.resource_to_pyobject(self.mod1), 'another_func')
         module_with_imports.add_import(new_import)
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import *\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         new_import = self.import_tools.get_from_import_for_module(
             self.pycore.resource_to_pyobject(self.mod1), 'another_func')
         module_with_imports.add_import(new_import)
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import a_func\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         new_import = self.import_tools.get_from_import_for_module(
             self.pycore.resource_to_pyobject(self.mod1), '*')
         module_with_imports.add_import(new_import)
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import (a_func,\n    another_func)\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         self.assertEquals('from pkg1.mod1 import (a_func,\n    another_func)\n',
                           module_with_imports.get_changed_source())
 
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import (a_func)\na_func()\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import (a_func)\na_func()\n',
                           module_with_imports.get_changed_source())
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import *\nfrom pkg1.mod1 import a_func\na_func()\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import *\na_func()\n',
                           module_with_imports.get_changed_source())
     def test_removing_unused_imports_and_reoccuring_names2(self):
         self.mod.write('import pkg2.mod2\nimport pkg2.mod3\nprint pkg2.mod2, pkg2.mod3')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('import pkg2.mod2\nimport pkg2.mod3\nprint pkg2.mod2, pkg2.mod3',
                           module_with_imports.get_changed_source())
     def test_removing_unused_imports_and_common_packages(self):
         self.mod.write('import pkg1.mod1\nimport pkg1\nprint pkg1, pkg1.mod1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('import pkg1.mod1\nprint pkg1, pkg1.mod1\n',
                           module_with_imports.get_changed_source())
     def test_removing_unused_imports_and_common_packages_reversed(self):
         self.mod.write('import pkg1\nimport pkg1.mod1\nprint pkg1, pkg1.mod1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_duplicates()
         self.assertEquals('import pkg1.mod1\nprint pkg1, pkg1.mod1\n',
                           module_with_imports.get_changed_source())
     def test_removing_unused_imports_and_common_packages2(self):
         self.mod.write('import pkg1.mod1\nimport pkg1.mod2\nprint pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('import pkg1.mod1\nprint pkg1\n',
                           module_with_imports.get_changed_source())
         self.mod1.write('def func1():\n    pass\n')
         self.mod.write('from pkg1.mod1 import func1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('', module_with_imports.get_changed_source())
 
         self.mod1.write('def func1():\n    pass\n')
         self.mod.write('from pkg1.mod1 import func1\nfunc1()')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import func1\nfunc1()',
                           module_with_imports.get_changed_source())
         self.mod1.write('def func1():\n    pass\n')
         self.mod.write('from pkg1.mod1 import func1\ndef a_func():\n    func1()\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import func1\ndef a_func():\n    func1()\n',
                           module_with_imports.get_changed_source())
         self.mod.write('from pkg1.mod1 import func1\nclass A(object):\n'
                        '    def a_func(self):\n        func1()\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import func1\nclass A(object):\n'
                           '    def a_func(self):\n        func1()\n',
         self.mod1.write('class A(object):\n    def f(self):\n        pass\n')
         self.mod.write('from pkg1.mod1 import A\nvar = A().f()')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('from pkg1.mod1 import A\nvar = A().f()',
                           module_with_imports.get_changed_source())
         self.mod1.write('def func1():\n    pass\n')
         self.mod.write('import pkg1\ndef a_func(pkg1):\n    my_var = pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('def a_func(pkg1):\n    my_var = pkg1\n',
                           module_with_imports.get_changed_source())
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import *\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.expand_stars()
         self.assertEquals('', module_with_imports.get_changed_source())
 
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import *\na_func()\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.expand_stars()
         self.assertEquals('from pkg1.mod1 import a_func\na_func()\n',
                           module_with_imports.get_changed_source())
     def test_removing_duplicate_imports(self):
         self.mod.write('import pkg1\nimport pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_duplicates()
         self.assertEquals('import pkg1\n',
                           module_with_imports.get_changed_source())
     def test_removing_duplicates_and_reoccuring_names(self):
         self.mod.write('import pkg2.mod2\nimport pkg2.mod3\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_duplicates()
         self.assertEquals('import pkg2.mod2\nimport pkg2.mod3\n',
                           module_with_imports.get_changed_source())
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1 import a_func\nfrom pkg1 import a_func, another_func\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_duplicates()
         self.assertEquals('from pkg1 import a_func, another_func\n',
                           module_with_imports.get_changed_source())
         self.mod1.write('def a_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import a_func\nprint a_func\n')
         pymod = self.pycore.get_module('mod')
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg1.mod1\nprint pkg1.mod1.a_func\n', changed_module)
 
     def test_transforming_froms_to_normal_changing_occurances(self):
         self.mod1.write('def a_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import a_func\na_func()')
         pymod = self.pycore.get_module('mod')
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg1.mod1\npkg1.mod1.a_func()', changed_module)
 
     def test_transforming_froms_to_normal_for_multi_imports(self):
         self.mod1.write('def a_func():\n    pass\ndef another_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import *\na_func()\nanother_func()\n')
         pymod = self.pycore.get_module('mod')
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg1.mod1\npkg1.mod1.a_func()\npkg1.mod1.another_func()\n',
                           changed_module)
 
         self.mod.write('from pkg1.mod1 import (a_func, \n    another_func)' \
                        '\na_func()\nanother_func()\n')
         pymod = self.pycore.get_module('mod')
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg1.mod1\npkg1.mod1.a_func()\npkg1.mod1.another_func()\n',
                           changed_module)
 
         self.mod.write('import pkg1.mod1\nfrom pkg1.mod1 import a_var\n' \
                        'def a_func():\n    print pkg1.mod1, a_var\n')
         pymod = self.pycore.get_module('mod')
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg1.mod1\n' \
                           'def a_func():\n    print pkg1.mod1, pkg1.mod1.a_var\n',
                           changed_module)
         self.mod1.write('def a_func():\n    pass\n')
         self.mod.write('from pkg1.mod1 import a_func as another_func\nanother_func()\n')
         pymod = self.pycore.get_module('mod')
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg1.mod1\npkg1.mod1.a_func()\n', changed_module)
 
     def test_transforming_froms_to_normal_for_relatives(self):
         self.mod2.write('def a_func():\n    pass\n')
         self.mod3.write('from mod2 import *\na_func()\n')
         pymod = self.pycore.resource_to_pyobject(self.mod3)
-        changed_module = self.import_tools.transform_froms_to_normal_imports(pymod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
         self.assertEquals('import pkg2.mod2\npkg2.mod2.a_func()\n', changed_module)
 
+    def test_transforming_froms_to_normal_for_os_path(self):
+        self.mod.write('from os import path\npath.exists(\'.\')\n')
+        pymod = self.pycore.resource_to_pyobject(self.mod)
+        changed_module = self.import_tools.froms_to_imports(pymod)
+        self.assertEquals('import os\nos.path.exists(\'.\')\n', changed_module)
+
     def test_transform_relatives_imports_to_absolute_imports_doing_nothing(self):
         self.mod2.write('from pkg1 import mod1\nimport mod1\n')
         pymod = self.pycore.resource_to_pyobject(self.mod2)
         self.assertEquals('from pkg1 import mod1\nimport mod1\n',
-                          self.import_tools.transform_relative_imports_to_absolute(pymod))
+                          self.import_tools.relatives_to_absolutes(pymod))
 
     def test_transform_relatives_imports_to_absolute_imports_for_normal_imports(self):
         self.mod2.write('import mod3\n')
         pymod = self.pycore.resource_to_pyobject(self.mod2)
         self.assertEquals('import pkg2.mod3\n',
-                          self.import_tools.transform_relative_imports_to_absolute(pymod))
+                          self.import_tools.relatives_to_absolutes(pymod))
 
     def test_transform_relatives_imports_to_absolute_imports_for_froms(self):
         self.mod3.write('def a_func():\n    pass\n')
         self.mod2.write('from mod3 import a_func\n')
         pymod = self.pycore.resource_to_pyobject(self.mod2)
         self.assertEquals('from pkg2.mod3 import a_func\n',
-                          self.import_tools.transform_relative_imports_to_absolute(pymod))
+                          self.import_tools.relatives_to_absolutes(pymod))
 
     @testutils.run_only_for_25
     def test_transform_relatives_imports_to_absolute_imports_for_new_relatives(self):
         self.mod2.write('from .mod3 import a_func\n')
         pymod = self.pycore.resource_to_pyobject(self.mod2)
         self.assertEquals('from pkg2.mod3 import a_func\n',
-                          self.import_tools.transform_relative_imports_to_absolute(pymod))
+                          self.import_tools.relatives_to_absolutes(pymod))
 
     def test_transform_relatives_imports_to_absolute_imports_for_normal_imports2(self):
         self.mod2.write('import mod3\nprint mod3')
         pymod = self.pycore.resource_to_pyobject(self.mod2)
         self.assertEquals('import pkg2.mod3\nprint pkg2.mod3',
-                          self.import_tools.transform_relative_imports_to_absolute(pymod))
+                          self.import_tools.relatives_to_absolutes(pymod))
 
     def test_transform_relatives_imports_to_absolute_imports_for_aliases(self):
         self.mod2.write('import mod3 as mod3\nprint mod3')
         pymod = self.pycore.resource_to_pyobject(self.mod2)
         self.assertEquals('import pkg2.mod3 as mod3\nprint mod3',
-                          self.import_tools.transform_relative_imports_to_absolute(pymod))
+                          self.import_tools.relatives_to_absolutes(pymod))
 
     def test_organizing_imports(self):
         self.mod1.write('import mod1\n')
     def test_removing_self_imports_with_no_dot_after_mod(self):
         self.mod.write('import mod\nprint mod\n')
         pymod = self.pycore.resource_to_pyobject(self.mod)
-        self.assertEquals('import mod\nprint mod\n',
+        self.assertEquals('import mod\n\n\nprint mod\n',
                           self.import_tools.organize_imports(pymod))
 
     def test_removing_self_imports_with_no_dot_after_mod2(self):
     def test_empty_removing_unused_imports_and_eating_blank_lines(self):
         self.mod.write('import pkg1\nimport pkg2\n\n\nprint pkg1\n')
         pymod = self.pycore.get_module('mod')
-        module_with_imports = self.import_tools.get_module_with_imports(pymod)
+        module_with_imports = self.import_tools.get_module_imports(pymod)
         module_with_imports.remove_unused_imports()
         self.assertEquals('import pkg1\n\n\nprint pkg1\n',
                           module_with_imports.get_changed_source())
     'Topic :: Software Development',
     'Topic :: Text Editors :: Integrated Development Environments (IDE)']
 
-long_description = """
-Rope is a python refactoring IDE and library.  The IDE uses the
-library for providing features like refactoring, code assist, and
-auto-completion.  The IDE uses `Tkinter` library.
-"""
+def get_long_description():
+    lines = open('README.txt').read().splitlines(False)
+    end = lines.index('Getting Started')
+    return '\n' + '\n'.join(lines[1:end]) + '\n'
 
 setup(name='rope',
       version=rope.VERSION,
       description='a python refactoring IDE and library...',
-      long_description=long_description,
+      long_description=get_long_description(),
       author='Ali Gholami Rudi',
       author_email='aligrudi@users.sourceforge.net',
       url='http://rope.sf.net/',