Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d69d1a

Browse files
authored
bisect: update for py310 (#5282)
1 parent 26f3748 commit 2d69d1a

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

stdlib/_bisect.pyi

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1-
from typing import MutableSequence, Optional, Sequence, TypeVar
1+
import sys
2+
from _typeshed import SupportsLessThan
3+
from typing import Callable, MutableSequence, Optional, Sequence, TypeVar
24

35
_T = TypeVar("_T")
46

5-
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
6-
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
7-
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
8-
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
7+
if sys.version_info >= (3, 10):
8+
def bisect_left(
9+
a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ..., *, key: Optional[Callable[[_T], SupportsLessThan]] = ...
10+
) -> int: ...
11+
def bisect_right(
12+
a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ..., *, key: Optional[Callable[[_T], SupportsLessThan]] = ...
13+
) -> int: ...
14+
def insort_left(
15+
a: MutableSequence[_T],
16+
x: _T,
17+
lo: int = ...,
18+
hi: Optional[int] = ...,
19+
*,
20+
key: Optional[Callable[[_T], SupportsLessThan]] = ...,
21+
) -> None: ...
22+
def insort_right(
23+
a: MutableSequence[_T],
24+
x: _T,
25+
lo: int = ...,
26+
hi: Optional[int] = ...,
27+
*,
28+
key: Optional[Callable[[_T], SupportsLessThan]] = ...,
29+
) -> None: ...
30+
31+
else:
32+
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
33+
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> int: ...
34+
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...
35+
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: Optional[int] = ...) -> None: ...

0 commit comments

Comments
 (0)