Example #1
0
def get_subclasses_bullets(cls, abbrev=True, style=None, only_leaves=False):
    """
    Return a formatted bullet list of the subclasses of the given class,
    including a short description for each.
    """
    return '\n'.join(f'* {subcls}: {doc}' for subcls, doc in sorted(
        (get_sphinx_name(subcls, style=style, abbrev=abbrev),
         get_short_doc(subcls))
        for subcls in get_subclasses(cls, only_leaves=only_leaves)))
Example #2
0
def get_analysis_listing(plots_map):
    return '\n'.join('* {} analysis:\n  {}\n'.format(
        get_analysis_nice_name(analysis_name),
        '\n  '.join(
            '{name}: {doc}{params}'.format(name=name,
                                           doc=get_short_doc(meth),
                                           params=get_meth_options_help(meth))
            for name, meth in methods.items()),
    ) for analysis_name, methods in plots_map.items())
Example #3
0
    def _get_rst_header(f):
        name = f.__name__
        prefix = 'plot_'
        if name.startswith(prefix):
            name = name[len(prefix):]
        name = name.replace('_', ' ').capitalize()

        try:
            url = get_doc_url(f)
            doc_link = '`[doc] <{url}>`_'.format(url=url)
        except Exception:
            doc_link = ''

        return textwrap.dedent("""
                {name}
                {name_underline}

                {docstring} {link}
            """).format(
            name=name,
            link=doc_link,
            name_underline='=' * len(name),
            docstring=get_short_doc(f),
        )