/ dummy.py
dummy.py
 1  """Module docstring."""
 2  
 3  import warnings
 4  from typing import Generator
 5  
 6  
 7  attr: int = 0
 8  """Module attribute docstring."""
 9  
10  class Class:
11      """Class docstring."""
12  
13      attr: float = 1.0
14      """Class attribute docstring."""
15  
16      def method(self, parameter: str = "Tim") -> str:
17          """Method docstring.
18          
19          Parameters:
20              parameter: Parameter docstring.
21  
22          Raises:
23              ValueError: Exception docstring.
24  
25          Warns:
26              FutureWarning: Warning docstring.
27  
28          Returns:
29              retval: Returns docstring.
30          """
31          warnings.warn("Hello users.", FutureWarning)
32          if not parameter:
33              raise ValueError("parameter cannot be empty")
34          return parameter * 2
35  
36  
37  def single_yields_receives_returns() -> Generator[int, str, bytes]:
38      """Summary.
39  
40      Yields:
41          one: `1`.
42  
43      Receives:
44          one: `"1"`.
45  
46      Returns:
47          one: `b"1"`.
48      """
49  
50  
51  def multiple_returns() -> tuple[int, int]:
52      """Summary.
53      
54      Returns:
55          one: `1`.
56          two: `2`.
57      """
58      return 1, 2
59  
60  
61  def multiple_yields_receives_returns() -> Generator[tuple[int, int], tuple[str, str], tuple[bytes, bytes]]:
62      """Summary.
63  
64      Yields:
65          one: `1`.
66          two: `2`.
67  
68      Receives:
69          one: `"1"`.
70          two: `"2"`.
71  
72      Returns:
73          one: `b"1"`.
74          two: `b"2"`.
75      """