MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / html_search

Function html_search

tools/python-3.11.9-amd64/Lib/pydoc.py:2614–2642  ·  view source on GitHub ↗

Search results page.

(key)

Source from the content-addressed store, hash-verified

2612 return 'Index of Modules', ''.join(contents)
2613
2614 def html_search(key):
2615 """Search results page."""
2616 # scan for modules
2617 search_result = []
2618
2619 def callback(path, modname, desc):
2620 if modname[-9:] == '.__init__':
2621 modname = modname[:-9] + ' (package)'
2622 search_result.append((modname, desc and '- ' + desc))
2623
2624 with warnings.catch_warnings():
2625 warnings.filterwarnings('ignore') # ignore problems during import
2626 def onerror(modname):
2627 pass
2628 ModuleScanner().run(callback, key, onerror=onerror)
2629
2630 # format page
2631 def bltinlink(name):
2632 return '<a href="%s.html">%s</a>' % (name, name)
2633
2634 results = []
2635 heading = html.heading(
2636 '<strong class="title">Search Results</strong>',
2637 )
2638 for name, desc in search_result:
2639 results.append(bltinlink(name) + desc)
2640 contents = heading + html.bigsection(
2641 'key = %s' % key, 'index', '<br>'.join(results))
2642 return 'Search Results', contents
2643
2644 def html_topics():
2645 """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