From 26566af893c1a099cb1bd0937efba96efde98814 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Sun, 17 May 2020 08:52:37 -0700 Subject: [PATCH] bisect: fix availability, consistency, reduce duplication (#4028) Co-authored-by: hauntsaninja <> --- stdlib/2and3/_bisect.pyi | 2 -- stdlib/2and3/bisect.pyi | 15 +++------------ tests/stubtest_whitelists/py37.txt | 2 -- tests/stubtest_whitelists/py38.txt | 2 -- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/stdlib/2and3/_bisect.pyi b/stdlib/2and3/_bisect.pyi index 38e7a7b37..4237e0508 100644 --- a/stdlib/2and3/_bisect.pyi +++ b/stdlib/2and3/_bisect.pyi @@ -3,9 +3,7 @@ from typing import Sequence, MutableSequence, TypeVar _T = TypeVar('_T') -def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... -def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ... def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ... def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ... diff --git a/stdlib/2and3/bisect.pyi b/stdlib/2and3/bisect.pyi index c3075297c..67cf11dd2 100644 --- a/stdlib/2and3/bisect.pyi +++ b/stdlib/2and3/bisect.pyi @@ -1,13 +1,4 @@ # Stubs for bisect - -from typing import Any, Sequence, MutableSequence, TypeVar - -_T = TypeVar('_T') - -def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... -def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... -def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... - -def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... -def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... -def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... +from _bisect import * +bisect = bisect_right +insort = insort_right diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index ecec683e8..2e796baad 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -1,5 +1,3 @@ -_bisect.bisect -_bisect.insort _tracemalloc._get_object_traceback _tracemalloc.start asyncio.AbstractEventLoop.sock_sendfile diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index d7141a7f0..bc2b50877 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -1,5 +1,3 @@ -_bisect.bisect -_bisect.insort _thread.ExceptHookArgs _thread._ExceptHookArgs _tracemalloc._get_object_traceback