Counts number of hunts results per type.
962960
def CountHuntResultsByType(self, hunt_id, cursor=None):
    """"""
    hunt_id_int = db_utils.HuntIDToInt(hunt_id)

    query = ("SELECT type, COUNT(*) FROM flow_results "
             "WHERE hunt_id = %s GROUP BY type")

    cursor.execute(query, [hunt_id_int])
    return dict(cursor.fetchall())
728755
def CountHuntFlows(self,
                     hunt_id,
                     filter_condition=db.HuntFlowsCondition.UNSET):
    """"""

    return len(
        self.ReadHuntFlows(
            hunt_id, 0, sys.maxsize, filter_condition=filter_condition))
139877
public SearchResponse searchAllWithTargetCount(String[] indices,
            String[] types) {
        return searchAllWithTargetCount(indices, types, null, null);
    }
793753
def count_error_types(graph: BELGraph) -> Counter:
    
    return Counter(
        exc.__class__.__name__
        for _, exc, _ in graph.warnings
    )
536182
def _getValueCounts(mapping):
    
    return Counter({k: len(v) for k, v in viewitems(mapping)})
1107119
def count(self, item):
        """"""
        try:
            return self.items.get(item, 0)
        except TypeError:
            return self.items.get(repr(item), 0)
356197
def count_of_certain_kind(kind):
        '''
        
        '''

        recs = TabPost.select().where(TabPost.kind == kind)

        return recs.count()
527902
def count(self, with_limit_and_skip=False):
        ''' 
        '''
        return self.__get_query_result().cursor.count(with_limit_and_skip=with_limit_and_skip)
1059466
public SearchResponse searchAllWithTargetCount(String index, String type,
            QueryBuilder filterQueryBuilder) {
        return searchAllWithTargetCount(index, type, filterQueryBuilder, null);
    }
267089
def _count_files_by_type(self, path, pattern, ignore=True):
        
        # Get all files matching the given path and pattern
        files = glob(os.path.join(path, pattern))
        # Count the files
        files = [ff for ff in files
                 if os.path.split(ff)[-1] not in self._IGNORE_FILES
                 or not ignore]
        num_files = len(files)
        return num_files
1077486
public Long getCount(String type) {
		MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
		params.putSingle(Config._TYPE, type);
		Pager pager = new Pager();
		getItems(find("count", params), pager);
		return pager.getCount();
	}
1313665
def CountFlowResultsByType(self, client_id, flow_id, cursor=None):
    """"""
    query = ("SELECT type, COUNT(*) FROM flow_results "
             "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) "
             "WHERE client_id = %s AND flow_id = %s "
             "GROUP BY type")
    args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)]

    cursor.execute(query, args)

    return dict(cursor.fetchall())
1115631
def _HandleLegacy(self, args, token=None):
    """"""
    hunt_obj = aff4.FACTORY.Open(
        args.hunt_id.ToURN(), aff4_type=implementation.GRRHunt, token=token)

    stats = hunt_obj.GetRunner().context.usage_stats

    return ApiGetHuntStatsResult(stats=stats)
364343
def CountFlowResultsByType(self, client_id, flow_id):
    """"""
    result = collections.Counter()
    for hr in self.ReadFlowResults(client_id, flow_id, 0, sys.maxsize):
      key = compatibility.GetName(hr.payload.__class__)
      result[key] += 1

    return result
731003
def total_hits(query, options = {})
      ferret_index.search(process_query(query, options), options).total_hits
    end
1227250
def get_counts(entities=None,
               object_category=None,
               min_count=1,
               **kwargs):
    
    if entities is None:
        entities = []
    results = search_associations(subjects=entities,
                                  subject_direct=True,
                                  rows=0,
                                  facet_fields=[M.IS_DEFINED_BY, M.SUBJECT_TAXON, M.SUBJECT_CATEGORY],
                                  object_category=object_category,
                                  facet_mincount=3, # TODO
                                  facet_limit=-1,
                                  json_facet={
                                      'categories':{
                                          'limit':-1,
                                          'type': 'terms',
                                          'field' : M.OBJECT_CLOSURE,
                                          'facet' : {
                                              'uniq_subject': "unique(subject)"
                                          }
                                      }
                                  },
                                  **kwargs)
    buckets = results['facets']['categories']['buckets']
    cmap = {}
    for bucket in buckets:
        if bucket['uniq_subject'] >= min_count:
            cmap[bucket['val']] = bucket['uniq_subject']
    return (cmap, results)
264552
def count_by_type(self,table,timesteps):
        """"""
        hbonds = defaultdict(int)
        for contact in table:
            #count by residue name not by proteinring
            pkey = (contact.donor_idx,contact.acceptor_idx,contact.donor_atom, contact.acceptor_atom,contact.donor_resnm,contact.donor_resid, contact.acceptor_resnm,contact.acceptor_resid)
            hbonds[pkey]+=1
        dtype = [("donor_idx",int),("acceptor_idx",int),("donor_atom","|U4"),("acceptor_atom","|U4"),("donor_resnm","|U8"),("donor_resid","|U8"),("acceptor_resnm","|U8"),("acceptor_resid","|U8"),("frequency",float) ]
        out = np.empty((len(hbonds),),dtype=dtype)
        tsteps = float(len(timesteps))
        for cursor,(key,count) in enumerate(hbonds.iteritems()):
            out[cursor] = key + (count / tsteps,)
        return out.view(np.recarray)