boolean (@Nullable PyTypedElement value, @NotNull TypeEvalContext context) { if (value == null) return false; Set<PyClass> pyClasses = PyTypeUtil.toStream(context.getType(value)) .select(PyClassType.class) .filter(clsType -> !clsType.isDefinition()) .map(PyClassType::getPyClass) .toSet(); if (!pyClasses.isEmpty()) { PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(value); Set<PyClass> forbiddenClasses = StreamEx .of(builtinCache.getListType(), builtinCache.getSetType(), builtinCache.getDictType()) .nonNull() .map(PyClassType::getPyClass) .toSet(); return StreamEx.of(pyClasses) .flatMap(pyClass -> StreamEx.of(pyClass).append(pyClass.getAncestorClasses(context))) .anyMatch(forbiddenClasses::contains); } return false; }