Count how many times stub have been called with passed arguments.
427554
function calledWith() {
  var calledWithCount = 0;
  var args = [];
  var argsLength = arguments.length;
  for (var i = 0; i < argsLength; i++) {
    args[i] = arguments[i];
  }
  var callsLength = this._calls.length;
  CALLS: for (var i = 0; i < callsLength; i++) {
    var match = false;
    var called = this._calls[i];
    var calledLength = called.length;
    if (argsLength === 0 && calledLength === 0) {
      match = true;
    } else {
      ARGS: for (var a = 0; a < argsLength; a++) {
        match = matchArgs(args[a],called[a]);
        if (!match) {
          break ARGS;
        }
      }
    }
    if (match) {
      calledWithCount++;
    }
  }
  return calledWithCount;
}
228667
public function count(...$arguments): ?int
    {
        $where       = $arguments[0] ?? null;
        $whereParams = $arguments[1] ?? null;

        $query = $this->initQueryBuilder();
        try {
            $query->select('1');

            if ($where != null) {
                $query->where($where, $whereParams);
            }

            return $query->count();
        } catch (\Exception $e) {
            $this->setFail($e);

            return null;
        }
    }
837500
def _compute_callables_count(self, iters: Dict[str, Any]):
        """"""
        count = dict.fromkeys([issue["callable"] for issue in iters["issues"]], 0)
        for issue in iters["issues"]:
            count[issue["callable"]] += 1

        return count
187443
def count_called(self, axis=None):
        
        b = self.is_called()
        return np.sum(b, axis=axis)
1320530
def check_third_rule
      total_method_calls = @data[:method_calls].size

      proper_method_calls = @data[:method_calls].inject(0) do |sum, method_call|
        sum += 1 unless method_call.number_of_arguments > 4
        sum
      end

      @output[:third_rule] ||= {}
      @output[:third_rule][:proper_method_calls] = proper_method_calls
      @output[:third_rule][:total_method_calls] = total_method_calls

      log_third_rule if @store_details
    end
214959
public int count(String where, String[] args) {
		return db.count(getTableName(), where, args);
	}
550896
def call_once(func):
  
  argspec = inspect.getargspec(func)
  if argspec.args or argspec.varargs or argspec.keywords:
    raise ValueError('Can only decorate functions with no args', func, argspec)

  @functools.wraps(func)
  def _wrapper():
    # If we haven't been called yet, actually invoke func and save the result.
    if not _wrapper.HasRun():
      _wrapper.MarkAsRun()
      _wrapper.return_value = func()
    return _wrapper.return_value

  _wrapper.has_run = False
  _wrapper.HasRun = lambda: _wrapper.has_run
  _wrapper.MarkAsRun = lambda: setattr(_wrapper, 'has_run', True)
  return _wrapper
346454
function count(req, res) {
  var list = getList.call(this);
  return res.send(null, list.length);
}
808294
def verifyStubbedInvocationsAreUsed(*objs):
    
    if objs:
        theMocks = map(_get_mock_or_raise, objs)
    else:
        theMocks = mock_registry.get_registered_mocks()


    for mock in theMocks:
        for i in mock.stubbed_invocations:
            if not i.allow_zero_invocations and i.used < len(i.answers):
                raise VerificationError("\nUnused stub: %s" % i)
452470
def function_arg_count(fn):
    
    assert callable(fn), 'function_arg_count needed a callable function, not {0}'.format(repr(fn))
    if hasattr(fn, '__code__') and hasattr(fn.__code__, 'co_argcount'):
        return fn.__code__.co_argcount
    else:
        return 1
562488
private void whenInt(MockedVoidMethod method) {
        if (onMethodCallDuringStubbing.get() != null) {
            throw new IllegalStateException("Stubbing is already in progress on this thread.");
        }

        ArrayList<Method> stubbingsSetUp = new ArrayList<>();

        /* Set up interception of method. 'method' does not specify what class the stubbing is
         * set up on. Hence wait until the call is made and intercept it just before the code
         * is executed. At this time, start the stubbing operation.
         */
        onMethodCallDuringStubbing.set((clazz, stubbedMethod) -> {
            when(ExtendedMockito.staticMockMarker(clazz));
            stubbingsSetUp.add(stubbedMethod);
        });
        try {
            try {
                // Call the method. This will be intercepted by onMethodCallDuringStubbing
                method.run();
            } catch (Throwable t) {
                throw new RuntimeException(t);
            }

            if (stubbingsSetUp.isEmpty()) {
                // Make sure something was intercepted
                throw new IllegalArgumentException("Nothing was stubbed. Does the lambda call a"
                        + " static method on a 'static' mock/spy?");
            } else if (stubbingsSetUp.size() > 1) {
                // A lambda might call several methods. In this case it is not clear what should
                // be stubbed. Hence throw an error.
                throw new IllegalArgumentException("Multiple intercepted calls on method "
                        + stubbingsSetUp);
            }
        } finally {
            onMethodCallDuringStubbing.remove();
        }
    }
153414
private String set(ChaincodeStub stub, List<String> args) {
        if (args.size() != 2) {
            throw new RuntimeException("Incorrect arguments. Expecting a key and a value");
        }
        stub.putStringState(args.get(0), args.get(1));
        return args.get(1);
    }
562709
public static <T> Number count(T[] self, @ClosureParams(FirstParam.Component.class) Closure closure) {
        return count((Iterable)Arrays.asList(self), closure);
    }
305959
def count(self):
        

        try:
            return self.object_list.count()
        except (AttributeError, TypeError):
            # AttributeError if object_list has no count() method.
            # TypeError if object_list.count() requires arguments
            # (i.e. is of type list).
            return len(self.object_list)
904102
function invalidArgumentsCount(typeInfo, index, numArgsExpected, args) {
    return new TypeError (trimTrailingSpaces (
      q (typeInfo.name) + ' applied to the wrong number of arguments\n\n' +
      underline (
        typeInfo,
        K (K (_)),
        function(index_) {
          return function(f) {
            return K (K (index_ === index ? f : _));
          };
        }
      ) + '\n' +
      'Expected ' + numArgs (numArgsExpected) +
      ' but received ' + numArgs (args.length) +
      toMarkdownList ('.\n', ':\n\n', show, args)
    ));
  }
463292
def stub_deps(clazz, deps)
      wrap_load(clazz) do |ctx|
        dep = deps[ctx.key]
        next ctx.load unless dep
        dep.respond_to?(:is_a?) && dep.is_a?(Proc) ? dep.call(*ctx.args) : dep
      end
    end
1207954
public function each($method, ...$args)
    {
        if ($this->count() === 0) {
            return 0;
        }
        $n = 0;
        foreach ($this as $obj) {
            $obj->$method(...$args);
            ++$n;
        }
        return $n;
    }