File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
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
3029from _weakref import proxy as _proxy
3130from itertools import repeat as _repeat , chain as _chain , starmap as _starmap
3231from reprlib import recursive_repr as _recursive_repr
@@ -557,7 +556,8 @@ def most_common(self, n=None):
557556 # Emulate Bag.sortedByCount from Smalltalk
558557 if n is None :
559558 return sorted (self .items (), key = _itemgetter (1 ), reverse = True )
560- return _heapq .nlargest (n , self .items (), key = _itemgetter (1 ))
559+ import heapq
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.
Original file line number Diff line number Diff line change 1919 pass
2020from abc import get_cache_token
2121from collections import namedtuple
22- from types import MappingProxyType
23- from weakref import WeakKeyDictionary
2422from reprlib import recursive_repr
2523from _thread import RLock
2624
@@ -753,8 +751,10 @@ def singledispatch(func):
753751 function acts as the default implementation, and additional
754752 implementations can be registered using the register() attribute of the
755753 generic function.
756-
757754 """
755+ from types import MappingProxyType
756+ from weakref import WeakKeyDictionary
757+
758758 registry = {}
759759 dispatch_cache = WeakKeyDictionary ()
760760 cache_token = None
You can’t perform that action at this time.
0 commit comments