Example #1
0
def get_best_candidate(task_name, known_task_names, max_dist=5):
    weighted_tasks = [(get_editdistance(str(task_name),
                                        known_task_name), known_task_name)
                      for known_task_name in known_task_names]
    ordered_tasks = sorted(weighted_tasks, key=lambda pair: pair[0])
    return [
        task for (dist, task) in ordered_tasks
        if dist <= max_dist and dist < len(task)
    ]
Example #2
0
 def test_get_editdistance(self):
     assert get_editdistance("dbnd_sanity_che", "dbnd_sanity_check") < 5