Functions
suggest_closest
4
list[str]
▼
Return closest matching names for typo suggestions.
Uses difflib.get_close_mat…
suggest_closest
4
list[str]
▼
def suggest_closest(name: str, candidates: Iterable[str], *, limit: int = 3, cutoff: float = 0.6) -> list[str]
Return closest matching names for typo suggestions.
Uses difflib.get_close_matches with configurable cutoff.
Returns up tolimitmatches, or empty list if none close enough.
Parameters
| Name | Type | Description |
|---|---|---|
name |
str |
The unknown name (e.g. filter name, variable name) |
candidates |
Iterable[str] |
Valid names to match against (e.g. env._filters.keys()) |
limit |
int |
Max number of suggestions to return Default:3
|
cutoff |
float |
Similarity threshold (0.0-1.0). 0.6 is reasonable for typos. Default:0.6
|
Returns
list[str]