private static boolean isInstanceAttribute(@NotNull PyTargetExpression target, @NotNull TypeEvalContext context) {
    final ScopeOwner scopeOwner = ScopeUtil.getScopeOwner(target);
    if (target.isQualified() && target.getContainingClass() != null && scopeOwner instanceof PyFunction) {

      if (context.maySwitchToAST(target)) {
        final PyResolveContext resolveContext = PyResolveContext.defaultContext(context);
        //noinspection ConstantConditions
        return StreamEx.of(PyUtil.multiResolveTopPriority(target.getQualifier(), resolveContext))
          .select(PyParameter.class)
          .filter(PyParameter::isSelf)
          .anyMatch(p -> PsiTreeUtil.getParentOfType(p, PyFunction.class) == scopeOwner);
      }
      else {
        return PyUtil.isInstanceAttribute(target);
      }
    }
    return false;
  }
private static boolean isInstanceAttribute(@NotNull PyTargetExpression target, @NotNull TypeEvalContext context)