Anonymous avatar Anonymous committed cf78207

pyobjects: added PyObject.__iter__()

Comments (0)

Files changed (4)


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


     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


             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',


     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:
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.