MCPcopy Index your code
hub / github.com/RustPython/RustPython / html_search

Function html_search

Lib/pydoc.py:2566–2594  ·  view source on GitHub ↗

Search results page.

(key)

Source from the content-addressed store, hash-verified

2564 return 'Index of Modules', ''.join(contents)
2565
2566 def html_search(key):
2567 """Search results page."""
2568 # scan for modules
2569 search_result = []
2570
2571 def callback(path, modname, desc):
2572 if modname[-9:] == '.__init__':
2573 modname = modname[:-9] + ' (package)'
2574 search_result.append((modname, desc and '- ' + desc))
2575
2576 with warnings.catch_warnings():
2577 warnings.filterwarnings('ignore') # ignore problems during import
2578 def onerror(modname):
2579 pass
2580 ModuleScanner().run(callback, key, onerror=onerror)
2581
2582 # format page
2583 def bltinlink(name):
2584 return '<a href="%s.html">%s</a>' % (name, name)
2585
2586 results = []
2587 heading = html.heading(
2588 '<strong class="title">Search Results</strong>',
2589 )
2590 for name, desc in search_result:
2591 results.append(bltinlink(name) + desc)
2592 contents = heading + html.bigsection(
2593 'key = %s' % key, 'index', '<br>'.join(results))
2594 return 'Search Results', contents
2595
2596 def html_topics():
2597 """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