From bee3ee99ba59f59fa59b68b36f4eb89b605a274e Mon Sep 17 00:00:00 2001 From: chebee7i Date: Tue, 5 Nov 2013 13:10:39 -0600 Subject: [PATCH] Add more examples for docs demo, including a long parameter description. --- demo_docs/source/index.rst | 10 +++++----- demo_docs/source/test_py_module/test.py | 26 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/demo_docs/source/index.rst b/demo_docs/source/index.rst index 93bf2698..3484307e 100644 --- a/demo_docs/source/index.rst +++ b/demo_docs/source/index.rst @@ -18,11 +18,11 @@ Here is another: .. math:: \nabla^2 f = - \frac{1}{r^2} \frac{\partial}{\partial_r} - \left( r^2 \frac{\partial f}{\partial_r} \right) + - \frac{1}{r^2 \sin \theta} \frac{\partial f}{\partial_\theta} - \left( \sin \theta \, \frac{\partial f}{\partial_\theta} \right) + - \frac{1}{r^2 \sin^2\theta} \frac{\partial^2 f}{\partial_\phi^2} + \frac{1}{r^2} \frac{\partial}{\partial r} + \left( r^2 \frac{\partial f}{\partial r} \right) + + \frac{1}{r^2 \sin \theta} \frac{\partial f}{\partial \theta} + \left( \sin \theta \, \frac{\partial f}{\partial \theta} \right) + + \frac{1}{r^2 \sin^2\theta} \frac{\partial^2 f}{\partial \phi^2} API Test ======== diff --git a/demo_docs/source/test_py_module/test.py b/demo_docs/source/test_py_module/test.py index 357d0da7..ca7a8bc9 100644 --- a/demo_docs/source/test_py_module/test.py +++ b/demo_docs/source/test_py_module/test.py @@ -75,3 +75,29 @@ class Foo: """ return myvalue.upper() + + def another_function(self, a, b, **kwargs): + """ + Here is another function. + + :param a: The number of green hats you own. + :type a: int + + :param b: The number of non-green hats you own. + :type b: int + + :param kwargs: Additional keyword arguments. Each keyword parameter + should specify the name of your favorite cuisine. + The values should be floats, specifying the mean price + of your favorite dish in that cooking style. + :type kwargs: float + + :returns: A 2-tuple. The first element is the mean price of all dishes + across cuisines. The second element is the total number of + hats you own: :math:`a + b`. + :rtype: tuple + + :raises ValueError: When ``a`` is not an integer. + + """ + return sum(kwargs.values()) / len(kwargs), a + b