Return the list of list of candidates from this document based on the split.
488808
def get_cands_list_from_split(session, candidate_classes, doc, split):
    """"""
    cands = []
    if split == ALL_SPLITS:
        # Get cands from all splits
        for candidate_class in candidate_classes:
            cands.append(
                session.query(candidate_class)
                .filter(candidate_class.document_id == doc.id)
                .all()
            )
    else:
        # Get cands from the specified split
        for candidate_class in candidate_classes:
            cands.append(
                session.query(candidate_class)
                .filter(candidate_class.document_id == doc.id)
                .filter(candidate_class.split == split)
                .all()
            )
    return cands
920345
def _get_candidates(self, all_rules):
        
        candidates = []
        for rule in all_rules:
            if rule.ever_matched() and rule.time_to_report():
                candidates.append(rule)
        return candidates
1086773
def apply(self, doc, split, train, **kwargs):
        
        logger.debug(f"Document: {doc}")

        # Get all the candidates in this doc that will be featurized
        cands_list = get_cands_list_from_split(
            self.session, self.candidate_classes, doc, split
        )

        feature_map = dict()

        # Make a flat list of all candidates from the list of list of
        # candidates. This helps reduce the number of queries needed to update.
        all_cands = itertools.chain.from_iterable(cands_list)
        records = list(
            get_mapping(self.session, Feature, all_cands, get_all_feats, feature_map)
        )
        batch_upsert_records(self.session, Feature, records)

        # Insert all Feature Keys
        if train:
            upsert_keys(self.session, FeatureKey, feature_map)

        # This return + yield makes a completely empty generator
        return
        yield
1078339
def _get_candidates(self):
        
        candidates = np.where(self.dpp_vector == 0)
        return None if len(candidates[0]) == 0 else candidates[0]
1320038
def get_selected_values(self, selection):
        """"""
        return [v for b, v in self._choices if b & selection]
771365
def getlist(self, section, option, raw=False, vars=None, fallback=[], delimiters=','):
        
        v = self.get(section, option, raw=raw, vars=vars, fallback=fallback)
        return self._convert_to_list(v, delimiters=delimiters)
38042
def _get_documents(self):
        """"""
        documents = self.tree.execute("$.documents")
        for doc in documents:
            sentences = {s['@id']: s['text'] for s in doc.get('sentences', [])}
            self.document_dict[doc['@id']] = {'sentences': sentences,
                                              'location': doc['location']}
490934
def split_list(alist, wanted_parts=1):
    
    length = len(alist)
    return [
        alist[i * length // wanted_parts:(i + 1) * length // wanted_parts]
        for i in range(wanted_parts)
    ]
1256165
def _parse_multi_options(options, split_token=','):
    
    """
    if options:
        return [o.strip() for o in options.split(split_token) if o.strip()]
    else:
        return options
796234
def get_candidates(rules)
      candidates = []
      rules.each { |rule| candidates << rule if rule.ever_matched? && rule.time_to_report? }
      candidates
    end
582771
private Map<Integer, List<Annotation>> splitListAnnotations()
  {
    List<Annotation> metadata = Helper.getMetaData(toplevelCorpusName,
      documentName);

    Map<Integer, List<Annotation>> hashMetaData = new HashMap<>();


    if (metadata != null && !metadata.isEmpty())
    {
      // if called from corpus browser sort the other way around.
      if (documentName != null)
      {
        hashMetaData =
          new TreeMap<>(Collections.reverseOrder());
      }
      else
      {
        hashMetaData = new TreeMap<>();
      }

      for (Annotation metaDatum : metadata)
      {
        int pre = metaDatum.getPre();
        if (!hashMetaData.containsKey(pre))
        {
          hashMetaData.put(pre, new ArrayList<Annotation>());
          hashMetaData.get(pre).add(metaDatum);
        }
        else
        {
          hashMetaData.get(pre).add(metaDatum);
        }
      }
    }

    return hashMetaData;
  }
497903
def list(self, search_opts=None, limit=None,
             marker=None, sort_by=None, reverse=None):
        """"""
        query = base.get_query_string(search_opts, limit=limit, marker=marker,
                                      sort_by=sort_by, reverse=reverse)
        url = "/jobs%s" % query
        return self._page(url, 'jobs', limit)
1295735
def candidates(self):
        """"""
        dom = self.dom
        if dom is None or len(dom) == 0:
            return None

        candidates, unlikely_candidates = find_candidates(dom)
        drop_nodes_with_parents(unlikely_candidates)

        return candidates
356318
def find_candidate_metadata_files(names):
        """"""
        tuples = [
            x.split('/') for x in map(try_decode, names)
            if 'METADATA' in x
        ]
        return [x[1] for x in sorted([(len(x), x) for x in tuples])]
1072364
def get_list_from_file(file_name):
    """"""
    with open(file_name, mode='r', encoding='utf-8') as f1:
        lst = f1.readlines()
    return lst
750568
def candidates(self):
        """"""
        # convert x['location'] to a point from a json point struct
        def cditer():
            for candidate in self._json_struct['candidates']:
                newcandidate = candidate.copy()
                newcandidate['location'] = \
                    geometry.fromJson(newcandidate['location'])
                yield newcandidate
        return list(cditer())
138006
def _optlist(self):
    """"""
    res = ""
    for o in self.options:
        res += o.short
        if o.argName is not None:
          res += ":"
    return res