File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Original file line number Diff line number Diff line change 1838
1838
Traceback (most recent call last):
1839
1839
SyntaxError: invalid syntax. Did you mean 'for'?
1840
1840
1841
+
1842
+ >>> for x im n:
1843
+ ... pass
1844
+ Traceback (most recent call last):
1845
+ SyntaxError: invalid syntax. Did you mean 'in'?
1846
+
1841
1847
>>> f(a=23, a=234)
1842
1848
Traceback (most recent call last):
1843
1849
...
Original file line number Diff line number Diff line change @@ -1339,10 +1339,14 @@ def _find_keyword_typos(self):
1339
1339
if tokens_left_to_process < 0 :
1340
1340
break
1341
1341
# Limit the number of possible matches to try
1342
- matches = difflib .get_close_matches (wrong_name , keyword .kwlist , n = 3 )
1343
- if not matches and _suggestions is not None :
1342
+ max_matches = 3
1343
+ matches = []
1344
+ if _suggestions is not None :
1344
1345
suggestion = _suggestions ._generate_suggestions (keyword .kwlist , wrong_name )
1345
- matches = [suggestion ] if suggestion is not None else matches
1346
+ if suggestion :
1347
+ matches .append (suggestion )
1348
+ matches .extend (difflib .get_close_matches (wrong_name , keyword .kwlist , n = max_matches , cutoff = 0.5 ))
1349
+ matches = matches [:max_matches ]
1346
1350
for suggestion in matches :
1347
1351
if not suggestion or suggestion == wrong_name :
1348
1352
continue
You can’t perform that action at this time.
0 commit comments