@Nullable
  @Override
  public PyType getReturnType(
      @NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite) {
    final PyType type = getGenericReturnType(context, callSite);

    if (callSite == null) {
      return type;
    }
    final PyTypeChecker.AnalyzeCallResults results =
        PyTypeChecker.analyzeCallSite(callSite, context);

    if (PyTypeChecker.hasGenerics(type, context)) {
      if (results != null) {
        final Map<PyGenericType, PyType> substitutions =
            PyTypeChecker.unifyGenericCall(
                this, results.getReceiver(), results.getArguments(), context);
        if (substitutions != null) {
          return PyTypeChecker.substitute(type, substitutions, context);
        }
      }
      return null;
    }
    if (results != null && isDynamicallyEvaluated(results.getArguments().values(), context)) {
      return PyUnionType.createWeakType(type);
    } else {
      return type;
    }
  }
 @Nullable
 @Override
 public PyType getCallType(
     @NotNull TypeEvalContext context, @NotNull PyQualifiedExpression callSite) {
   PyType type = null;
   for (PyTypeProvider typeProvider : Extensions.getExtensions(PyTypeProvider.EP_NAME)) {
     type = typeProvider.getCallType(this, callSite, context);
     if (type != null) {
       type.assertValid(typeProvider.toString());
       break;
     }
   }
   if (type == null) {
     type = context.getReturnType(this);
   }
   final PyTypeChecker.AnalyzeCallResults results =
       PyTypeChecker.analyzeCallSite(callSite, context);
   if (results != null) {
     return analyzeCallType(type, results.getReceiver(), results.getArguments(), context);
   }
   return type;
 }