Coverage for python3_module_template/subproject/myexampleb.py: 100%

10 statements  

« 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 (myexampleb). 

4""" 

5 

6from .myexample import myclass 

7 

8 

9class myclassb(myclass): 

10 

11 """ 

12 This is the documentation for this class. 

13 Inherits from @see cl myclass. 

14 An example on how to share: :sharenet:`facebook-linkedin-twitter-20-body`. 

15 

16 .. todoext:: 

17 :title: An example of a todo 

18 :tag: enhancement 

19 :issue: 1 

20 :index: todoext example 

21 

22 Check the documentation to see how it is rendered. 

23 """ 

24 

25 def __init__(self, pa): 

26 """ 

27 @param pa first parameter 

28 """ 

29 myclass.__init__(self, pa) 

30 

31 def method_napoleon(self, v1, v2): 

32 """ 

33 Example of a docstring used by *sphinx.ext.napoleon* extension. 

34 

35 Args: 

36 v1 (int): a integer 

37 v2 (float): a float 

38 

39 Returns: 

40 float: the sum 

41 

42 Raises: 

43 TypeError: for a type mismatch 

44 

45 See `google style <http://sphinx-doc.org/ext/example_google.html#example-google>`_ 

46 """ 

47 return self.pa + v1 + v2 

48 

49 

50def onefunction(a, b): 

51 """ 

52 Returns the addition of ``a+b``. 

53 

54 :param a: first element 

55 :param b: second element 

56 :return: ``a + b`` 

57 :raises TypeError: if a and b have different types. 

58 """ 

59 if type(a) != type(b): 

60 raise TypeError(f"Type mismatch {a!r} != {b!r}") 

61 return a + b