File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 26
26
from operator import itemgetter as _itemgetter , eq as _eq
27
27
from keyword import iskeyword as _iskeyword
28
28
import sys as _sys
29
+ import heapq as _heapq
29
30
from _weakref import proxy as _proxy
30
31
from itertools import repeat as _repeat , chain as _chain , starmap as _starmap
31
32
from reprlib import recursive_repr as _recursive_repr
@@ -556,8 +557,7 @@ def most_common(self, n=None):
556
557
# Emulate Bag.sortedByCount from Smalltalk
557
558
if n is None :
558
559
return sorted (self .items (), key = _itemgetter (1 ), reverse = True )
559
- import heapq
560
- return heapq .nlargest (n , self .items (), key = _itemgetter (1 ))
560
+ return _heapq .nlargest (n , self .items (), key = _itemgetter (1 ))
561
561
562
562
def elements (self ):
563
563
'''Iterator over elements repeating each as many times as its count.
You can’t perform that action at this time.
0 commit comments