1. zjes
  2. rope_py3k

Commits

Ali Gholami Rudi  committed 7808056

Adding rope_info action in ~/.rope

  • Participants
  • Parent commits 7776983
  • Branches trunk

Comments (0)

Files changed (8)

File docs/dev/done.txt

View file
 ===========
 
 
+- Adding checks in restructuring dialog : May 23, 2007
+
+
 - Using `_ast` instead of `compiler` : May 23, 2007
 
 

File docs/dev/stories.txt

View file
 * Better warnings
 
 
-* Restructorings
-
-
 * Enhanced occurrence finding
 
 
 
 
 * Finding similar statements when extracting variable/method
-
-
-* Enhanced restructuring dialog

File docs/dev/workingon.txt

View file
-Enhanced Restructuring Dialog
-=============================
-
-- Having a list of checks for each restructuring
-- Adding `rope.ui.uihelpers.CompletingEntry`
-
-* High memory usage!
-* Updating the parts of overview.txt about restructuring UI
-* Moving pieces from overview.txt to library.txt
-
-
 Goodbye `compiler` Module!
 ==========================
 
 * Handling strings in following lines in `patchedast`
 
+* High memory usage! Write a memory profiler
 * Handle tuple parameters
 * The ability to limit the files to restructure
 * Only scanning selected region for matches

File rope/base/history.py

View file
                 result.append(change)
         return result
 
+    def __str__(self):
+        return 'History holds %s changes in memory' % \
+               (len(self.undo_list) + len(self.redo_list))
+
     undo_list = property(lambda self: self._undo_list)
     redo_list = property(lambda self: self._redo_list)
 

File rope/base/oi/objectdb.py

View file
         for observer in self.observers:
             observer.added(path)
 
+    def __str__(self):
+        scope_count = 0
+        for file_dict in self.files.values():
+            scope_count += len(file_dict)
+        return 'ObjectDB holds %s file and %s scope infos' % \
+               (len(self.files), scope_count)
+
 
 class _NullScopeInfo(object):
 

File rope/base/oi/objectinfo.py

View file
     def sync(self):
         self.objectdb.sync()
 
+    def __str__(self):
+        return str(self.objectdb)
+
 
 class TextualValidation(object):
 

File rope/base/pycore.py

View file
     def get_classes(self, task_handle=taskhandle.NullTaskHandle()):
         return self.classes_cache.get_classes(task_handle)
 
+    def __str__(self):
+        return 'PyCore caches %d PyModules\n' % len(self.module_map) + \
+               str(self.object_info)
+
 
 class _ClassesCache(object):
 

File rope/ui/dot_rope.py

View file
     # created.  Specifying `None` means do not make and use a rope folder.
     #core.set('project_rope_folder', '.ropeproject')
 
+    # You can register your own actions
+    _register_my_actions(core)
 
+
+def _register_my_actions(core):
     # Adding your own `Action`\s:
     # If you're interested in adding your own actions to rope you can do so
     # like this.
     hello_action = SimpleAction('hello_action', say_hello, 'C-h h')
     core.register_action(hello_action)
 
+    def rope_info(context):
+        import gc
+        import rope.base.pyobjects
+
+        print
+        print
+        print 'Rope Running Info'
+        print '================='
+        print
+        print str(context.project.history)
+        module_count = 0
+        for obj in gc.get_objects():
+            # Checking the real type; not isinstance
+            if type(obj) in (rope.base.pyobjects.PyModule,
+                             rope.base.pyobjects.PyPackage):
+                module_count += 1
+        print 'Memory contains %s PyModules' % module_count
+        print str(context.project.pycore)
+    info_action = SimpleAction('rope_info', rope_info, 'C-h i')
+    core.register_action(info_action)
+
 
 def _change_key_binding(core):
     # file actions