Search for a reader based on saga type.
488470
private Collection<KeyReader> findReader(final Class<? extends Saga> sagaClazz, final Class<?> messageClazz) {
        Saga saga = sagaProviderFactory.createProvider(sagaClazz).get();
        Collection<KeyReader> readers = saga.keyReaders();
        if (readers == null) {
            // return empty list in case saga returns null for any reason
            readers = new ArrayList<>();
        }

        return readers;
    }
53576
def getReaderNames(self):
        """"""

        # get inserted readers
        hresult, pcscreaders = SCardListReaders(self.hcontext, [])
        if 0 != hresult and SCARD_E_NO_READERS_AVAILABLE != hresult:
            raise ListReadersException(hresult)

        readers = []

        # if no readers asked, use all inserted readers
        if None == self.readersAsked:
            readers = pcscreaders

        # otherwise use only the asked readers that are inserted
        else:
            for reader in self.readersAsked:
                if not isinstance(reader, type("")):
                    reader = str(reader)
                if reader in pcscreaders:
                    readers = readers + [reader]

        return readers
693879
def build_author_inclusion_filter(authors: Strings) -> EdgePredicate:
    """"""
    if isinstance(authors, str):
        @edge_predicate
        def author_filter(edge_data: EdgeData) -> bool:
            """Pass for edges with citations with an author that matches the contained author."""
            return has_authors(edge_data) and authors in edge_data[CITATION][CITATION_AUTHORS]

    elif isinstance(authors, Iterable):
        authors = set(authors)

        @edge_predicate
        def author_filter(edge_data: EdgeData) -> bool:
            """Pass for edges with citations with an author that matches one or more of the contained authors."""
            return has_authors(edge_data) and any(
                author in edge_data[CITATION][CITATION_AUTHORS]
                for author in authors
            )

    else:
        raise TypeError

    return author_filter
1159885
def search(self):
        ""
        form = forms.HomeForm()
        bbm_filter = bs_filters.BookmarkBukuFilter(
            all_keywords=False, deep=form.deep.data, regex=form.regex.data)
        op_text = bbm_filter.operation()
        values_combi = sorted(itertools.product([True, False], repeat=3))
        for idx, (all_keywords, deep, regex) in enumerate(values_combi):
            if deep == form.deep.data and regex == form.regex.data and not all_keywords:
                choosen_idx = idx
        url_op_text = op_text.replace(', ', '_').replace('  ', ' ').replace(' ', '_')
        key = ''.join(['flt', str(choosen_idx), '_buku_', url_op_text])
        kwargs = {key: form.keyword.data}
        url = url_for('bookmark.index_view', **kwargs)
        return redirect(url)
158859
def search(ont, searchterm):
    
    namedGraph = get_named_graph(ont)
    query = """
    SELECT ?c ?l WHERE {{
    GRAPH <{g}>  {{
    ?c rdfs:label ?l
    FILTER regex(?l,'{s}','i')
    }}
    }}
    """.format(s=searchterm, g=namedGraph)
    bindings = run_sparql(query)
    return [(r['c']['value'],r['l']['value']) for r in bindings]
424969
public static SagaType continueSaga(final Class<? extends Saga> sagaClass) {
        checkNotNull(sagaClass, "The type of the saga has to be defined.");

        SagaType sagaType = new SagaType();
        sagaType.startsNew = false;
        sagaType.sagaClass = sagaClass;

        return sagaType;
    }
1272056
def search(self, query, fields=None, page=1, max_records=None, flatten=True):
        """"""
        if fields is None:
            fields = []
        page = int(page)
        pages = float('inf')
        data = {
            "query": query,
            "page": page,
            "fields": fields,
            "flatten": flatten
        }

        count = 0
        while page <= pages:
            payload = self._post(self.search_path, data=data)
            pages = payload['metadata']['pages']
            page += 1
            data["page"] = page

            for result in payload["results"]:
                yield result
                count += 1
                if max_records and count >= max_records:
                    return
967102
def look_for_books(citation_elements, kbs):
    
    title = None
    for el in citation_elements:
        if el['type'] == 'QUOTED':
            title = el
            break

    if title:
        normalized_title = title['title'].upper()
        if normalized_title in kbs['books']:
            line = kbs['books'][normalized_title]
            el = {'type': 'BOOK',
                  'misc_txt': '',
                  'authors': line[0],
                  'title': line[1],
                  'year': line[2].strip(';')}
            citation_elements.append(el)
            citation_elements.remove(title)

    return citation_elements
1207725
def search(self, query, delegate, args=None, extra_args=None):
        """"""
        if args is None:
            args = {}
        args['q'] = query
        return self.__doDownloadPage(self.search_url + '?' + self._urlencode(args),
            txml.Feed(delegate, extra_args), agent=self.agent)
256447
def search(self, query: 're.Pattern') -> 'Iterable[_WorkTitles]':
        """"""
        titles: 'Titles'
        for titles in self._titles_list:
            title: 'AnimeTitle'
            for title in titles.titles:
                if query.search(title.title):
                    yield WorkTitles(
                        aid=titles.aid,
                        main_title=_get_main_title(titles.titles),
                        titles=[t.title for t in titles.titles],
                    )
                    continue
984452
def runSearchReads(self, request):
        
        return self.runSearchRequest(
            request, protocol.SearchReadsRequest,
            protocol.SearchReadsResponse,
            self.readsGenerator)
1288499
def search(term, category=Categories.ALL, pages=1, sort=None, order=None):
	""""""
	s = Search()
	s.search(term=term, category=category, pages=pages, sort=sort, order=order)
	return s
