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

Function html_search

Lib/pydoc.py:2518–2546  ·  view source on GitHub ↗

Search results page.

(key)

Source from the content-addressed store, hash-verified

2516 return 'Index of Modules', ''.join(contents)
2517
2518 def html_search(key):
2519 """Search results page."""
2520 # scan for modules
2521 search_result = []
2522
2523 def callback(path, modname, desc):
2524 if modname[-9:] == '.__init__':
2525 modname = modname[:-9] + ' (package)'
2526 search_result.append((modname, desc and '- ' + desc))
2527
2528 with warnings.catch_warnings():
2529 warnings.filterwarnings('ignore') # ignore problems during import
2530 def onerror(modname):
2531 pass
2532 ModuleScanner().run(callback, key, onerror=onerror)
2533
2534 # format page
2535 def bltinlink(name):
2536 return '<a href="%s.html">%s</a>' % (name, name)
2537
2538 results = []
2539 heading = html.heading(
2540 '<strong class="title">Search Results</strong>',
2541 )
2542 for name, desc in search_result:
2543 results.append(bltinlink(name) + desc)
2544 contents = heading + html.bigsection(
2545 'key = %s' % key, 'index', '<br>'.join(results))
2546 return 'Search Results', contents
2547
2548 def html_topics():
2549 """Index of topic texts available."""

Callers 1

get_html_pageFunction · 0.85

Calls 7

ModuleScannerClass · 0.85
bltinlinkFunction · 0.85
bigsectionMethod · 0.80
runMethod · 0.45
headingMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…