Exemplo n.º 1
0
 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']
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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