File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
flake8_missing_annotations Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,15 @@ class AnnotationVisitor(ast.NodeVisitor):
148
148
_state : List [str ]
149
149
_errors : List [Error ]
150
150
151
+ allowed_no_return_type = {
152
+ "__init__" ,
153
+ "__exit__" ,
154
+ "__init_subclass__" ,
155
+ "__new__" ,
156
+ "setup_module" ,
157
+ "teardown_module" ,
158
+ }
159
+
151
160
def __init__ (self ):
152
161
self ._reinit ()
153
162
@@ -240,10 +249,7 @@ def visit_FunctionDef(self, function: ast.FunctionDef) -> None:
240
249
241
250
offending_arguments .append (f"argument { arg .arg !r} is missing a type annotation" )
242
251
243
- if (
244
- not is_test and function .returns is None
245
- and function_name not in {"__init__" , "setup_module" , "teardown_module" }
246
- ):
252
+ if not is_test and function .returns is None and function_name not in self .allowed_no_return_type :
247
253
offending_arguments .append (_no_return_annotation )
248
254
249
255
if offending_arguments :
You can’t perform that action at this time.
0 commit comments