1176857
def _find_record(self, domain, _type=None):
        """"""

        def _is_matching(record):
            """filter function for records"""

            if domain and record.get('domain', None) != domain:
                return False
            if _type and record.get('type', None) != _type:
                return False
            return True

        payload = self._get('/search?q={0}&type=record'.format(domain))
        for record in payload:
            if _is_matching(record):
                match = record
                break
        else:
            # no such domain on ns1
            return None

        record = self._get(
            '/zones/{0}/{1}/{2}'.format(match['zone'], match['domain'], match['type']))
        if record.get('message', None):
            return None  # {"message":"record not found"}
        short_answers = [x['answer'][0] for x in record['answers']]

        # ensure a compatibility level with self._list_records
        record['short_answers'] = short_answers
        return record
1102590
def page(self, i):
		""""""
		# Need to clear previous results.
		self.torrents = list()
		self._current_page = i
		self.search(term=self.term, category=self.category,
					sort=self.sort, order=self.order)
306116
function findParsableFile(book, filename) {
    var fs = book.getContentFS();
    var ext = path.extname(filename);
    var basename = path.basename(filename, ext);
    var basedir = path.dirname(filename);

    // Ordered list of extensions to test
    var exts = parsers.extensions;

    return Promise.some(exts, function(ext) {
        var filepath = basename + ext;

        return fs.findFile(basedir, filepath)
        .then(function(found) {
            if (!found || book.isContentFileIgnored(found)) {
                return undefined;
            }

            return fs.statFile(found);
        });
    });
}
1261895
def find(self, text):
        """"""
        for key, value in self:
            if (text in key) or (text in value):
                print(key, value)
84338
private Map<String, String> extractAbbrPairs(Reader r) {
        Map<String, String> candidates = new HashMap<String, String>();
        String str, tmpStr, longForm = "", shortForm = "";
        String currSentence = "";
        int openParenIndex, closeParenIndex = -1, sentenceEnd, newCloseParenIndex, tmpIndex = -1;
        boolean newParagraph = true;
        StringTokenizer shortTokenizer;

        try {

            BufferedReader fin = new BufferedReader(r);
            while ((str = fin.readLine()) != null) {
                if (str.length() == 0 || newParagraph && !Character.isUpperCase(str.charAt(0))) {
                    currSentence = "";
                    newParagraph = true;
                    continue;
                }
                newParagraph = false;
                str += " ";
                currSentence += str;
                openParenIndex = currSentence.indexOf(" (");
                do {
                    if (openParenIndex > -1) {
                        openParenIndex++;
                    }
                    sentenceEnd = Math.max(currSentence.lastIndexOf(". "), currSentence.lastIndexOf(", "));
                    if ((openParenIndex == -1) && (sentenceEnd == -1)) {
                        // Do nothing
                    } else if (openParenIndex == -1) {
                        currSentence = currSentence.substring(sentenceEnd + 2);
                    } else if ((closeParenIndex = currSentence.indexOf(')', openParenIndex)) > -1) {
                        sentenceEnd = Math.max(currSentence.lastIndexOf(". ", openParenIndex), currSentence.lastIndexOf(", ",
                                openParenIndex));
                        if (sentenceEnd == -1) {
                            sentenceEnd = -2;
                        }
                        longForm = currSentence.substring(sentenceEnd + 2, openParenIndex);
                        shortForm = currSentence.substring(openParenIndex + 1, closeParenIndex);
                    }
                    if (shortForm.length() > 0 || longForm.length() > 0) {
                        if (shortForm.length() > 1 && longForm.length() > 1) {
                            if ((shortForm.indexOf('(') > -1)
                                    && ((newCloseParenIndex = currSentence.indexOf(')', closeParenIndex + 1)) > -1)) {
                                shortForm = currSentence.substring(openParenIndex + 1, newCloseParenIndex);
                                closeParenIndex = newCloseParenIndex;
                            }
                            if ((tmpIndex = shortForm.indexOf(", ")) > -1) {
                                shortForm = shortForm.substring(0, tmpIndex);
                            }
                            if ((tmpIndex = shortForm.indexOf("; ")) > -1) {
                                shortForm = shortForm.substring(0, tmpIndex);
                            }
                            shortTokenizer = new StringTokenizer(shortForm);
                            if (shortTokenizer.countTokens() > 2 || shortForm.length() > longForm.length()) {
                                // Long form in ( )
                                tmpIndex = currSentence.lastIndexOf(" ", openParenIndex - 2);
                                tmpStr = currSentence.substring(tmpIndex + 1, openParenIndex - 1);
                                longForm = shortForm;
                                shortForm = tmpStr;
                                if (!hasCapital(shortForm)) {
                                    shortForm = "";
                                }
                            }
                            if (isValidShortForm(shortForm)) {
                                List<String> list = extractAbbrPair(shortForm.trim(), longForm.trim());
                                if (list.size() == 2) {
                                    candidates.put(list.get(0), list.get(1));
                                }
                            }
                        }
                        currSentence = currSentence.substring(closeParenIndex + 1);
                    } else if (openParenIndex > -1) {
                        if ((currSentence.length() - openParenIndex) > 200) {
                            // Matching close paren was not found
                            currSentence = currSentence.substring(openParenIndex + 1);
                        }
                        break; // Read next line
                    }
                    shortForm = "";
                    longForm = "";
                } while ((openParenIndex = currSentence.indexOf(" (")) > -1);
            }
            fin.close();
        } catch (Exception ioe) {
            ioe.printStackTrace();
            System.out.println(currSentence);
            System.out.println(tmpIndex);
        }
        return candidates;
    }