File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -119,12 +119,12 @@ def did_you_mean(
119
119
word : Hashable , possibilities : Iterable [Hashable ], * , n : int = 10
120
120
) -> str :
121
121
"""
122
- Suggest a few correct words based on a list of possibilites
122
+ Suggest a few correct words based on a list of possibilities
123
123
124
124
Parameters
125
125
----------
126
126
word : Hashable
127
- Word to compare to a list of possibilites .
127
+ Word to compare to a list of possibilities .
128
128
possibilities : Iterable of Hashable
129
129
The iterable of Hashable that contains the correct values.
130
130
n : int, default: 10
@@ -142,15 +142,15 @@ def did_you_mean(
142
142
https://en.wikipedia.org/wiki/String_metric
143
143
"""
144
144
# Convert all values to string, get_close_matches doesn't handle all hashables:
145
- possibilites_str : dict [str , Hashable ] = {str (k ): k for k in possibilities }
145
+ possibilities_str : dict [str , Hashable ] = {str (k ): k for k in possibilities }
146
146
147
147
msg = ""
148
148
if len (
149
149
best_str := difflib .get_close_matches (
150
- str (word ), list (possibilites_str .keys ()), n = n
150
+ str (word ), list (possibilities_str .keys ()), n = n
151
151
)
152
152
):
153
- best = tuple (possibilites_str [k ] for k in best_str )
153
+ best = tuple (possibilities_str [k ] for k in best_str )
154
154
msg = f"Did you mean one of { best } ?"
155
155
156
156
return msg
You can’t perform that action at this time.
0 commit comments