我有一个项目,其中一些功能以拿破仑 numpy 风格记录。本着 numpyness 的精神,我有一堆属于 class 的函数参数array-like
。这是一个例子:
def foo(x, y):
"""
Foo the arguments together to make a bar.
Parameters
----------
x : array-like
This is an argument.
y : array-like
I like it, give me another!
Returns
-------
bar : numpy.ndarray
Works every time
"""
pass
这工作得很好,并且类型包含在没有链接的输出中:
问题是我在每个函数的每一行都收到警告:
/.../my_project/my_module.py:docstring of my_project.my_module.foo:: WARNING: py:class reference target not found: array-like
/.../my_project/my_module.py:docstring of my_project.my_module.foo:: WARNING: py:class reference target not found: array-like
我相当确信有一些解决方案。似乎PR #7690以某种方式解决了这个问题,但我在拿破仑或更广泛的 sphinx 文档中的任何地方都找不到有意义的参考“预处理”。
那么如何摆脱警告呢?