boolean (@NotNull PyType type, PsiReference reference, String name) { if (PyTypeChecker.isUnknown(type, myTypeEvalContext)) { // this almost always means that we don't know the type, so don't show an error in this case return true; } if (type instanceof PyStructuralType && ((PyStructuralType)type).isInferredFromUsages()) { return true; } if (type instanceof PyImportedModuleType) { PyImportedModule module = ((PyImportedModuleType)type).getImportedModule(); if (module.resolve() == null) { return true; } } if (type instanceof PyCustomType) { // Skip custom member types that mimics another class with fuzzy parents for (final PyClassLikeType mimic : ((PyCustomType)type).getTypesToMimic()) { if (!(mimic instanceof PyClassType)) { continue; } if (PyUtil.hasUnresolvedAncestors(((PyClassType)mimic).getPyClass(), myTypeEvalContext)) { return true; } } } if (type instanceof PyClassType) { PyClass cls = ((PyClassType)type).getPyClass(); if (PyTypeChecker.overridesGetAttr(cls, myTypeEvalContext)) { return true; } if (cls.findProperty(name, true, myTypeEvalContext) != null) { return true; } if (PyUtil.hasUnresolvedAncestors(cls, myTypeEvalContext)) { return true; } if (isDecoratedAsDynamic(cls, true)) { return true; } if (hasUnresolvedDynamicMember((PyClassType)type, reference, name, myTypeEvalContext)) return true; if (isAwaitOnGeneratorBasedCoroutine(name, reference, cls)) return true; } if (type instanceof PyFunctionTypeImpl) { final PyCallable callable = ((PyFunctionTypeImpl)type).getCallable(); if (callable instanceof PyFunction && PyKnownDecoratorUtil.hasUnknownOrUpdatingAttributesDecorator((PyFunction)callable, myTypeEvalContext)) { return true; } } if (type instanceof PyUnionType) { return ContainerUtil.exists(((PyUnionType)type).getMembers(), member -> ignoreUnresolvedMemberForType(member, reference, name)); } if (type instanceof PyModuleType) { final PyFile module = ((PyModuleType)type).getModule(); if (module.getLanguageLevel().isAtLeast(LanguageLevel.PYTHON37)) { return PyTypeChecker.definesGetAttr(module, myTypeEvalContext); } } for (PyInspectionExtension extension : PyInspectionExtension.EP_NAME.getExtensionList()) { if (extension.ignoreUnresolvedMember(type, name, myTypeEvalContext)) { return true; } } return false; }