Anonymous avatar Anonymous committed 17e75da

Fixed looking up assigned builtin names in global scopes

Comments (0)

Files changed (10)


 This might include detecting unused variables and imports or
 unreachable statements.  `rope.base` can help, too.  Currently rope
-only detects redefined elements.
+detects things like redefined elements and assignment to self.
 Modules Without Source Code
 Submitting patches
-We're always grateful for patches to Rope's code.  Indeed, bug
-reports with associated patches will get fixed *far* more quickly
-than those without patches.
+Patches to rope's code are welcome.
 Patch style
 Always use the latest version of files from rope Subversion repository
-* Submit patches in the format returned by the ``svn diff`` command.
 * Follow :PEP:`8`.
 * Use four spaces for indentation.
 * Include good unit-tests if possible.


 * Better `WordRangeFinder`
-Sorting Scope Elements
-Where should we put scope statements that are outside other
-* Keep them on their own place; Might cause problems
-* Put them at the end of scope; What to do for imports
-* Put them at the start of scope; Might cause problems
-* Hang them to the upper scope; Problems like imports
-* Hang them to the lower scope; Problems like __main__ checks
-One way of solving it might be to insert each block after all of the
-blocks that appear before it.  This solves the problem for imports and
-__main__ checks.
-What to do with blanks?
-* Each scope should own the blanks after it
-* Each scope should own the blanks before it
-* Leave the blanks in their own places
-* Use a predefined number of blanks; 1 or 2?
-* Each scopes should own the blanks after it except the last one
-Specifying The Scope To Sort
-* The scope current offset is in
-* The scope of the PyName in current offset
-Specifying The New Order
-It is only the manual ordering that requires specifying the new order.
-We can specify the new order the same way we do that for change method
-signature.  The IDE can do better by using scope name and kind.
-Sort Kinds
-* Alphabetically
-* Classes first
-* Functions first
-* Not-underlined first/last
-* With-pydocs first/last
-* Longest first/last
-* Manual
-* Specials first/last
 Insert Before In Restructurings


 > Public Release 0.7m1 : August 19, 2007
-* Sorting methods


-Sorting Scopes
-- Handling blanks after scopes
-- Handling blanks for the final scope
-- Moving statements
-* Sorting 
-  - Alpha
-  - Class
-  - Function
-  - Underlined
-  - Specials
-  - Pydocs
-  * Length
-  * Manual
-* Adding sorttest to testsuit
-* Adding a dialog
+Small Stories
 * Adding an option to inline not to remove the definition
 * Renaming ```` to ```` and ``~/.rope`` to
+- Sorting scopes : August 9, 2007
 > Public Release 0.6 : August 5, 2007


     def get_names(self):
         if self.names.get() is None:
-            result = dict(super(GlobalScope, self).get_names())
-            result.update(self.builtin_names)
+            result = dict(self.builtin_names)
+            result.update(super(GlobalScope, self).get_names())
         return self.names.get()
     def __call__(self, scope1, scope2):
         return self.coef * cmp(scope1.kind, scope2.kind)
-    kind = 'type'
+    kind = 'kind'
 class UnderlinedSorter(_Sorter):


 import ropetest.ide.outlinetest
 import ropetest.ide.spellcheckertest
 import ropetest.ide.movementstest
+import ropetest.ide.sorttest
 def suite():
+    result.addTests(unittest.makeSuite(ropetest.ide.sorttest.SortScopesTest))
     return result


 import unittest
 from rope.ide import sort
 from ropetest import testutils


         f2_scope = scope.get_scopes()[1]
         self.assertNotEquals(f1_scope, f2_scope)
+    def test_assigning_builtin_names(self):
+        mod = self.pycore.get_string_module('range = 1\n')
+        range = mod.get_scope().lookup('range')
+        self.assertEquals((mod, 1), range.get_definition_location())
 def suite():
     result = unittest.TestSuite()
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
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.