---
source: crates/ruff/src/rules/flake8_annotations/mod.rs
---
mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__`
  |
5 | # Error
6 | class Foo:
7 |     def __init__(self):
  |         ^^^^^^^^ ANN204
8 |         ...
  |
  = help: Add `None` return type

ℹ Suggested fix
2 2 | 
3 3 | # Error
4 4 | class Foo:
5   |-    def __init__(self):
  5 |+    def __init__(self) -> None:
6 6 |         ...
7 7 | 
8 8 | 

mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__`
   |
11 | # Error
12 | class Foo:
13 |     def __init__(self, foo):
   |         ^^^^^^^^ ANN204
14 |         ...
   |
   = help: Add `None` return type

ℹ Suggested fix
8  8  | 
9  9  | # Error
10 10 | class Foo:
11    |-    def __init__(self, foo):
   11 |+    def __init__(self, foo) -> None:
12 12 |         ...
13 13 | 
14 14 | 

mypy_init_return.py:40:5: ANN202 Missing return type annotation for private function `__init__`
   |
40 | # Error
41 | def __init__(self, foo: int):
   |     ^^^^^^^^ ANN202
42 |     ...
   |

mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__`
   |
47 | # of a vararg falsely indicated that the function has a typed argument.
48 | class Foo:
49 |     def __init__(self, *arg):
   |         ^^^^^^^^ ANN204
50 |         ...
   |
   = help: Add `None` return type

ℹ Suggested fix
44 44 | # Error – used to be ok for a moment since the mere presence
45 45 | # of a vararg falsely indicated that the function has a typed argument.
46 46 | class Foo:
47    |-    def __init__(self, *arg):
   47 |+    def __init__(self, *arg) -> None:
48 48 |         ...


