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 2626from  operator  import  itemgetter  as  _itemgetter , eq  as  _eq 
2727from  keyword  import  iskeyword  as  _iskeyword 
2828import  sys  as  _sys 
29+ import  heapq  as  _heapq 
2930from  _weakref  import  proxy  as  _proxy 
3031from  itertools  import  repeat  as  _repeat , chain  as  _chain , starmap  as  _starmap 
3132from  reprlib  import  recursive_repr  as  _recursive_repr 
@@ -556,8 +557,7 @@ def most_common(self, n=None):
556557        # Emulate Bag.sortedByCount from Smalltalk 
557558        if  n  is  None :
558559            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 ))
561561
562562    def  elements (self ):
563563        '''Iterator over elements repeating each as many times as its count. 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments