-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsphinx_docstrings.py
70 lines (48 loc) · 1.49 KB
/
sphinx_docstrings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""
# Sphinx docstrings examples
## Links
[reStructuredText Primer](http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html)
"""
class RSTExample:
@staticmethod
def reference():
"""
This is a reference for ``Sphinx-style RST-style`` docstrings. Check :data:`source` code
to see how it works.
Code example::
data = {
'key': 'value',
}
print(data)
:param my_param: Parameter example
:param int typed_param: Typed parameter example
:returns str: Return statement
:raises ValueError: Raises example
"""
@staticmethod
def directives_test():
"""
Test for some random Sphinx directives
.. code-block:: ruby
def sum_eq_n?(arr, n)
return true if arr.empty? && n == 0
arr.product(arr).reject { |a,b| a == b }.any? { |a,b| a + b == n }
end
.. note:: short note
.. math::
(a + b)^2 = a^2 + 2ab + b^2
(a - b)^2 = a^2 - 2ab + b^2
.. seealso::
modules :py:mod:`zipfile`, :py:mod:`tarfile`
"""
@staticmethod
def version_directives_test():
"""
Test for Version-related directives
.. versionadded:: 2.5
The *spam* parameter.
.. versionchanged:: 2.7
Mandatory *spam* parameter.
.. deprecated:: 3.1
Use :func:`spam` instead.
"""