PyType (@NotNull PyWithItem item, @NotNull TypeEvalContext context) { final PyExpression withExpression = item.getExpression(); final PyType withType = context.getType(withExpression); final PyWithStatement withStatement = PsiTreeUtil.getParentOfType(item, PyWithStatement.class); final boolean isAsync = withStatement != null && withStatement.isAsync(); return PyTypeUtil .toStream(withType) .select(PyClassType.class) .map(t -> getEnterTypeFromPyClass(withExpression, t, isAsync, context)) .collect(PyTypeUtil.toUnion()); }