1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

#N/A: remove n from the list of get_closest's args

This commit is contained in:
Pablo Santiago Blum de Aguiar 2018-09-30 20:44:06 +02:00
parent 5ae637ca34
commit 01c015b5be
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ def _get_formulas():
def _get_similar_formula(formula_name):
return get_closest(formula_name, _get_formulas(), 1, 0.85)
return get_closest(formula_name, _get_formulas(), cutoff=0.85)
def match(command):

View File

@ -86,11 +86,11 @@ def default_settings(params):
return decorator(_default_settings)
def get_closest(word, possibilities, n=3, cutoff=0.6, fallback_to_first=True):
def get_closest(word, possibilities, cutoff=0.6, fallback_to_first=True):
"""Returns closest match or just first from possibilities."""
possibilities = list(possibilities)
try:
return difflib_get_close_matches(word, possibilities, n, cutoff)[0]
return difflib_get_close_matches(word, possibilities, 1, cutoff)[0]
except IndexError:
if fallback_to_first:
return possibilities[0]