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

Method _gettopic

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

Return unbuffered tuple of (topic, xrefs). If an error occurs here, the exception is caught and displayed by the url handler. This function duplicates the showtopic method but returns its result directly so it can be formatted for display in an html page.

(self, topic, more_xrefs='')

Source from the content-addressed store, hash-verified

2242 pager(doc)
2243
2244 def _gettopic(self, topic, more_xrefs=''):
2245 """Return unbuffered tuple of (topic, xrefs).
2246
2247 If an error occurs here, the exception is caught and displayed by
2248 the url handler.
2249
2250 This function duplicates the showtopic method but returns its
2251 result directly so it can be formatted for display in an html page.
2252 """
2253 try:
2254 import pydoc_data.topics
2255 except ImportError:
2256 return('''
2257Sorry, topic and keyword documentation is not available because the
2258module "pydoc_data.topics" could not be found.
2259''' , '')
2260 target = self.topics.get(topic, self.keywords.get(topic))
2261 if not target:
2262 raise ValueError('could not find topic')
2263 if isinstance(target, str):
2264 return self._gettopic(target, more_xrefs)
2265 label, xrefs = target
2266 doc = pydoc_data.topics.topics[label]
2267 if more_xrefs:
2268 xrefs = (xrefs or '') + ' ' + more_xrefs
2269 return doc, xrefs
2270
2271 def showsymbol(self, symbol):
2272 target = self.symbols[symbol]

Callers 1

html_topicpageFunction · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected