pystyles
dramkit_style
程序风格参考模板
dramkit(本程序)的注释文本格式主要借鉴Numpy注释风格 [1] ,遵循 re-structured text (reST)语法 [2] 并参考Google代码风格 [3] [4]。 本程序的说明文档由Sphinx自动生成 [5] [6] [7] [r1] [13] 。
References
DramkitClassStyle
- class dramkit.pystyles.dramkit_style.DramkitClassStyle(name='DramkitDocStyle', parm2=None)
Bases:
object
本程序中的class代码风格示例
类名由
首字母大写的单词
拼接而成,这里写函数详细描述,描述可能比较 长长长长长长长长长长长长,需要换行,参见dramkit.gentools.isnull()
参见属性name
参见show()
- name
class nick name
- Type:
str
参见
dramkit.pystyles.dramkit_style.dramkit_funcsytle()
和dramkit.logtools.utils_logger.logger_show()
See also
dramkit.logtools.utils_logger.logger_show()
本程序中的function代码风格示例
See also
function
dramkit.pystyles.dramkit_style.dramkit_funcsytle()
函数编码风格Note
为什么Attributes标题没显示,怎么设置?attribute显示有点丑
- __init__(name='DramkitDocStyle', parm2=None)
初始化
- Parameters:
name (str) – value for self.name
parm2 (str, None) – self.vparm2
属性可以写到这里
- otherattr
description of other attribute
- Type:
str
- property account_id
账户id
- show(x=None)
class中函数的注释参照function的注释规范
- Parameters:
x (str) – string to print
Examples
>>> dds = DramkitDocStyle() >>> dds.show('example') DramkitDocStyle example
- show2(y)
- static show3(x)
staticmethod here
dramkit_funcsytle
- dramkit.pystyles.dramkit_style.dramkit_funcsytle(a, b='b', *args, **kwargs)
本程序中的function代码风格示例
函数名由
小写单词
和_
拼接而成,这里写函数详细描述,描述可能比较 长长长长长长长长长长长长,需要换行参见
dramkit.pystyles.dramkit_style.DramkitClassStyle
Todo
待完成描述
todo1
todo2
- Parameters:
a (str) –
description of argument a斜体 : string to print
New in version 版本号0.0.5: xxx版本新增参数
Deprecated since version 版本号0.0.5: 参数 a 将在0.0.6版本中移除,替代为参数 aa
Changed in version 版本号0.0.6:
a
将修改为int
Note
可以用note标注一些注意事项
这里是注意事项,用无序列表列出
注意1111111111111111111111111111111111111111111111111 111111换行
注意2
Hint
可以用hint标注一些提示
Important
用important描述重要内容
Tip
用tip提示一些小技巧
这里是小技巧内容,用无序列表列出
技巧1
技巧2
b (str, default 'b') –
需要打印的字符串,b加粗 参数描述可能很长长长长长长长长长长长长长长 长长长长长一行放不下,需要跨行
Warning
This is a warning admonition.
Caution
This is a caution admonition.
Deprecated since version 版本号0.0.5: 参数 a 将在0.0.6版本中移除,替代为参数 aa
Attention
This is a attention admonition.
*args – 不定参数
**kwargs –
关键字参数
Error
This is a error admonition.
Danger
This is a danger admonition.
- Returns:
a (str) – return a
b (str) – 返回b的值,这里的描述可能也很长长长长长长长长长长长长长长长长长长长长长 长长长长长一行放不下,需要跨行
str – value of (a+b)
- Raises:
ValueError – if a is not str
Examples
>>> dramkit_docsytle('1', '2', 3, 4, c=5) 1 2 (3, 4) {'c': 5}
See also
dramkit.pystyles.dramkit_style.DramkitClassStyle
本程序中的class代码风格示例
See also
Module
dramkit.pystyles.dramkit_style
编码风格模块Notes
Sphinx也支持生成数学公式,比如FFT是离散傅里叶变换的一种快速实现算法, 其公式为:
\[X(e^{j\omega}) = x(n)e^{-j\omega n}\]行内公式写法: \(a^2 + b^2 = c^2\)
公式块:
\[ \begin{align}\begin{aligned}(a + b)^2 = a^2 + 2ab + b^2\\(a - b)^2 = a^2 - 2ab + b^2\end{aligned}\end{align} \]公式对齐:
\[\begin{split}(a + b)^2 &= (a + b)(a + b) \ \\&= a^2 + 2ab + b^2\end{split}\]\[\begin{split}y_0 &= x_0 \ y_t \\&= (1 - \alpha) y_{t-1} + \alpha x_t\end{split}\]公式编号:
Euler’s identity, equation (1), was elected one of the most beautiful mathematical formulas.
(1)\[e^{i\pi} + 1 = 0\]References
Sphinxg数学公式: http://doc.yonyoucloud.com/doc/zh-sphinx-doc/ext/math.html
我的论文 [i]
1def hello(): 2 print('这里是Python代码块,linenos用于设置生成行号')