Python pdoc生成的HTML中的方法参数格式不正确
我在一个类中定义了一个方法,如下所示:Python pdoc生成的HTML中的方法参数格式不正确,python,pdoc,Python,Pdoc,我在一个类中定义了一个方法,如下所示: 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.
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}
pdoc为该方法生成下图中的HTML:
我需要做什么才能使pdoc为docstring的param
和return
部分生成不同的内容?pdoc似乎会做一些事情来区分docstring中的params和return语句。这可能是参数和返回语句的突出显示,斜体或粗体,如下图所示。无论发生什么情况,我都希望看到从docstring中删除文本:param
和:return
:
如果您想进一步了解,可以尝试以下方法
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}
你能描述一下你想要实现什么,即这是什么不同的东西吗?你想让pdoc包含类型提示吗?@sanyash,我在我的问题中添加了一张新图片,以更好地描述我对pdoc的期望。我想继续使用重新构造的文本格式。“也许这是不可能的。”乌比基培根,我不确定重组后的文本。我想我的答案是:
通用docstring格式:对markdown、numpydoc、Google风格docstring、poleon和一些通用reST指令的开箱即用支持。
显然“一些通用reST指令”不包括我想要使用的指令。