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 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
30
29
from _weakref import proxy as _proxy
31
30
from itertools import repeat as _repeat , chain as _chain , starmap as _starmap
32
31
from reprlib import recursive_repr as _recursive_repr
@@ -557,7 +556,8 @@ def most_common(self, n=None):
557
556
# Emulate Bag.sortedByCount from Smalltalk
558
557
if n is None :
559
558
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 ))
561
561
562
562
def elements (self ):
563
563
'''Iterator over elements repeating each as many times as its count.
Original file line number Diff line number Diff line change 19
19
pass
20
20
from abc import get_cache_token
21
21
from collections import namedtuple
22
- from types import MappingProxyType
23
- from weakref import WeakKeyDictionary
24
22
from reprlib import recursive_repr
25
23
from _thread import RLock
26
24
@@ -753,8 +751,10 @@ def singledispatch(func):
753
751
function acts as the default implementation, and additional
754
752
implementations can be registered using the register() attribute of the
755
753
generic function.
756
-
757
754
"""
755
+ from types import MappingProxyType
756
+ from weakref import WeakKeyDictionary
757
+
758
758
registry = {}
759
759
dispatch_cache = WeakKeyDictionary ()
760
760
cache_token = None
You can’t perform that action at this time.
0 commit comments