def _gather_source_candidates(self, context: UserContext, source: Source) -> Candidates: max_len = int(context['max_candidate_width'] * 1.2) candidates = source.gather_candidates(context) for candidate in [x for x in candidates if len(x['word']) > max_len]: candidate['word'] = candidate['word'][:max_len] return candidates
def _get_source_status(self, context: UserContext, source: Source, entire: Candidates, partial: Candidates) -> str: return (source.get_status(context) if not partial else f'{source.get_status(context)}' f'({len(partial)}/{len(entire)})')