def filter(self, context): if context['input'] == '': return context['candidates'] pattern = context['input'] if context['ignorecase']: pattern = pattern.lower() p = re.compile(escape_fuzzy(re.escape(pattern), True)) if context['ignorecase']: context['candidates'] = [x for x in context['candidates'] if p.search(x['word'].lower())] else: context['candidates'] = [x for x in context['candidates'] if p.search(x['word'])] return context['candidates']
def filter(self, context): if context['input'] == '': return context['candidates'] candidates = context['candidates'] for pattern in split_input(context['input']): if context['ignorecase']: pattern = pattern.lower() p = re.compile(escape_fuzzy(pattern, True)) if context['ignorecase']: candidates = [ x for x in candidates if p.search(x['word'].lower()) ] else: candidates = [x for x in candidates if p.search(x['word'])] return candidates
def filter(self, context): if context['input'] == '': return context['candidates'] candidates = context['candidates'] max = context['max_candidate_width'] for pattern in split_input(context['input']): if context['ignorecase']: pattern = pattern.lower() p = re.compile(escape_fuzzy(re.escape(pattern), True)) if context['ignorecase']: candidates = [x for x in candidates if p.search(x['word'][:max].lower())] else: candidates = [x for x in candidates if p.search(x['word'][:max])] return candidates