16 from functools
import partial
29 msg =
"Variable '%s' not found." % name
31 normalizer = partial(normalize, ignore=
'$@%&*{}_', caseless=
True,
34 recommendations = finder.find_recommendations(name, candidates)
35 msg = finder.format_recommendations(msg, recommendations)
40 template =
'%s{%s}' if deco_braces
else '%s%s'
41 is_included = {
'$':
lambda value:
True,
44 '%':
lambda value:
True}[identifier]
45 return [template % (identifier, name)
46 for name
in candidates
if is_included(candidates[name])]
Used when no keyword is found or there is more than one match.
def variable_not_found(name, candidates, msg=None, deco_braces=True)
Raise DataError for missing variable name.
def _decorate_candidates(identifier, candidates, deco_braces=True)