Counts whether the computed key value is already present
           in the memoization dictionary (a hit) or not (a miss).
976335
def count(self, *args, **kw):
        
        obj = args[0]
        try:
            memo_dict = obj._memo[self.method_name]
        except KeyError:
            self.miss = self.miss + 1
        else:
            key = self.keymaker(*args, **kw)
            if key in memo_dict:
                self.hit = self.hit + 1
            else:
                self.miss = self.miss + 1
712083
def has_key(self, key):
        """"""
        k = self._lowerOrReturn(key)
        return k in self.data
112486
public synchronized boolean addUnique(int key, int value) {

        if (count == capacity) {
            if (fixedSize) {
                return false;
            } else {
                doubleCapacity();
            }
        }

        if (!sorted) {
            fastQuickSort();
        }

        targetSearchValue = sortOnValues ? value
                                         : key;

        int i = binaryEmptySlotSearch();

        if (i == -1) {
            return false;
        }

        hasChanged = true;

        if (count != i) {
            moveRows(i, i + 1, count - i);
        }

        keys[i]   = key;
        values[i] = value;

        count++;

        return true;
    }
1206803
def __check_existing(self, row):
        
        if self.__update_keys is not None:
            key = tuple(row[key] for key in self.__update_keys)
            if key in self.__bloom:
                return True
            self.__bloom.add(key)
            return False
        return False
1193772
function(key) {
      if (!cache) return null;
      var cached = cache.get(key);
      if (cached) console.log('cache hit: %s', key);
      return cached;
    }
345482
def tally(self, name, value):
        """"""
        value = value or 0  # Protection against None.
        # Start at 0 if this is the first value.
        if 'used' not in self.usages[name]:
            self.usages[name]['used'] = 0
        # Increment our usage and update the "available" metric.
        self.usages[name]['used'] += int(value)  # Fail if can't coerce to int.
        self.update_available(name)
554174
private boolean checkIfKeyExists(String key)
    {
        if (aggregationsKeySet == null)
        {
            aggregationsKeySet = new HashSet<String>();
        }
        return aggregationsKeySet.add(key);
    }
482944
def key_exists(self, key):
        
        assert isinstance(key, str)
        cursor = self.conn.cursor()
        with contextlib.closing(cursor):
            cursor.execute('SELECT COUNT(*) FROM events WHERE uuid=?', (key,))
            res = cursor.fetchone()
            count = res[0]
        if count == 0:
            return False
        else:
            assert count in (0, 1), \
                "Duplicate event ids detected: {0}".format(count)
            return True
1141958
public void incrementCounter(BugChecker bugChecker, String key, int count) {
    statisticsCollector.incrementCounter(statsKey(bugChecker.canonicalName() + "-" + key), count);
  }
925982
def _has(self, key, exact=0):

        """"""

        if not exact:
            try:
                key = self.getfullkey(key)
                return 1
            except KeyError:
                return 0
        else:
            return key in self.data
469250
@Override
    public int countMissing() {
        int count = 0;
        for (int i = 0; i < size(); i++) {
            if (MISSING_VALUE == getKeyForIndex(i)) {
                count++;
            }
        }
        return count;
    }
82234
def key_exists_in_list_or_dict(key, lst_or_dct):
    """"""
    if isinstance(lst_or_dct, dict) and key in lst_or_dct:
        return True
    elif isinstance(lst_or_dct, list):
        min_i, max_i = 0, len(lst_or_dct)
        if min_i <= key < max_i:
            return True
    return False
611324
function it_throwsErrorIfEdgeExists() {
			it("throws an error if an edge with the given keys already exists", function () {
				expectItWhenBoundWith('k2', 'k3').toThrow();
				expectItWhenBoundWith('k3', 'k4').toThrow();
				expectItWhenBoundWith('k2', 'k3').toThrowSpecific(Graph.EdgeExistsError, { edges: {'k2': {'k3': 'oldValue23'}} });
				expectItWhenBoundWith('k3', 'k4').toThrowSpecific(Graph.EdgeExistsError, { edges: {'k3': {'k4': undefined}} });
			});
		}
987477
def _count(self, method, limit, keywords):
        
        # The limit will be mutated, so copy it and leave the original intact
        limit = limit.copy()
        has_more = True
        count = None
        while has_more:
            limit.set_request_args(keywords)
            response = self.call(method, **keywords)
            limit.post_fetch(response)
            count += Count.from_response(response)
            last_evaluated_key = response.get('LastEvaluatedKey')
            has_more = last_evaluated_key is not None and not limit.complete
            if has_more:
                keywords['ExclusiveStartKey'] = last_evaluated_key
        return count
319064
def exists(self, key, fresh=False):
        
        key = key.upper()
        if key in self._deleted:
            return False
        return self.get(key, fresh=fresh, default=missing) is not missing
389620
def count_duplicates(items):
    """"""
    c = Counter(items)
    return dict((k, v) for (k, v) in viewitems(c) if v > 1)
353223
def multiget_count(self, keys, column_parent, predicate, consistency_level):
    
    self._seqid += 1
    d = self._reqs[self._seqid] = defer.Deferred()
    self.send_multiget_count(keys, column_parent, predicate, consistency_level)
    return d