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

Method _gettopic

Lib/pydoc.py:2196–2221  ·  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

2194 self.output.write(doc)
2195
2196 def _gettopic(self, topic, more_xrefs=''):
2197 """Return unbuffered tuple of (topic, xrefs).
2198
2199 If an error occurs here, the exception is caught and displayed by
2200 the url handler.
2201
2202 This function duplicates the showtopic method but returns its
2203 result directly so it can be formatted for display in an html page.
2204 """
2205 try:
2206 import pydoc_data.topics
2207 except ImportError:
2208 return('''
2209Sorry, topic and keyword documentation is not available because the
2210module "pydoc_data.topics" could not be found.
2211''' , '')
2212 target = self.topics.get(topic, self.keywords.get(topic))
2213 if not target:
2214 raise ValueError('could not find topic')
2215 if isinstance(target, str):
2216 return self._gettopic(target, more_xrefs)
2217 label, xrefs = target
2218 doc = pydoc_data.topics.topics[label]
2219 if more_xrefs:
2220 xrefs = (xrefs or '') + ' ' + more_xrefs
2221 return doc, xrefs
2222
2223 def showsymbol(self, symbol):
2224 target = self.symbols[symbol]

Callers 1

html_topicpageFunction · 0.95

Calls 2

isinstanceFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected