Anonymous avatar Anonymous committed fbbae12

autoimport: added methods for generating autoimport cache

Comments (0)

Files changed (1)


-from rope.base import exceptions, pynames, resourceobserver
+from rope.base import exceptions, pynames, resourceobserver, taskhandle
 from rope.refactor import importutils
             modname = self._module_name(resource)
             if modname in self.names:
                 del self.names[modname]
+    def generate_cache(self, resources=None,
+                       task_handle=taskhandle.NullTaskHandle()):
+        if resources is None:
+            resources = self.project.pycore.get_python_files()
+        job_set = task_handle.create_jobset(
+            'Generatig autoimport cache', len(resources))
+        for file in resources:
+            job_set.started_job('Working on <%s>' % file.path)
+            self.update_resource(file)
+            job_set.finished_job()
+    def generate_modules_cache(self, modules,
+                               task_handle=taskhandle.NullTaskHandle()):
+        job_set = task_handle.create_jobset(
+            'Generatig autoimport cache for modules', len(modules))
+        for modname in modules:
+            job_set.started_job('Working on <%s>' % modname)
+            self.update_module(modname)
+            job_set.finished_job()
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.