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:
parent
5ae637ca34
commit
01c015b5be
@ -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):
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user