File tree 1 file changed +12
-10
lines changed
lib/mysql/connector/fabric
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 36
36
_CACHE_TTL = 1 * 60 # 1 minute
37
37
38
38
39
- def insort_right_rev (a , x , lo = 0 , hi = None ):
39
+ def insort_right_rev (alist , new_element , low = 0 , high = None ):
40
40
"""Similar to bisect.insort_right but for reverse sorted lists
41
41
42
42
This code is similar to the Python code found in Lib/bisect.py.
43
43
We simply change the comparison from 'less than' to 'greater than'.
44
44
"""
45
45
46
- if lo < 0 :
47
- raise ValueError ('lo must be non-negative' )
48
- if hi is None :
49
- hi = len (a )
50
- while lo < hi :
51
- mid = (lo + hi )// 2
52
- if x > a [mid ]: hi = mid
53
- else : lo = mid + 1
54
- a .insert (lo , x )
46
+ if low < 0 :
47
+ raise ValueError ('low must be non-negative' )
48
+ if high is None :
49
+ high = len (alist )
50
+ while low < high :
51
+ middle = (low + high ) // 2
52
+ if new_element > alist [middle ]:
53
+ high = middle
54
+ else :
55
+ low = middle + 1
56
+ alist .insert (low , new_element )
55
57
56
58
57
59
class CacheEntry (object ):
You can’t perform that action at this time.
0 commit comments