Bugfix: show recommendations only if available

This commit is contained in:
Lukas Klass 2020-05-11 10:37:23 +02:00
parent d4f28b55d8
commit f26a721704

View File

@ -106,9 +106,13 @@ class Entry(object):
if type(attr) != str:
return "Expected parameter '" + name + "' to be of type string."
if attr not in choices:
match = difflib.get_close_matches(attr, choices, 1)
if len(match) > 0:
# noinspection PyTypeChecker
return "Value '" + attr + "' not allowed for parameter '" + name + "'. Did you mean '" +\
difflib.get_close_matches(attr, choices, 1)[0] + "'?"
match[0] + "'?"
else:
return "Value '" + attr + "' not allowed for parameter '" + name + "'."
return None
def check_file(self, name) -> Union[None, str]: