Coverage for python3_module_template/subproject2/myexample2.py: 100%
12 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-03 02:15 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-03 02:15 +0200
1"""
2@file
3@brief This the documentation of this module (myexample2).
5To make a reference to a blog post, just read :ref:`label-to-this-blogpost`.
7The following documentation comes from a directive
8`runpython
9<http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/pyquickhelper/helpgen/sphinx_runpython_extension.html>`_
10which outputs documentation on the standard output::
12 .. runpython::
13 :showcode:
15 for l in range(0,10):
16 print(" line", l)
18Which gives:
20.. runpython::
21 :showcode:
23 for l in range(0,10):
24 print(" line", l)
26And without the input code:
28.. runpython::
30 for l in range(0,10):
31 print(" line", l)
33You can also add option *rst*::
35 .. runpython::
36 :rst:
38 for l in range(0,10):
39 print("**line**", "*" +str(l)+"*")
40 print('')
42Which displays interpreted RST:
44.. runpython::
45 :rst:
47 for l in range(0,10):
48 print("**line**", "*" +str(l)+"*")
49 print('')
51It can be run in a separate process with option ``:process:``
52(click on source):
54.. runpython::
55 :process:
57 import python3_module_template
58 import os
59 print(os.path.split(python3_module_template.__file__)[-1])
60"""
61from ..subproject.myexample import myclass
64class myclass2(myclass):
66 """
67 This is the documentation for this class.
69 @var pa an example of an attribute.
71 Inline :math:`x^2 + y + z`. Another equation to test:
73 .. math::
75 x^2 + y
77 .. math::
79 \\sum_{i=1}^n x^2
81 """
83 def __init__(self, pa):
84 """
85 @param pa first parameter
86 """
87 myclass.__init__(self, pa)
89 def get_value(self, mul):
90 """
91 returns the parameter multiplied by a value
92 @param mul a float
93 @return a float
94 """
95 return self.pa * mul
97 @staticmethod
98 def static_example():
99 """
100 @return a boolean
101 """
102 return True
104 @property
105 def property_example(self):
106 """
107 a property example
108 """
109 return True