From fc02fb5ca587c9236508299e5664bcc6bc41d359 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Thu, 25 Jul 2013 17:52:39 +0400 Subject: [PATCH] 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 --- .../python/inspections/PyClassHasNoInitInspection.java | 7 ------- .../inspections/PyClassHasNoInitInspection/parentClass.py | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/python/src/com/jetbrains/python/inspections/PyClassHasNoInitInspection.java b/python/src/com/jetbrains/python/inspections/PyClassHasNoInitInspection.java index c7dfb09a8512..56e0e1f90183 100644 --- a/python/src/com/jetbrains/python/inspections/PyClassHasNoInitInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyClassHasNoInitInspection.java @@ -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)); - } - } } } } \ No newline at end of file diff --git a/python/testData/inspections/PyClassHasNoInitInspection/parentClass.py b/python/testData/inspections/PyClassHasNoInitInspection/parentClass.py index b28f8965302b..4fca91af54eb 100644 --- a/python/testData/inspections/PyClassHasNoInitInspection/parentClass.py +++ b/python/testData/inspections/PyClassHasNoInitInspection/parentClass.py @@ -3,7 +3,7 @@ class A: def foo(self): self.b = 1 -class B(A): +class B(A): def __init__(self): self.b = 2