小编sch*_*ard的帖子

缩短Sphinx中Python类型注释的显示格式

鉴于模块中的以下函数,mymodule我想使用 Sphinx 进行记录autodoc

\n
from typing import Union\nfrom collections.abc import Iterable\nfrom numpy.typing import ArrayLike\n\ndef foo(a: Union[str, int], b: Iterable, c: ArrayLike) -> None:\n    """Do something useful."""\n    pass\n
Run Code Online (Sandbox Code Playgroud)\n

在源代码中,函数的签名非常可读。但是,在生成的文档中autodoc但是,在签名

\n
\n

khadl._util.foo(a:Union [str,int],b:collections.abc.Iterable,c:Union [int,float,complex,str,字节,numpy.generic,Sequence [Union [int,float,complex] , str, bytes, numpy.generic]], 序列[序列[任意]], numpy.typing._array_like._SupportsArray]) \xe2\x86\x92 无

\n
\n

这是不可读的。源自模块的类typing以简短形式显示(Union, Sequence, Any),但对于抽象基类,Iterable会生成唯一标识符(collections.abc.Iterable),ArrayLike甚至“解包”(Union[int, float, complex, str, bytes, numpy.generic, Sequence[Union[int, float, complex, str, bytes, numpy.generic]], Sequence[Sequence[Any]], …

python type-hinting python-sphinx autodoc

5
推荐指数
1
解决办法
1472
查看次数

gnuplot:在球体表面绘制函数

我有一个函数,假设f(theta, phi) = sqrt(1 - (sin(theta)*sin(phi))**2) + 5 * sqrt(1 - (sin(theta)*cos(phi))**2)我想在球体表面绘制颜色图。但是,我不知道如何splot在不首先生成表中包含适当值的文件的情况下将这个函数输入到其中以实现此目的。

我怎样才能gnuplot做到这一点?

plot gnuplot heatmap

0
推荐指数
1
解决办法
996
查看次数

标签 统计

autodoc ×1

gnuplot ×1

heatmap ×1

plot ×1

python ×1

python-sphinx ×1

type-hinting ×1