write counted set
189969
private Object writeCounted(final SerIterator itemIterator) {
        List<Object> result = new ArrayList<>();
        while (itemIterator.hasNext()) {
            itemIterator.next();
            Object outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
            int outputCount = itemIterator.count();
            result.add(Arrays.asList(outputValue, outputCount));
        }
        return result;
    }
122163
public int setCount (K key, int count)
    {
        int[] val = get(key);
        if (val == null) {
            put(key, new int[] { count });
            return 0; // old value
        }
        int oldVal = val[0];
        val[0] = count;
        return oldVal;
    }
622970
def repeat_all(self, count=2):
        
        try:
            return self.__class__(''.join(str(self) * count))
        except TypeError:
            raise TypeError(
                '`count` must be an integer. Got: {!r}'.format(count)
            )
1270558
def count(self):
        """"""
        if self.request["Select"] == "COUNT":
            while not self.exhausted:
                next(self, None)
        return self._count
800875
public Set<E> keysAt(int count) {
    Set<E> keys = new HashSet<E>();
    for (E key : map.keySet()) {
      if (getIntCount(key) == count) {
        keys.add(key);
      }
    }
    return keys;
  }
1343691
def print_sorted_counter(counter, tab=1):
    """"""
    for key, count in sorted(counter.items(), key=itemgetter(1), reverse=True):
        print "{0}{1} - {2}".format('\t'*tab, key, count)
149784
private static <E> Counter<Integer> collectCountCounts(Counter<E> counts) {
    Counter<Integer> cc = new ClassicCounter<Integer>(); // counts of counts
    for (Map.Entry<E, Double> entry : counts.entrySet()) {
      //E item = entry.getKey();
      Integer count = (int) Math.round(entry.getValue());
      cc.incrementCount(count);
    }
    return cc;
  }
723899
def write_batch(self, batch):
        
        for item in batch:
            for key in item:
                self.aggregated_info['occurrences'][key] += 1
            self.increment_written_items()
            if self.items_limit and self.items_limit == self.get_metadata('items_count'):
                raise ItemsLimitReached('Finishing job after items_limit reached: {} items written.'
                                        .format(self.get_metadata('items_count')))
        self.logger.debug('Wrote items')
72344
Stream<String> writeFunctionCounter(FunctionCounter counter) {
        double count = counter.count();
        if (Double.isFinite(count)) {
            return Stream.of(event(counter.getId(), new Attribute("throughput", count)));
        }
        return Stream.empty();
    }
551629
def PrintSets(self):
        """"""
        sets=self._getphotosets()
        for setname in sets:
            print("%s [%d]"%(setname,sets[setname]['number_photos']))
1111554
public void count(final Stat name, final int count) {
        Integer value = counters.get(name);
        value = value == null ? count : value + count;
        counters.put(name, value);
    }
281839
def write_int(self, number):
        
        buf = pack(self.byte_order + "i", number)
        self.write(buf)
237135
def get_count(self, prefix=''):
        """"""
        return sum([self.counters[key]
                    for key in self.messages if key.startswith(prefix)])
458484
private void writeMoleculeSet(IAtomContainerSet som) throws Exception {
        for (IAtomContainer mol : som.atomContainers()) {
            writeMolecule(mol);
        }
    }
391712
static void countHetero(List<IRingSet> rsets) {
        for (IRingSet rset : rsets) {
            int numHeteroAtoms = 0;
            int numHeteroRings = 0;
            for (IAtomContainer ring : rset.atomContainers()) {
                int prevNumHeteroAtoms = numHeteroAtoms;
                for (IAtom atom : ring.atoms()) {
                    Integer elem = atom.getAtomicNumber();
                    if (elem != null && elem != 6 && elem != 1)
                        numHeteroAtoms++;
                }
                if (numHeteroAtoms > prevNumHeteroAtoms)
                    numHeteroRings++;
            }
            rset.setProperty(NUM_HETERO_ATOMS, numHeteroAtoms);
            rset.setProperty(NUM_HETERO_RINGS, numHeteroRings);
        }
    }
94323
def update_counts(self, current):
        
        for item in current:
            try:
                self.counts[item] += 1
            except KeyError:
                self.counts[item] = 1
708307
def count_by_value_impl(sequence):
    
    counter = collections.Counter()
    for e in sequence:
        counter[e] += 1
    return six.viewitems(counter)