3

I have a method in a class defined as shown below:

def my_method(self, a: str = None, b: str = None) -> typing.Set[str]:
    """
    Do something

    :param a: A string to represent something.

    :param b: A string to represent something else.

    :return: A set of strings.
    """

    return {a, b}

And pdoc generates the HTML in the picture below for that method:

enter image description here

What do I need to do to make pdoc generate something different for the param and return portions of the docstring? Seems like something would be done by pdoc to differentiate params and return statements from each other in the docstring. That something could be a highlight of the parameter and return statements, italic font, or bold font like seen below. Whatever happens, I would like to see the text :param and :return removed from the docstring:

enter image description here

ubiquibacon
  • 10,451
  • 28
  • 109
  • 179

1 Answers1

1

If you are after further clarity then you may try something like below

def my_method(self, a: str = None, b: str = None) -> typing.Set[str]:
    """
    Do something

    Args:
        a (str): The first parameter.
        b (str): The second parameter.

    Returns:
        Set: The return value. If result has values then Set of string, otherwise empty set.

    """
    s._parse_hh_mm_ss_ff()
    return {a, b}

when called

S.N
  • 4,910
  • 5
  • 31
  • 51
  • 1
    I would like to keep using the restructuredtext format. Maybe that isn't possible. – ubiquibacon Oct 16 '19 at 22:15
  • @ubiquibacon, I am not sure on restructured text. Yo may check https://www.python.org/dev/peps/pep-0287/ – S.N Oct 16 '19 at 22:18
  • I think my answer is on the [pdoc website](https://pdoc3.github.io/pdoc/): `Common docstring formats: Out-of-the-box support for markdown, numpydoc, Google-style docstrings, Napoleon, and some common reST directives.` Apparently "some common reST directives" doesn't include the ones I want to use. – ubiquibacon Oct 16 '19 at 22:22