Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae39fbd

Browse files
committed
Make the import private to keep the global namespace clean.
1 parent f25a38e commit ae39fbd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/difflib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'context_diff',
3131
'unified_diff', 'HtmlDiff', 'Match']
3232

33-
import heapq
33+
from heapq import nlargest as _nlargest
3434
from collections import namedtuple as _namedtuple
3535

3636
Match = _namedtuple('Match', 'a b size')
@@ -729,7 +729,7 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
729729
result.append((s.ratio(), x))
730730

731731
# Move the best scorers to head of list
732-
result = heapq.nlargest(n, result)
732+
result = _nlargest(n, result)
733733
# Strip scores for the best n matches
734734
return [x for score, x in result]
735735

0 commit comments

Comments
 (0)