boolean (@NotNull PyType type, @NotNull PyExpression expression, @NotNull Context context) { if (type instanceof PyUnionType) return false; PyType typeToClass = type instanceof PyClassLikeType ? ((PyClassLikeType)type).toClass() : type; var resolved = typeToClass.resolveMember("__or__", expression, AccessDirection.READ, PyResolveContext.defaultContext(context.getTypeContext())); if (resolved == null || resolved.isEmpty()) return false; return StreamEx.of(resolved) .map(it -> it.getElement()) .nonNull() .noneMatch(it -> PyBuiltinCache.getInstance(it).isBuiltin(it)); }