Ref<PyType> (@Nullable PyType type, @Nullable PyExpression source, @NotNull PsiElement anchor, @NotNull TypeEvalContext context, boolean async) { if (type == null) return null; final String nextMethodName = async ? PyNames.ANEXT : !LanguageLevel.forElement(anchor).isPython2() ? PyNames.DUNDER_NEXT : PyNames.NEXT; final PyFunction next = findMethodByName(type, nextMethodName, context); if (next != null) { return Ref.create(getContextSensitiveType(next, context, source)); } return null; }