Performs the same action as :meth:`search` but asserts a single result.

        :return:

        :raises SearchNoneFoundError: if nothing was found
        :raises SearchMultipleFoundError: if more than one result is found
540285
def find(self, *args, **kwargs):
        
        result = self.search(*args, **kwargs)

        if len(result) == 0:
            raise SearchNoneFoundError("nothing found")
        elif len(result) > 1:
            raise SearchMultipleFoundError("more than one result found")

        return result[0]
674698
def searchbyno(self, no):
        
        pattern = re.compile(str(no))
        result = {}
        for i in self.__allstockno:
            query = re.search(pattern, str(i))
            if query:
                query.group()
                result[i] = self.__allstockno[i]
        return result
1052026
def exists(self):
        
        return self.rpc_model.search_count(
            self.domain, context=self.context
        ) > 0
419670
def find_one(self, *args, **kwargs):
        
        if not self.exists:
            return None

        kwargs['_limit'] = 1
        kwargs['_step'] = None
        resiter = self.find(*args, **kwargs)
        try:
            for row in resiter:
                return row
        finally:
            resiter.close()
1370234
def action_parse_results(result):
    
    passed = True
    for test, result in result.items():
        if result['success']:
            hookenv.action_set({test: 'PASS'})
        else:
            hookenv.action_set({test: 'FAIL - {}'.format(result['message'])})
            passed = False
    if not passed:
        hookenv.action_fail("One or more tests failed")
    return 0 if passed else 1
1306982
async def queryone(self, stmt, *args):
        
        results = await self.query(stmt, *args)
        if len(results) == 0:
            raise NoResultError()
        elif len(results) > 1:
            raise ValueError("Expected 1 result, got %d" % len(results))
        return results[0]
1366924
def _merge_search_result(self, search_results, _or=False):
        
        all_docids = reduce(add, [list(x.keys()) for x in search_results])
        if _or:
            return sorted(set(all_docids), key=all_docids.index)
        return [docid for docid in set(all_docids) if all_docids.count(docid) > 1]
1090989
def search(self, regex, flags=0):
        
        return self._generate_test(
            lambda value: re.search(regex, value, flags),
            ('search', self._path, regex)
        )
420512
def search(self, q):
        
        results = self._api.search(q=q)

        return results
784955
def find(self, **kwargs):
        
        matches = self.findall(**kwargs)
        num_matches = len(matches)
        if not num_matches:
            msg = "No %s matching: %s." % (self.resource_class.__name__, kwargs)
            raise exc.NotFound(404, msg)
        if num_matches > 1:
            msg = "More than one %s matching: %s." % (
                    self.resource_class.__name__, kwargs)
            raise exc.NoUniqueMatch(400, msg)
        else:
            return matches[0]
1083375
def get(self, **kwargs):
        
        results = self.search(**kwargs)
        # If there are multiple matches, prefer exact matches on api_version
        if len(results) > 1 and kwargs.get('api_version'):
            results = [
                result for result in results if result.group_version == kwargs['api_version']
            ]
        # If there are multiple matches, prefer non-List kinds
        if len(results) > 1 and not all([isinstance(x, ResourceList) for x in results]):
            results = [result for result in results if not isinstance(result, ResourceList)]
        if len(results) == 1:
            return results[0]
        elif not results:
            raise ResourceNotFoundError('No matches found for {}'.format(kwargs))
        else:
            raise ResourceNotUniqueError('Multiple matches found for {}: {}'.format(kwargs, results))
392820
def results(self, *args, **kwargs):
        
        def worker():
            kwargs['page'] = 1
            while True:
                response = self.client(*args, **kwargs)
                if isinstance(response, list):
                    yield response
                    break
                elif _is_page(response):
                    yield response['results']
                    if response['next']:
                        kwargs['page'] += 1
                    else:
                        break
                else:
                    raise NoResultsError(response)

        return itertools.chain.from_iterable(worker())
1091255
def search(self, query, limit=None):
        
        return self._limit_get('search', params=dict(q=query), limit=limit)
153667
def search(query, num_results=10):
	
	data = download(query, num_results)
	results = re.findall(r'\<h3.*?\>.*?\<\/h3\>', data, re.IGNORECASE)
	if results is None or len(results) == 0:
		print('No results where found. Did the rate limit exceed?')
		return []
	# search has results
	links = []
	for r in results:
		mtch = re.match(r'.*?a\s*?href=\"(.*?)\".*?\>(.*?)\<\/a\>.*$', r, flags=re.IGNORECASE)
		if mtch is None:
			continue
		# parse url
		url = mtch.group(1)
		# clean url https://github.com/aviaryan/pythons/blob/master/Others/GoogleSearchLinks.py
		url = re.sub(r'^.*?=', '', url, count=1) # prefixed over urls \url=q?
		url = re.sub(r'\&amp.*$', '', url, count=1) # suffixed google things
		url = unquote(url)
		# url = re.sub(r'\%.*$', '', url) # NOT SAFE, causes issues with Youtube watch url
		# parse name
		name = prune_html(mtch.group(2))
		name = convert_unicode(name)
		# append to links
		if is_url(url): # can be google images result
			links.append((name, url))
	return links
398986
def _search_generator(self, item: Any, reverse: bool = False) -> Generator[Any, None, None]:
        """"""
        results = 0
        for _, x in self.enumerate(item, reverse=reverse):
            yield x
            results += 1
        if results == 0:
            raise SearchError(str(item))
799773
def search(self,
               id_list: List,
               negated_classes: List,
               limit: Optional[int],
               method: Optional) -> List[SimResult]:
        
        raise NotImplementedError
904389
def _raiseFindFailed(self, pattern):
        
        event = FindFailedEvent(self, pattern=pattern, event_type="FINDFAILED")

        if self._findFailedHandler is not None:
            self._findFailedHandler(event)
        response = (event._response or self._findFailedResponse)
        if response == "PROMPT":
            response = _findFailedPrompt(pattern)

        if response == "ABORT":
            raise FindFailed(event)
        elif response == "SKIP":
            return False
        elif response == "RETRY":
            return True