boolean (@NotNull PyCallable callable, @NotNull PyCallable otherCallable, @NotNull TypeEvalContext context) { final List<PyCallableParameter> parameters = callable.getParameters(context); final List<PyCallableParameter> otherParameters = otherCallable.getParameters(context); final int optionalCount = optionalParametersCount(parameters); final int otherOptionalCount = optionalParametersCount(otherParameters); final int requiredCount = requiredParametersCount(callable, parameters); final int otherRequiredCount = requiredParametersCount(otherCallable, otherParameters); if (hasPositionalContainer(otherParameters) || hasKeywordContainer(otherParameters)) { if (otherParameters.size() == specialParametersCount(otherCallable, otherParameters)) { return true; } } if (hasPositionalContainer(parameters) || hasKeywordContainer(parameters)) { return requiredCount <= otherRequiredCount; } return requiredCount <= otherRequiredCount && optionalCount >= otherOptionalCount && namedParametersCount(parameters) >= namedParametersCount(otherParameters); }