MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / _setup_pyplot_info_docstrings

Function _setup_pyplot_info_docstrings

site-packages/matplotlib/pyplot.py:2043–2083  ·  view source on GitHub ↗

Generates the plotting docstring. These must be done after the entire module is imported, so it is called from the end of this module, which is generated by boilerplate.py.

()

Source from the content-addressed store, hash-verified

2041
2042
2043def _setup_pyplot_info_docstrings():
2044 """
2045 Generates the plotting docstring.
2046
2047 These must be done after the entire module is imported, so it is
2048 called from the end of this module, which is generated by
2049 boilerplate.py.
2050 """
2051 commands = get_plot_commands()
2052
2053 first_sentence = re.compile(r"(?:\s*).+?\.(?:\s+|$)", flags=re.DOTALL)
2054
2055 # Collect the first sentence of the docstring for all of the
2056 # plotting commands.
2057 rows = []
2058 max_name = len("Function")
2059 max_summary = len("Description")
2060 for name in commands:
2061 doc = globals()[name].__doc__
2062 summary = ''
2063 if doc is not None:
2064 match = first_sentence.match(doc)
2065 if match is not None:
2066 summary = inspect.cleandoc(match.group(0)).replace('\n', ' ')
2067 name = '`%s`' % name
2068 rows.append([name, summary])
2069 max_name = max(max_name, len(name))
2070 max_summary = max(max_summary, len(summary))
2071
2072 separator = '=' * max_name + ' ' + '=' * max_summary
2073 lines = [
2074 separator,
2075 '{:{}} {:{}}'.format('Function', max_name, 'Description', max_summary),
2076 separator,
2077 ] + [
2078 '{:{}} {:{}}'.format(name, max_name, summary, max_summary)
2079 for name, summary in rows
2080 ] + [
2081 separator,
2082 ]
2083 plotting.__doc__ = '\n'.join(lines)
2084
2085
2086## Plotting part 1: manually generated functions and wrappers ##

Callers 1

pyplot.pyFile · 0.85

Calls 8

get_plot_commandsFunction · 0.85
maxFunction · 0.85
groupMethod · 0.80
matchMethod · 0.45
replaceMethod · 0.45
appendMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected