| 2274 | self.showtopic(topic, xrefs) |
| 2275 | |
| 2276 | def listmodules(self, key=''): |
| 2277 | if key: |
| 2278 | self.output.write(''' |
| 2279 | Here is a list of modules whose name or summary contains '{}'. |
| 2280 | If there are any, enter a module name to get more help. |
| 2281 | |
| 2282 | '''.format(key)) |
| 2283 | apropos(key) |
| 2284 | else: |
| 2285 | self.output.write(''' |
| 2286 | Please wait a moment while I gather a list of all available modules... |
| 2287 | |
| 2288 | ''') |
| 2289 | modules = {} |
| 2290 | def callback(path, modname, desc, modules=modules): |
| 2291 | if modname and modname[-9:] == '.__init__': |
| 2292 | modname = modname[:-9] + ' (package)' |
| 2293 | if modname.find('.') < 0: |
| 2294 | modules[modname] = 1 |
| 2295 | def onerror(modname): |
| 2296 | callback(None, modname, None) |
| 2297 | ModuleScanner().run(callback, onerror=onerror) |
| 2298 | self.list(modules.keys()) |
| 2299 | self.output.write(''' |
| 2300 | Enter any module name to get more help. Or, type "modules spam" to search |
| 2301 | for modules whose name or summary contain the string "spam". |
| 2302 | ''') |
| 2303 | |
| 2304 | help = Helper() |
| 2305 | |