MCPcopy Index your code
hub / github.com/python/cpython / listmodules

Method listmodules

Lib/pydoc.py:2180–2206  ·  view source on GitHub ↗
(self, key='')

Source from the content-addressed store, hash-verified

2178 self.showtopic(topic, xrefs)
2179
2180 def listmodules(self, key=''):
2181 if key:
2182 self.output.write('''
2183Here is a list of modules whose name or summary contains '{}'.
2184If there are any, enter a module name to get more help.
2185
2186'''.format(key))
2187 apropos(key)
2188 else:
2189 self.output.write('''
2190Please wait a moment while I gather a list of all available modules...
2191
2192''')
2193 modules = {}
2194 def callback(path, modname, desc, modules=modules):
2195 if modname and modname[-9:] == '.__init__':
2196 modname = modname[:-9] + ' (package)'
2197 if modname.find('.') < 0:
2198 modules[modname] = 1
2199 def onerror(modname):
2200 callback(None, modname, None)
2201 ModuleScanner().run(callback, onerror=onerror)
2202 self.list(modules.keys())
2203 self.output.write(''&#x27;
2204Enter any module name to get more help. Or, type "modules spam" to search
2205for modules whose name or summary contain the string "spam".
2206''&#x27;)
2207
2208help = Helper()
2209

Callers 1

helpMethod · 0.95

Calls 7

listMethod · 0.95
aproposFunction · 0.85
ModuleScannerClass · 0.85
writeMethod · 0.45
formatMethod · 0.45
runMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected