Anonymous avatar Anonymous committed 9b7cd50

inline: using task handle in inline variable

Comments (0)

Files changed (1)

rope/refactor/inline.py

                     task_handle=taskhandle.NullTaskHandle()):
         if resources is None:
             resources = self.pycore.get_python_files()
+            if only_current:
+                resources = [self.resource]
         changes = ChangeSet('Inline variable <%s>' % self.name)
-        if self.resource in resources:
-            source = self._change_main_module(remove, only_current)
-            changes.add_change(ChangeContents(self.resource, source))
+        jobset = task_handle.create_jobset('Calculating changes',
+                                           len(resources))
         for resource in resources:
-            if not only_current and self.resource != resource:
+            jobset.started_job(resource.path)
+            if resource == self.resource:
+                source = self._change_main_module(remove, only_current)
+                changes.add_change(ChangeContents(self.resource, source))
+            else:
                 result = self._change_module(resource)
                 if result is not None:
                     result = _add_imports(self.pycore, result,
                                           resource, self.imports)
                     changes.add_change(ChangeContents(resource, result))
+            jobset.finished_job()
         return changes
 
     def _change_main_module(self, remove, only_current):
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 ProjectModifiedEvent.java.
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.