MCPcopy Create free account
hub / github.com/twisted/twisted / iterAttributes

Method iterAttributes

src/twisted/python/modules.py:347–366  ·  view source on GitHub ↗

List all the attributes defined in this module. Note: Future work is planned here to make it possible to list python attributes on a module without loading the module by inspecting ASTs or bytecode, but currently any iteration of PythonModule objects insists

(self)

Source from the content-addressed store, hash-verified

345 return self.pathEntry.pythonPath.moduleDict.get(self.name) is not None
346
347 def iterAttributes(self):
348 """
349 List all the attributes defined in this module.
350
351 Note: Future work is planned here to make it possible to list python
352 attributes on a module without loading the module by inspecting ASTs or
353 bytecode, but currently any iteration of PythonModule objects insists
354 they must be loaded, and will use inspect.getmodule.
355
356 @raise NotImplementedError: if this module is not loaded.
357
358 @return: a generator yielding PythonAttribute instances describing the
359 attributes of this module.
360 """
361 if not self.isLoaded():
362 raise NotImplementedError(
363 "You can't load attributes from non-loaded modules yet."
364 )
365 for name, val in inspect.getmembers(self.load()):
366 yield PythonAttribute(self.name + "." + name, self, True, val)
367
368 def isPackage(self):
369 """

Callers 1

_trialSortAlgorithmMethod · 0.45

Calls 3

isLoadedMethod · 0.95
loadMethod · 0.95
PythonAttributeClass · 0.85

Tested by 1

_trialSortAlgorithmMethod · 0.36