1. zjes
  2. rope_py3k

Commits

Ali Gholami Rudi  committed c2a8949

Fixing extract when there is no newline at the end of the buffer

  • Participants
  • Parent commits 53ad192
  • Branches trunk

Comments (0)

Files changed (7)

File README.txt

View file
  • Ignore whitespace
 auto-completion.  It is written in python.  The IDE uses `Tkinter`
 library.
 
-Rope IDE and library are released in two separate packages. *rope*
+Rope IDE and library are released in two separate packages.  *rope*
 package contains only the library and *ropeide* package contains the
 IDE and the library.
 
 New Features
 ============
 
-* Separating rope library from rope IDE
-* Adding tools for making using rope library easier
-* Restructuring checks for builtin objects using `__builtin__` module
-  name
-
-From now on ``rope`` package will contain only the library and
-``ropeide`` package will contain both the library and the IDE.
-
-Rope library has been made easier to use; see `docs/dev/library.txt`_
-for more information.
+*
 
 
 Getting Started

File docs/dev/issues.txt

View file
  • Ignore whitespace
 Releasing Library Package
 =========================
 
-As it is written in ``README.txt`` file the initial goal of rope was
-to release a library if it achieved its goals:
-
-  The type inference and refactoring parts will not be dependent on
-  *rope* IDE and if successful, will be released as standalone
-  programs and libraries so that other projects may use them.
-
-I think it is now the time.
-
-* A new ``setup.py`` for making and registering library package
-* The library package will contain `rope`, `rope.base`, and
-  `rope.refactor` packages
-* The name of packages: using ``rope`` for the library and
-  ``ropeide`` for the IDE
-
 Issues:
 
 * Two separate ``README.txt`` files?
 * Should the IDE contain the library?
 * Separating common, library, and IDE documents
 
+New document tree:
+
+  docs/
+    dev/
+      workingon.txt
+      issues.txt
+      done.txt
+      stories.txt
+    library.txt
+    overview.txt
+    tutorial.txt
+    contributing.txt
+    done.txt
+  README.txt
+  COPYING
+
+Library Docs:
+
+  * README.txt
+  * tutorial.txt
+  * overview.txt
+  * done.txt
+  * library.txt
+  * contributing.txt
+
+IDE Docs:
+
+  * README.txt
+  * done.txt
+  * library.txt
+  * contributing.txt
+
 
 Memory Management
 =================

File docs/dev/library.txt

View file
  • Ignore whitespace
 What Are These `Resource`\s?
 ----------------------------
 
-In rope files and folders in a project are accessed through
+In rope, files and folders in a project are accessed through
 `rope.base.resources.Resource` objects.  It has two subclasses `File`
 and `Folder`.  What we care about is that refactorings and `Change`\s
 (we'll talk about them later) use resources.
 
 But since rope is not notified about the changes the IDE performs, you
 should tell rope about the change.  You can do so by using
-`rope.base.libutils.report_change()`.  That is whenever you want to
+`rope.base.libutils.report_change()`.  That is, whenever you want to
 change a module you can do something like::
 
   old_contents = read(path)

File docs/dev/workingon.txt

View file
  • Ignore whitespace
 Small Stories
 =============
 
+* Not including dev docs on distribution packages
+
+* Removing input and output streams from `PyCore.run_module()`
 * Moving `PyCore.create_module()` and `PyCore.create_package()`? Where
   to? `libutils` maybe?
 * Using `svn` instead of `pysvn`

File rope/__init__.py

View file
  • Ignore whitespace
 """rope, a python refactoring library"""
 
 INFO = __doc__
-VERSION = '0.6m4'
+VERSION = '0.6m5'
 COPYRIGHT = """\
 Copyright (C) 2006-2007 Ali Gholami Rudi
 

File rope/refactor/extract.py

View file
  • Ignore whitespace
 
     def _is_on_a_word(self, info, offset):
         prev = info.source[offset]
+        if not (prev.isalnum() or prev == '_') or \
+           offset + 1 == len(info.source):
+            return False
         next = info.source[offset + 1]
-        return (prev.isalnum() or prev == '_') and (next.isalnum() or next == '_')
+        return next.isalnum() or next == '_'
 
 
 class _ExtractMethodParts(object):

File ropetest/refactor/extracttest.py

View file
  • Ignore whitespace
                    '    def one(self):\n        return 1\n'
         self.assertEquals(expected, refactored)
 
+    def test_extract_variable_with_no_new_lines_at_the_end(self):
+        code = 'a_var = 10'
+        start = code.index('10')
+        end = start + 2
+        refactored = self.do_extract_variable(code, start, end, 'new_var')
+        expected = 'new_var = 10\na_var = new_var'
+        self.assertEquals(expected, refactored)
+
 
 if __name__ == '__main__':
     unittest.main()