File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change 3232_sys .modules ['collections.abc' ] = _collections_abc
3333abc = _collections_abc
3434
35+ lazy from copy import copy as _copy
36+ lazy from heapq import nlargest as _nlargest
3537from itertools import chain as _chain
3638from itertools import repeat as _repeat
3739from itertools import starmap as _starmap
5961except ImportError :
6062 pass
6163
62- heapq = None # Lazily imported
63-
6464
6565################################################################################
6666### OrderedDict
@@ -634,12 +634,7 @@ def most_common(self, n=None):
634634 if n is None :
635635 return sorted (self .items (), key = _itemgetter (1 ), reverse = True )
636636
637- # Lazy import to speedup Python startup time
638- global heapq
639- if heapq is None :
640- import heapq
641-
642- return heapq .nlargest (n , self .items (), key = _itemgetter (1 ))
637+ return _nlargest (n , self .items (), key = _itemgetter (1 ))
643638
644639 def elements (self ):
645640 '''Iterator over elements repeating each as many times as its count.
@@ -1249,11 +1244,10 @@ def __copy__(self):
12491244 def copy (self ):
12501245 if self .__class__ is UserDict :
12511246 return UserDict (self .data .copy ())
1252- import copy
12531247 data = self .data
12541248 try :
12551249 self .data = {}
1256- c = copy . copy (self )
1250+ c = _copy (self )
12571251 finally :
12581252 self .data = data
12591253 c .update (self )
You can’t perform that action at this time.
0 commit comments