Commits

Anonymous committed cf78207

pyobjects: added PyObject.__iter__()

Comments (0)

Files changed (4)

rope/base/pyobjects.py

         else:
             return super(PyObject, self).__hash__()
 
+    def __iter__(self):
+        """The same as ``iter(self.get_attributes())``"""
+        return iter(self.get_attributes())
+
     _types = None
     _unknown = None
 

rope/base/pyobjectsdef.py

     def get_names(self):
         result = {}
         imported = self.imported_module.get_object()
-        for name in imported.get_attributes():
+        for name in imported:
             if not name.startswith('_'):
                 result[name] = pynames.ImportedName(self.imported_module, name)
         return result

rope/contrib/codeassist.py

             return {}
         pymodule = self._find_module(pymodule, module_name)
         result = {}
-        for name, pyname in pymodule.get_attributes().items():
+        for name in pymodule:
             if name.startswith(self.starting):
                 result[name] = CompletionProposal(name, kind='global',
                                                   type='imported')

rope/refactor/importutils/importinfo.py

     def get_imported_primaries(self, context):
         if self.names_and_aliases[0][0] == '*':
             module = self.get_imported_module(context)
-            return [name for name in module.get_attributes()
+            return [name for name in module
                     if not name.startswith('_')]
         result = []
         for name, alias in self.names_and_aliases: