Return first document from :meth:`query`, with same parameters.
341349
def query_one(self, *args, **kwargs):
        
        for r in self.query(*args, **kwargs):
            return r
        return None
254252
def get_documents(self):
        
        return self.session.query(Document).order_by(Document.name).all()
842449
def search_result_document(search_params)
        _, document_list = search_results(search_params)
        return document_list.first unless document_list.empty?
        document_not_found!
      end
871342
def first(self, x):
        """"""

        def _find(x):
            try:
                return self.all.index(str(x))
            except ValueError:
                return None

        if _is_collection(x):
            for item in x:
                found = _find(item)
                if found is not None:
                    return found
            return None
        else:
            return _find(x)
435460
def first(count = 1)
      query = OData::Query.new(self).limit(count)
      result = service.execute(query)
      entities = service.find_entities(result)
      res = count == 1 ? single_entity_from_xml(entities) : multiple_entities_from_xml(entities)
      res
    end
491757
def get_first_rec(fastafile):
    
    f = list(SeqIO.parse(fastafile, "fasta"))

    if len(f) > 1:
        logging.debug("{0} records found in {1}, using the first one".
                      format(len(f), fastafile))

    return f[0]
669386
def popfirst(self):
        """"""

        with self.lock:

            try:
                tup = self.data.popleft()
            except IndexError as ex:
                ex.args = ('DEPQ is already empty',)
                raise

            self_items = self.items

            try:
                self_items[tup[0]] -= 1
                if self_items[tup[0]] == 0:
                    del self_items[tup[0]]
            except TypeError:
                r = repr(tup[0])
                self_items[r] -= 1
                if self_items[r] == 0:
                    del self_items[r]

            return tup
271269
def get_term(self, term, value=False):
        """"""
        return self.doc.find_first(term, value=value, section=self.name)
132320
def search_first(self, *criterion, **kwargs):
        
        query = self._query(*criterion)
        query = self._order_by(query, **kwargs)
        query = self._filter(query, **kwargs)
        # NB: pagination must go last
        query = self._paginate(query, **kwargs)
        return query.first()
836833
def all_documents(index=INDEX_NAME):
    
    query = {
        'query': {
            'match_all': {}
        }
    }
    for result in raw_query(query, index=index):
        yield result
1217819
def first(self):
        """"""
        # we need to create a new object to insure we don't corrupt the generator count
        csvsource = CSVSource(self.source, self.factory, self.key())
        try:
            item = csvsource.items().next()
            return item
        except StopIteration:
            return None
777826
def getFirstUrn(self, reference=None):
        
        if reference is not None:
            if ":" in reference:
                urn = reference
            else:
                urn = "{}:{}".format(
                    str(URN(str(self.urn)).upTo(URN.NO_PASSAGE)),
                    str(reference)
                )
        else:
            urn = str(self.urn)
        _first = _SharedMethod.firstUrn(
            self.retriever.getFirstUrn(
                urn
            )
        )
        return _first
1031300
def one(self, command, params=None):
        
        dr = self.query(command, params)
        if dr['rows']:
            return dr['rows'][0]
        else:
            return None
367322
def fetchFirstExample(self, exampleDict, rawResults = False) :
        """"""
        return self.simpleQuery('first-example', rawResults = rawResults, example = exampleDict)
1006174
def get_first_field_values_as_list(self, field):
        '''
        
        '''
        for doc in self.docs:
            if field in doc.keys():
                return doc[field]
        raise SolrResponseError("No field in result set")
1123319
def query(self, query=None):
        
        if query is None:
            return self.url.query
        self.url.query = query
758727
def basic_query(returns):
    """"""
    return compose(
        reusable,
        map_send(parse_request),
        map_yield(prepare_params, snug.prefix_adder(API_PREFIX)),
        map_return(loads(returns)),
        oneyield,
    )