mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-9496 Don't show warnings about base classes without __init__
PY-9302 Class has no __init__ method: false positive for child class without one
This commit is contained in:
@@ -53,13 +53,6 @@ public class PyClassHasNoInitInspection extends PyInspection {
|
||||
registerProblem(node.getNameIdentifier(), PyBundle.message("INSP.class.has.no.init"),
|
||||
new AddMethodQuickFix("__init__", new PyClassTypeImpl(node, false), false));
|
||||
}
|
||||
for (PyClass ancestor : node.getAncestorClasses(myTypeEvalContext)) {
|
||||
final PyFunction ancestorInit = ancestor.findInitOrNew(false);
|
||||
if (ancestorInit == null) {
|
||||
registerProblem(node.getNameIdentifier(), PyBundle.message("INSP.parent.$0.has.no.init", ancestor.getName()),
|
||||
new AddMethodQuickFix("__init__", new PyClassTypeImpl(ancestor, false), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ class <weak_warning descr="Class has no __init__ method">A</weak_warning>:
|
||||
def foo(self):
|
||||
self.b = 1
|
||||
|
||||
class <weak_warning descr="Parent 'A' has no __init__ method">B</weak_warning>(A):
|
||||
class B(A):
|
||||
def __init__(self):
|
||||
self.b = 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user