Skip to content

Commit cfebf58

Browse files
committed
DO NOT MERGE: Demo of warnings directives.
1 parent bf210cc commit cfebf58

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

doc/example.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,36 @@
3737
def foo(var1, var2, *args, long_var_name="hi", only_seldom_used_keyword=0, **kwargs):
3838
r"""Summarize the function in one line.
3939
40+
.. warning:: Warning number 1
41+
4042
Several sentences providing an extended description. Refer to
4143
variables using back-ticks, e.g. `var`.
4244
45+
.. warning::
46+
47+
A slightly longer, multiline warning.
48+
49+
Placed in the extended summary.
50+
4351
Parameters
4452
----------
4553
var1 : array_like
4654
Array_like means all those objects -- lists, nested lists, etc. --
4755
that can be converted to an array. We can also refer to
4856
variables like `var1`.
57+
58+
.. warning::
59+
60+
An even richer warning in the parameter description that contains
61+
a list:
62+
63+
- point 1
64+
- point 2
65+
66+
and code::
67+
68+
a**2 + b**2 = c**2
69+
4970
var2 : int
5071
The type above can either refer to an actual Python type
5172
(e.g. ``int``), or describe the type of the variable in more
@@ -81,6 +102,8 @@ def foo(var1, var2, *args, long_var_name="hi", only_seldom_used_keyword=0, **kwa
81102
BadException
82103
Because you shouldn't have done that.
83104
105+
.. warning:: But seriously
106+
84107
See Also
85108
--------
86109
numpy.array : Relationship (optional).
@@ -94,6 +117,8 @@ def foo(var1, var2, *args, long_var_name="hi", only_seldom_used_keyword=0, **kwa
94117
95118
This can have multiple paragraphs.
96119
120+
.. warning:: A final warning, for good measure
121+
97122
You may include some math:
98123
99124
.. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}

0 commit comments

Comments
 (0)