Arun Mahapatra avatar Arun Mahapatra committed 7984075

2to3-fy source.

Comments (0)

Files changed (4)

ropemode/decorators.py

 
     def _show(self, message):
         if message is None:
-            print message
+            print(message)
         else:
             self.message(message)
 
     def newfunc(*args, **kwds):
         try:
             func(*args, **kwds)
-        except Exception, e:
+        except Exception as e:
             trace = str(traceback.format_exc())
             short = 'Ignored an exception in ropemode hook: %s' % \
                     _exception_message(e)
     def newfunc(*args, **kwds):
         try:
             return func(*args, **kwds)
-        except exceptions.RopeError, e:
+        except exceptions.RopeError as e:
             short = None
             if isinstance(e, input_exceptions):
                 short = _exception_message(e)

ropemode/dialog.py

 def show_dialog(askdata, actions, confs={}, optionals={}, initial_asking=True):
     result = {}
     if initial_asking:
-        for name, conf in confs.items():
+        for name, conf in list(confs.items()):
             result[name] = askdata(conf)
     actions.append('batchset')
     names = list(actions)
-    names.extend(optionals.keys())
-    names.extend(confs.keys())
+    names.extend(list(optionals.keys()))
+    names.extend(list(confs.keys()))
     base_question = Data('Choose what to do: ',
                          default=actions[0], values=names)
     batchset_question = Data('Batch sets: ')
             response = base_question.default
         elif response == 'batchset':
             sets = askdata(batchset_question)
-            for key, value in _parse_batchset(sets).items():
+            for key, value in list(_parse_batchset(sets).items()):
                 if key.endswith(':'):
                     key = key[:-1]
                 if key in names:

ropemode/filter.py

         except exceptions.ResourceNotFoundError:
             continue
         if resource.is_folder():
-            matches = set(filter(lambda item: resource.contains(item), all))
+            matches = set([item for item in all if resource.contains(item)])
         else:
             matches = set([resource])
         if first == '+':

ropemode/interface.py

 from rope.contrib import codeassist, generate, autoimport, findit
 
 from ropemode import refactor, decorators, dialog
+import collections
 
 
 class RopeMode(object):
     def _init_mode(self):
         for attrname in dir(self):
             attr = getattr(self, attrname)
-            if not callable(attr):
+            if not isinstance(attr, collections.Callable):
                 continue
             kind = getattr(attr, 'kind', None)
             if kind == 'local':
         if modules:
             for i in range(len(modules)):
                 modname = modules[i]
-                if not isinstance(modname, basestring):
+                if not isinstance(modname, str):
                     modname = modname.value()
                 modnames.append(modname)
         else:
         if len(result) == 1:
             resource = list(result.keys())[0]
         else:
-            resource = self._ask_file(result.keys())
+            resource = self._ask_file(list(result.keys()))
         if resource:
             self._goto_location(resource, result[resource])
 
         if isinstance(changes, rope.base.change.MoveResource):
             result[changes.resource] = changes.new_resource
         if undo:
-            return dict([(value, key) for key, value in result.items()])
+            return dict([(value, key) for key, value in list(result.items())])
         return result
 
     def _save_buffers(self, only_current=False):
             self._starting = common_start
             self._offset = self.starting_offset + len(common_start)
         prompt = 'Completion for %s: ' % self.expression
-        proposals = map(self.env._completion_data, proposals)
+        proposals = list(map(self.env._completion_data, proposals))
         result = self.env.ask_completion(prompt, proposals, self.starting)
         if result is not None:
             self._apply_assist(result)
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.