Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../usr/lib64/python3....
File: pydoc.py
self.output.write('''
[2000] Fix | Delete
Here is a list of the Python keywords. Enter any keyword to get more help.
[2001] Fix | Delete
[2002] Fix | Delete
''')
[2003] Fix | Delete
self.list(self.keywords.keys())
[2004] Fix | Delete
[2005] Fix | Delete
def listsymbols(self):
[2006] Fix | Delete
self.output.write('''
[2007] Fix | Delete
Here is a list of the punctuation symbols which Python assigns special meaning
[2008] Fix | Delete
to. Enter any symbol to get more help.
[2009] Fix | Delete
[2010] Fix | Delete
''')
[2011] Fix | Delete
self.list(self.symbols.keys())
[2012] Fix | Delete
[2013] Fix | Delete
def listtopics(self):
[2014] Fix | Delete
self.output.write('''
[2015] Fix | Delete
Here is a list of available topics. Enter any topic name to get more help.
[2016] Fix | Delete
[2017] Fix | Delete
''')
[2018] Fix | Delete
self.list(self.topics.keys())
[2019] Fix | Delete
[2020] Fix | Delete
def showtopic(self, topic, more_xrefs=''):
[2021] Fix | Delete
try:
[2022] Fix | Delete
import pydoc_data.topics
[2023] Fix | Delete
except ImportError:
[2024] Fix | Delete
self.output.write('''
[2025] Fix | Delete
Sorry, topic and keyword documentation is not available because the
[2026] Fix | Delete
module "pydoc_data.topics" could not be found.
[2027] Fix | Delete
''')
[2028] Fix | Delete
return
[2029] Fix | Delete
target = self.topics.get(topic, self.keywords.get(topic))
[2030] Fix | Delete
if not target:
[2031] Fix | Delete
self.output.write('no documentation found for %s\n' % repr(topic))
[2032] Fix | Delete
return
[2033] Fix | Delete
if type(target) is type(''):
[2034] Fix | Delete
return self.showtopic(target, more_xrefs)
[2035] Fix | Delete
[2036] Fix | Delete
label, xrefs = target
[2037] Fix | Delete
try:
[2038] Fix | Delete
doc = pydoc_data.topics.topics[label]
[2039] Fix | Delete
except KeyError:
[2040] Fix | Delete
self.output.write('no documentation found for %s\n' % repr(topic))
[2041] Fix | Delete
return
[2042] Fix | Delete
doc = doc.strip() + '\n'
[2043] Fix | Delete
if more_xrefs:
[2044] Fix | Delete
xrefs = (xrefs or '') + ' ' + more_xrefs
[2045] Fix | Delete
if xrefs:
[2046] Fix | Delete
import textwrap
[2047] Fix | Delete
text = 'Related help topics: ' + ', '.join(xrefs.split()) + '\n'
[2048] Fix | Delete
wrapped_text = textwrap.wrap(text, 72)
[2049] Fix | Delete
doc += '\n%s\n' % '\n'.join(wrapped_text)
[2050] Fix | Delete
pager(doc)
[2051] Fix | Delete
[2052] Fix | Delete
def _gettopic(self, topic, more_xrefs=''):
[2053] Fix | Delete
"""Return unbuffered tuple of (topic, xrefs).
[2054] Fix | Delete
[2055] Fix | Delete
If an error occurs here, the exception is caught and displayed by
[2056] Fix | Delete
the url handler.
[2057] Fix | Delete
[2058] Fix | Delete
This function duplicates the showtopic method but returns its
[2059] Fix | Delete
result directly so it can be formatted for display in an html page.
[2060] Fix | Delete
"""
[2061] Fix | Delete
try:
[2062] Fix | Delete
import pydoc_data.topics
[2063] Fix | Delete
except ImportError:
[2064] Fix | Delete
return('''
[2065] Fix | Delete
Sorry, topic and keyword documentation is not available because the
[2066] Fix | Delete
module "pydoc_data.topics" could not be found.
[2067] Fix | Delete
''' , '')
[2068] Fix | Delete
target = self.topics.get(topic, self.keywords.get(topic))
[2069] Fix | Delete
if not target:
[2070] Fix | Delete
raise ValueError('could not find topic')
[2071] Fix | Delete
if isinstance(target, str):
[2072] Fix | Delete
return self._gettopic(target, more_xrefs)
[2073] Fix | Delete
label, xrefs = target
[2074] Fix | Delete
doc = pydoc_data.topics.topics[label]
[2075] Fix | Delete
if more_xrefs:
[2076] Fix | Delete
xrefs = (xrefs or '') + ' ' + more_xrefs
[2077] Fix | Delete
return doc, xrefs
[2078] Fix | Delete
[2079] Fix | Delete
def showsymbol(self, symbol):
[2080] Fix | Delete
target = self.symbols[symbol]
[2081] Fix | Delete
topic, _, xrefs = target.partition(' ')
[2082] Fix | Delete
self.showtopic(topic, xrefs)
[2083] Fix | Delete
[2084] Fix | Delete
def listmodules(self, key=''):
[2085] Fix | Delete
if key:
[2086] Fix | Delete
self.output.write('''
[2087] Fix | Delete
Here is a list of modules whose name or summary contains '{}'.
[2088] Fix | Delete
If there are any, enter a module name to get more help.
[2089] Fix | Delete
[2090] Fix | Delete
'''.format(key))
[2091] Fix | Delete
apropos(key)
[2092] Fix | Delete
else:
[2093] Fix | Delete
self.output.write('''
[2094] Fix | Delete
Please wait a moment while I gather a list of all available modules...
[2095] Fix | Delete
[2096] Fix | Delete
''')
[2097] Fix | Delete
modules = {}
[2098] Fix | Delete
def callback(path, modname, desc, modules=modules):
[2099] Fix | Delete
if modname and modname[-9:] == '.__init__':
[2100] Fix | Delete
modname = modname[:-9] + ' (package)'
[2101] Fix | Delete
if modname.find('.') < 0:
[2102] Fix | Delete
modules[modname] = 1
[2103] Fix | Delete
def onerror(modname):
[2104] Fix | Delete
callback(None, modname, None)
[2105] Fix | Delete
ModuleScanner().run(callback, onerror=onerror)
[2106] Fix | Delete
self.list(modules.keys())
[2107] Fix | Delete
self.output.write('''
[2108] Fix | Delete
Enter any module name to get more help. Or, type "modules spam" to search
[2109] Fix | Delete
for modules whose name or summary contain the string "spam".
[2110] Fix | Delete
''')
[2111] Fix | Delete
[2112] Fix | Delete
help = Helper()
[2113] Fix | Delete
[2114] Fix | Delete
class ModuleScanner:
[2115] Fix | Delete
"""An interruptible scanner that searches module synopses."""
[2116] Fix | Delete
[2117] Fix | Delete
def run(self, callback, key=None, completer=None, onerror=None):
[2118] Fix | Delete
if key: key = key.lower()
[2119] Fix | Delete
self.quit = False
[2120] Fix | Delete
seen = {}
[2121] Fix | Delete
[2122] Fix | Delete
for modname in sys.builtin_module_names:
[2123] Fix | Delete
if modname != '__main__':
[2124] Fix | Delete
seen[modname] = 1
[2125] Fix | Delete
if key is None:
[2126] Fix | Delete
callback(None, modname, '')
[2127] Fix | Delete
else:
[2128] Fix | Delete
name = __import__(modname).__doc__ or ''
[2129] Fix | Delete
desc = name.split('\n')[0]
[2130] Fix | Delete
name = modname + ' - ' + desc
[2131] Fix | Delete
if name.lower().find(key) >= 0:
[2132] Fix | Delete
callback(None, modname, desc)
[2133] Fix | Delete
[2134] Fix | Delete
for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
[2135] Fix | Delete
if self.quit:
[2136] Fix | Delete
break
[2137] Fix | Delete
[2138] Fix | Delete
if key is None:
[2139] Fix | Delete
callback(None, modname, '')
[2140] Fix | Delete
else:
[2141] Fix | Delete
try:
[2142] Fix | Delete
spec = pkgutil._get_spec(importer, modname)
[2143] Fix | Delete
except SyntaxError:
[2144] Fix | Delete
# raised by tests for bad coding cookies or BOM
[2145] Fix | Delete
continue
[2146] Fix | Delete
loader = spec.loader
[2147] Fix | Delete
if hasattr(loader, 'get_source'):
[2148] Fix | Delete
try:
[2149] Fix | Delete
source = loader.get_source(modname)
[2150] Fix | Delete
except Exception:
[2151] Fix | Delete
if onerror:
[2152] Fix | Delete
onerror(modname)
[2153] Fix | Delete
continue
[2154] Fix | Delete
desc = source_synopsis(io.StringIO(source)) or ''
[2155] Fix | Delete
if hasattr(loader, 'get_filename'):
[2156] Fix | Delete
path = loader.get_filename(modname)
[2157] Fix | Delete
else:
[2158] Fix | Delete
path = None
[2159] Fix | Delete
else:
[2160] Fix | Delete
try:
[2161] Fix | Delete
module = importlib._bootstrap._load(spec)
[2162] Fix | Delete
except ImportError:
[2163] Fix | Delete
if onerror:
[2164] Fix | Delete
onerror(modname)
[2165] Fix | Delete
continue
[2166] Fix | Delete
desc = module.__doc__.splitlines()[0] if module.__doc__ else ''
[2167] Fix | Delete
path = getattr(module,'__file__',None)
[2168] Fix | Delete
name = modname + ' - ' + desc
[2169] Fix | Delete
if name.lower().find(key) >= 0:
[2170] Fix | Delete
callback(path, modname, desc)
[2171] Fix | Delete
[2172] Fix | Delete
if completer:
[2173] Fix | Delete
completer()
[2174] Fix | Delete
[2175] Fix | Delete
def apropos(key):
[2176] Fix | Delete
"""Print all the one-line module summaries that contain a substring."""
[2177] Fix | Delete
def callback(path, modname, desc):
[2178] Fix | Delete
if modname[-9:] == '.__init__':
[2179] Fix | Delete
modname = modname[:-9] + ' (package)'
[2180] Fix | Delete
print(modname, desc and '- ' + desc)
[2181] Fix | Delete
def onerror(modname):
[2182] Fix | Delete
pass
[2183] Fix | Delete
with warnings.catch_warnings():
[2184] Fix | Delete
warnings.filterwarnings('ignore') # ignore problems during import
[2185] Fix | Delete
ModuleScanner().run(callback, key, onerror=onerror)
[2186] Fix | Delete
[2187] Fix | Delete
# --------------------------------------- enhanced Web browser interface
[2188] Fix | Delete
[2189] Fix | Delete
def _start_server(urlhandler, hostname, port):
[2190] Fix | Delete
"""Start an HTTP server thread on a specific port.
[2191] Fix | Delete
[2192] Fix | Delete
Start an HTML/text server thread, so HTML or text documents can be
[2193] Fix | Delete
browsed dynamically and interactively with a Web browser. Example use:
[2194] Fix | Delete
[2195] Fix | Delete
>>> import time
[2196] Fix | Delete
>>> import pydoc
[2197] Fix | Delete
[2198] Fix | Delete
Define a URL handler. To determine what the client is asking
[2199] Fix | Delete
for, check the URL and content_type.
[2200] Fix | Delete
[2201] Fix | Delete
Then get or generate some text or HTML code and return it.
[2202] Fix | Delete
[2203] Fix | Delete
>>> def my_url_handler(url, content_type):
[2204] Fix | Delete
... text = 'the URL sent was: (%s, %s)' % (url, content_type)
[2205] Fix | Delete
... return text
[2206] Fix | Delete
[2207] Fix | Delete
Start server thread on port 0.
[2208] Fix | Delete
If you use port 0, the server will pick a random port number.
[2209] Fix | Delete
You can then use serverthread.port to get the port number.
[2210] Fix | Delete
[2211] Fix | Delete
>>> port = 0
[2212] Fix | Delete
>>> serverthread = pydoc._start_server(my_url_handler, port)
[2213] Fix | Delete
[2214] Fix | Delete
Check that the server is really started. If it is, open browser
[2215] Fix | Delete
and get first page. Use serverthread.url as the starting page.
[2216] Fix | Delete
[2217] Fix | Delete
>>> if serverthread.serving:
[2218] Fix | Delete
... import webbrowser
[2219] Fix | Delete
[2220] Fix | Delete
The next two lines are commented out so a browser doesn't open if
[2221] Fix | Delete
doctest is run on this module.
[2222] Fix | Delete
[2223] Fix | Delete
#... webbrowser.open(serverthread.url)
[2224] Fix | Delete
#True
[2225] Fix | Delete
[2226] Fix | Delete
Let the server do its thing. We just need to monitor its status.
[2227] Fix | Delete
Use time.sleep so the loop doesn't hog the CPU.
[2228] Fix | Delete
[2229] Fix | Delete
>>> starttime = time.monotonic()
[2230] Fix | Delete
>>> timeout = 1 #seconds
[2231] Fix | Delete
[2232] Fix | Delete
This is a short timeout for testing purposes.
[2233] Fix | Delete
[2234] Fix | Delete
>>> while serverthread.serving:
[2235] Fix | Delete
... time.sleep(.01)
[2236] Fix | Delete
... if serverthread.serving and time.monotonic() - starttime > timeout:
[2237] Fix | Delete
... serverthread.stop()
[2238] Fix | Delete
... break
[2239] Fix | Delete
[2240] Fix | Delete
Print any errors that may have occurred.
[2241] Fix | Delete
[2242] Fix | Delete
>>> print(serverthread.error)
[2243] Fix | Delete
None
[2244] Fix | Delete
"""
[2245] Fix | Delete
import http.server
[2246] Fix | Delete
import email.message
[2247] Fix | Delete
import select
[2248] Fix | Delete
import threading
[2249] Fix | Delete
[2250] Fix | Delete
class DocHandler(http.server.BaseHTTPRequestHandler):
[2251] Fix | Delete
[2252] Fix | Delete
def do_GET(self):
[2253] Fix | Delete
"""Process a request from an HTML browser.
[2254] Fix | Delete
[2255] Fix | Delete
The URL received is in self.path.
[2256] Fix | Delete
Get an HTML page from self.urlhandler and send it.
[2257] Fix | Delete
"""
[2258] Fix | Delete
if self.path.endswith('.css'):
[2259] Fix | Delete
content_type = 'text/css'
[2260] Fix | Delete
else:
[2261] Fix | Delete
content_type = 'text/html'
[2262] Fix | Delete
self.send_response(200)
[2263] Fix | Delete
self.send_header('Content-Type', '%s; charset=UTF-8' % content_type)
[2264] Fix | Delete
self.end_headers()
[2265] Fix | Delete
self.wfile.write(self.urlhandler(
[2266] Fix | Delete
self.path, content_type).encode('utf-8'))
[2267] Fix | Delete
[2268] Fix | Delete
def log_message(self, *args):
[2269] Fix | Delete
# Don't log messages.
[2270] Fix | Delete
pass
[2271] Fix | Delete
[2272] Fix | Delete
class DocServer(http.server.HTTPServer):
[2273] Fix | Delete
[2274] Fix | Delete
def __init__(self, host, port, callback):
[2275] Fix | Delete
self.host = host
[2276] Fix | Delete
self.address = (self.host, port)
[2277] Fix | Delete
self.callback = callback
[2278] Fix | Delete
self.base.__init__(self, self.address, self.handler)
[2279] Fix | Delete
self.quit = False
[2280] Fix | Delete
[2281] Fix | Delete
def serve_until_quit(self):
[2282] Fix | Delete
while not self.quit:
[2283] Fix | Delete
rd, wr, ex = select.select([self.socket.fileno()], [], [], 1)
[2284] Fix | Delete
if rd:
[2285] Fix | Delete
self.handle_request()
[2286] Fix | Delete
self.server_close()
[2287] Fix | Delete
[2288] Fix | Delete
def server_activate(self):
[2289] Fix | Delete
self.base.server_activate(self)
[2290] Fix | Delete
if self.callback:
[2291] Fix | Delete
self.callback(self)
[2292] Fix | Delete
[2293] Fix | Delete
class ServerThread(threading.Thread):
[2294] Fix | Delete
[2295] Fix | Delete
def __init__(self, urlhandler, host, port):
[2296] Fix | Delete
self.urlhandler = urlhandler
[2297] Fix | Delete
self.host = host
[2298] Fix | Delete
self.port = int(port)
[2299] Fix | Delete
threading.Thread.__init__(self)
[2300] Fix | Delete
self.serving = False
[2301] Fix | Delete
self.error = None
[2302] Fix | Delete
[2303] Fix | Delete
def run(self):
[2304] Fix | Delete
"""Start the server."""
[2305] Fix | Delete
try:
[2306] Fix | Delete
DocServer.base = http.server.HTTPServer
[2307] Fix | Delete
DocServer.handler = DocHandler
[2308] Fix | Delete
DocHandler.MessageClass = email.message.Message
[2309] Fix | Delete
DocHandler.urlhandler = staticmethod(self.urlhandler)
[2310] Fix | Delete
docsvr = DocServer(self.host, self.port, self.ready)
[2311] Fix | Delete
self.docserver = docsvr
[2312] Fix | Delete
docsvr.serve_until_quit()
[2313] Fix | Delete
except Exception as e:
[2314] Fix | Delete
self.error = e
[2315] Fix | Delete
[2316] Fix | Delete
def ready(self, server):
[2317] Fix | Delete
self.serving = True
[2318] Fix | Delete
self.host = server.host
[2319] Fix | Delete
self.port = server.server_port
[2320] Fix | Delete
self.url = 'http://%s:%d/' % (self.host, self.port)
[2321] Fix | Delete
[2322] Fix | Delete
def stop(self):
[2323] Fix | Delete
"""Stop the server and this thread nicely"""
[2324] Fix | Delete
self.docserver.quit = True
[2325] Fix | Delete
self.join()
[2326] Fix | Delete
# explicitly break a reference cycle: DocServer.callback
[2327] Fix | Delete
# has indirectly a reference to ServerThread.
[2328] Fix | Delete
self.docserver = None
[2329] Fix | Delete
self.serving = False
[2330] Fix | Delete
self.url = None
[2331] Fix | Delete
[2332] Fix | Delete
thread = ServerThread(urlhandler, hostname, port)
[2333] Fix | Delete
thread.start()
[2334] Fix | Delete
# Wait until thread.serving is True to make sure we are
[2335] Fix | Delete
# really up before returning.
[2336] Fix | Delete
while not thread.error and not thread.serving:
[2337] Fix | Delete
time.sleep(.01)
[2338] Fix | Delete
return thread
[2339] Fix | Delete
[2340] Fix | Delete
[2341] Fix | Delete
def _url_handler(url, content_type="text/html"):
[2342] Fix | Delete
"""The pydoc url handler for use with the pydoc server.
[2343] Fix | Delete
[2344] Fix | Delete
If the content_type is 'text/css', the _pydoc.css style
[2345] Fix | Delete
sheet is read and returned if it exits.
[2346] Fix | Delete
[2347] Fix | Delete
If the content_type is 'text/html', then the result of
[2348] Fix | Delete
get_html_page(url) is returned.
[2349] Fix | Delete
"""
[2350] Fix | Delete
class _HTMLDoc(HTMLDoc):
[2351] Fix | Delete
[2352] Fix | Delete
def page(self, title, contents):
[2353] Fix | Delete
"""Format an HTML page."""
[2354] Fix | Delete
css_path = "pydoc_data/_pydoc.css"
[2355] Fix | Delete
css_link = (
[2356] Fix | Delete
'<link rel="stylesheet" type="text/css" href="%s">' %
[2357] Fix | Delete
css_path)
[2358] Fix | Delete
return '''\
[2359] Fix | Delete
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
[2360] Fix | Delete
<html><head><title>Pydoc: %s</title>
[2361] Fix | Delete
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
[2362] Fix | Delete
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
[2363] Fix | Delete
</body></html>''' % (title, css_link, html_navbar(), contents)
[2364] Fix | Delete
[2365] Fix | Delete
[2366] Fix | Delete
html = _HTMLDoc()
[2367] Fix | Delete
[2368] Fix | Delete
def html_navbar():
[2369] Fix | Delete
version = html.escape("%s [%s, %s]" % (platform.python_version(),
[2370] Fix | Delete
platform.python_build()[0],
[2371] Fix | Delete
platform.python_compiler()))
[2372] Fix | Delete
return """
[2373] Fix | Delete
<div style='float:left'>
[2374] Fix | Delete
Python %s<br>%s
[2375] Fix | Delete
</div>
[2376] Fix | Delete
<div style='float:right'>
[2377] Fix | Delete
<div style='text-align:center'>
[2378] Fix | Delete
<a href="index.html">Module Index</a>
[2379] Fix | Delete
: <a href="topics.html">Topics</a>
[2380] Fix | Delete
: <a href="keywords.html">Keywords</a>
[2381] Fix | Delete
</div>
[2382] Fix | Delete
<div>
[2383] Fix | Delete
<form action="get" style='display:inline;'>
[2384] Fix | Delete
<input type=text name=key size=15>
[2385] Fix | Delete
<input type=submit value="Get">
[2386] Fix | Delete
</form>&nbsp;
[2387] Fix | Delete
<form action="search" style='display:inline;'>
[2388] Fix | Delete
<input type=text name=key size=15>
[2389] Fix | Delete
<input type=submit value="Search">
[2390] Fix | Delete
</form>
[2391] Fix | Delete
</div>
[2392] Fix | Delete
</div>
[2393] Fix | Delete
""" % (version, html.escape(platform.platform(terse=True)))
[2394] Fix | Delete
[2395] Fix | Delete
def html_index():
[2396] Fix | Delete
"""Module Index page."""
[2397] Fix | Delete
[2398] Fix | Delete
def bltinlink(name):
[2399] Fix | Delete
return '<a href="%s.html">%s</a>' % (name, name)
[2400] Fix | Delete
[2401] Fix | Delete
heading = html.heading(
[2402] Fix | Delete
'<big><big><strong>Index of Modules</strong></big></big>',
[2403] Fix | Delete
'#ffffff', '#7799ee')
[2404] Fix | Delete
names = [name for name in sys.builtin_module_names
[2405] Fix | Delete
if name != '__main__']
[2406] Fix | Delete
contents = html.multicolumn(names, bltinlink)
[2407] Fix | Delete
contents = [heading, '<p>' + html.bigsection(
[2408] Fix | Delete
'Built-in Modules', '#ffffff', '#ee77aa', contents)]
[2409] Fix | Delete
[2410] Fix | Delete
seen = {}
[2411] Fix | Delete
for dir in sys.path:
[2412] Fix | Delete
contents.append(html.index(dir, seen))
[2413] Fix | Delete
[2414] Fix | Delete
contents.append(
[2415] Fix | Delete
'<p align=right><font color="#909090" face="helvetica,'
[2416] Fix | Delete
'arial"><strong>pydoc</strong> by Ka-Ping Yee'
[2417] Fix | Delete
'&lt;ping@lfw.org&gt;</font>')
[2418] Fix | Delete
return 'Index of Modules', ''.join(contents)
[2419] Fix | Delete
[2420] Fix | Delete
def html_search(key):
[2421] Fix | Delete
"""Search results page."""
[2422] Fix | Delete
# scan for modules
[2423] Fix | Delete
search_result = []
[2424] Fix | Delete
[2425] Fix | Delete
def callback(path, modname, desc):
[2426] Fix | Delete
if modname[-9:] == '.__init__':
[2427] Fix | Delete
modname = modname[:-9] + ' (package)'
[2428] Fix | Delete
search_result.append((modname, desc and '- ' + desc))
[2429] Fix | Delete
[2430] Fix | Delete
with warnings.catch_warnings():
[2431] Fix | Delete
warnings.filterwarnings('ignore') # ignore problems during import
[2432] Fix | Delete
def onerror(modname):
[2433] Fix | Delete
pass
[2434] Fix | Delete
ModuleScanner().run(callback, key, onerror=onerror)
[2435] Fix | Delete
[2436] Fix | Delete
# format page
[2437] Fix | Delete
def bltinlink(name):
[2438] Fix | Delete
return '<a href="%s.html">%s</a>' % (name, name)
[2439] Fix | Delete
[2440] Fix | Delete
results = []
[2441] Fix | Delete
heading = html.heading(
[2442] Fix | Delete
'<big><big><strong>Search Results</strong></big></big>',
[2443] Fix | Delete
'#ffffff', '#7799ee')
[2444] Fix | Delete
for name, desc in search_result:
[2445] Fix | Delete
results.append(bltinlink(name) + desc)
[2446] Fix | Delete
contents = heading + html.bigsection(
[2447] Fix | Delete
'key = %s' % key, '#ffffff', '#ee77aa', '<br>'.join(results))
[2448] Fix | Delete
return 'Search Results', contents
[2449] Fix | Delete
[2450] Fix | Delete
def html_topics():
[2451] Fix | Delete
"""Index of topic texts available."""
[2452] Fix | Delete
[2453] Fix | Delete
def bltinlink(name):
[2454] Fix | Delete
return '<a href="topic?key=%s">%s</a>' % (name, name)
[2455] Fix | Delete
[2456] Fix | Delete
heading = html.heading(
[2457] Fix | Delete
'<big><big><strong>INDEX</strong></big></big>',
[2458] Fix | Delete
'#ffffff', '#7799ee')
[2459] Fix | Delete
names = sorted(Helper.topics.keys())
[2460] Fix | Delete
[2461] Fix | Delete
contents = html.multicolumn(names, bltinlink)
[2462] Fix | Delete
contents = heading + html.bigsection(
[2463] Fix | Delete
'Topics', '#ffffff', '#ee77aa', contents)
[2464] Fix | Delete
return 'Topics', contents
[2465] Fix | Delete
[2466] Fix | Delete
def html_keywords():
[2467] Fix | Delete
"""Index of keywords."""
[2468] Fix | Delete
heading = html.heading(
[2469] Fix | Delete
'<big><big><strong>INDEX</strong></big></big>',
[2470] Fix | Delete
'#ffffff', '#7799ee')
[2471] Fix | Delete
names = sorted(Helper.keywords.keys())
[2472] Fix | Delete
[2473] Fix | Delete
def bltinlink(name):
[2474] Fix | Delete
return '<a href="topic?key=%s">%s</a>' % (name, name)
[2475] Fix | Delete
[2476] Fix | Delete
contents = html.multicolumn(names, bltinlink)
[2477] Fix | Delete
contents = heading + html.bigsection(
[2478] Fix | Delete
'Keywords', '#ffffff', '#ee77aa', contents)
[2479] Fix | Delete
return 'Keywords', contents
[2480] Fix | Delete
[2481] Fix | Delete
def html_topicpage(topic):
[2482] Fix | Delete
"""Topic or keyword help page."""
[2483] Fix | Delete
buf = io.StringIO()
[2484] Fix | Delete
htmlhelp = Helper(buf, buf)
[2485] Fix | Delete
contents, xrefs = htmlhelp._gettopic(topic)
[2486] Fix | Delete
if topic in htmlhelp.keywords:
[2487] Fix | Delete
title = 'KEYWORD'
[2488] Fix | Delete
else:
[2489] Fix | Delete
title = 'TOPIC'
[2490] Fix | Delete
heading = html.heading(
[2491] Fix | Delete
'<big><big><strong>%s</strong></big></big>' % title,
[2492] Fix | Delete
'#ffffff', '#7799ee')
[2493] Fix | Delete
contents = '<pre>%s</pre>' % html.markup(contents)
[2494] Fix | Delete
contents = html.bigsection(topic , '#ffffff','#ee77aa', contents)
[2495] Fix | Delete
if xrefs:
[2496] Fix | Delete
xrefs = sorted(xrefs.split())
[2497] Fix | Delete
[2498] Fix | Delete
def bltinlink(name):
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function