Method parameters not formatted correctly in pdoc generated HTML

1.8k Views Asked by At

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

1

There are 1 best solutions below

3
On BEST ANSWER

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