basedpyright 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/typeshed-fallback/commit.txt +1 -1
- package/dist/typeshed-fallback/stdlib/VERSIONS +3 -1
- package/dist/typeshed-fallback/stdlib/_ast.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
- package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
- package/dist/typeshed-fallback/stdlib/_curses.pyi +1 -2
- package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
- package/dist/typeshed-fallback/stdlib/_interpchannels.pyi +84 -0
- package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/_tkinter.pyi +7 -0
- package/dist/typeshed-fallback/stdlib/_weakref.pyi +3 -2
- package/dist/typeshed-fallback/stdlib/argparse.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
- package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +56 -37
- package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +4 -1
- package/dist/typeshed-fallback/stdlib/asyncio/unix_events.pyi +156 -134
- package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +3 -2
- package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
- package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
- package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
- package/dist/typeshed-fallback/stdlib/dataclasses.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +2 -5
- package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
- package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -154
- package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +10 -6
- package/dist/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi +33 -12
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +10 -10
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +3 -13
- package/dist/typeshed-fallback/stdlib/spwd.pyi +9 -0
- package/dist/typeshed-fallback/stdlib/subprocess.pyi +8 -0
- package/dist/typeshed-fallback/stdlib/tarfile.pyi +23 -1
- package/dist/typeshed-fallback/stdlib/telnetlib.pyi +1 -0
- package/dist/typeshed-fallback/stdlib/typing.pyi +21 -2
- package/dist/typeshed-fallback/stdlib/weakref.pyi +4 -1
- package/dist/typeshed-fallback/stdlib/xml/sax/handler.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
- package/dist/typeshed-fallback/stubs/Flask-SocketIO/flask_socketio/__init__.pyi +4 -4
- package/dist/typeshed-fallback/stubs/aiofiles/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/aiofiles/aiofiles/base.pyi +6 -20
- package/dist/typeshed-fallback/stubs/aiofiles/aiofiles/os.pyi +2 -0
- package/dist/typeshed-fallback/stubs/aiofiles/aiofiles/ospath.pyi +5 -3
- package/dist/typeshed-fallback/stubs/aiofiles/aiofiles/tempfile/__init__.pyi +143 -79
- package/dist/typeshed-fallback/stubs/aiofiles/aiofiles/threadpool/__init__.pyi +5 -5
- package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +7 -1
- package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +8 -0
- package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +2 -2
- package/dist/typeshed-fallback/stubs/docker/docker/api/image.pyi +3 -2
- package/dist/typeshed-fallback/stubs/docker/docker/api/network.pyi +32 -15
- package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +36 -7
- package/dist/typeshed-fallback/stubs/docker/docker/models/images.pyi +67 -5
- package/dist/typeshed-fallback/stubs/docker/docker/models/networks.pyi +20 -3
- package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +78 -70
- package/dist/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi +4 -7
- package/dist/typeshed-fallback/stubs/flake8/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi +16 -5
- package/dist/typeshed-fallback/stubs/fpdf2/fpdf/image_datastructures.pyi +2 -1
- package/dist/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi +4 -2
- package/dist/typeshed-fallback/stubs/fpdf2/fpdf/text_region.pyi +7 -7
- package/dist/typeshed-fallback/stubs/hdbcli/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/hdbcli/hdbcli/dbapi.pyi +1 -0
- package/dist/typeshed-fallback/stubs/hvac/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/hvac/hvac/api/system_backend/raft.pyi +9 -0
- package/dist/typeshed-fallback/stubs/hvac/hvac/api/system_backend/wrapping.pyi +1 -0
- package/dist/typeshed-fallback/stubs/influxdb-client/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/_pages.pyi +37 -0
- package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/bucket_api.pyi +5 -1
- package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/tasks_api.pyi +4 -3
- package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/bucket.pyi +6 -6
- package/dist/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/task.pyi +6 -6
- package/dist/typeshed-fallback/stubs/networkx/METADATA.toml +3 -1
- package/dist/typeshed-fallback/stubs/olefile/olefile/olefile.pyi +41 -31
- package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/cell/rich_text.pyi +3 -0
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/chart/trendline.pyi +1 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/base.pyi +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/container.pyi +18 -0
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/sequence.pyi +20 -12
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/custom.pyi +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +2 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/relationship.pyi +6 -11
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/cache.pyi +66 -135
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/fields.pyi +2 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/alignment.pyi +0 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/borders.pyi +0 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/fills.pyi +3 -3
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +5 -10
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/utils/cell.pyi +2 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/utils/indexed_list.pyi +2 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/defined_name.pyi +2 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi +11 -3
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi +2 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi +6 -3
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/filters.pyi +26 -22
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi +3 -5
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/views.pyi +5 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi +4 -2
- package/dist/typeshed-fallback/stubs/peewee/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/peewee/peewee.pyi +6 -1
- package/dist/typeshed-fallback/stubs/protobuf/METADATA.toml +2 -2
- package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +84 -15
- package/dist/typeshed-fallback/stubs/psutil/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_common.pyi +0 -2
- package/dist/typeshed-fallback/stubs/psutil/psutil/_compat.pyi +0 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_psaix.pyi +1 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_psbsd.pyi +1 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_pslinux.pyi +2 -2
- package/dist/typeshed-fallback/stubs/psutil/psutil/_psosx.pyi +1 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_pssunos.pyi +1 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_psutil_osx.pyi +1 -1
- package/dist/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi +1 -1
- package/dist/typeshed-fallback/stubs/pyinstaller/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/pyinstaller/PyInstaller/__main__.pyi +1 -0
- package/dist/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/splash.pyi +0 -2
- package/dist/typeshed-fallback/stubs/pyinstaller/PyInstaller/compat.pyi +2 -3
- package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +3 -2
- package/dist/typeshed-fallback/stubs/requests/requests/models.pyi +2 -2
- package/dist/typeshed-fallback/stubs/seaborn/METADATA.toml +2 -1
- package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi +80 -50
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi +2 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi +6 -3
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi +3 -9
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi +61 -0
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi +2 -2
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi +12 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi +4 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/command/install_lib.pyi +3 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/compat/py311.pyi +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi +0 -1
- package/dist/typeshed-fallback/stubs/shapely/METADATA.toml +2 -1
- package/dist/typeshed-fallback/stubs/shapely/shapely/_geometry.pyi +3 -3
- package/dist/typeshed-fallback/stubs/shapely/shapely/constructive.pyi +6 -6
- package/dist/typeshed-fallback/stubs/shapely/shapely/geometry/base.pyi +3 -3
- package/dist/typeshed-fallback/stubs/shapely/shapely/io.pyi +2 -2
- package/dist/typeshed-fallback/stubs/shapely/shapely/strtree.pyi +9 -9
- package/dist/typeshed-fallback/stubs/tree-sitter-languages/METADATA.toml +1 -1
- package/package.json +1 -1
- package/dist/typeshed-fallback/stubs/tree-sitter/METADATA.toml +0 -7
- package/dist/typeshed-fallback/stubs/tree-sitter/tree_sitter/__init__.pyi +0 -17
- package/dist/typeshed-fallback/stubs/tree-sitter/tree_sitter/binding.pyi +0 -115
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
82199768bf2e651804cb718f4b570af6d41333d9
|
|
@@ -34,6 +34,7 @@ _dummy_thread: 3.0-3.8
|
|
|
34
34
|
_dummy_threading: 3.0-3.8
|
|
35
35
|
_heapq: 3.0-
|
|
36
36
|
_imp: 3.0-
|
|
37
|
+
_interpchannels: 3.13-
|
|
37
38
|
_json: 3.0-
|
|
38
39
|
_locale: 3.0-
|
|
39
40
|
_lsprof: 3.0-
|
|
@@ -65,9 +66,9 @@ array: 3.0-
|
|
|
65
66
|
ast: 3.0-
|
|
66
67
|
asynchat: 3.0-3.11
|
|
67
68
|
asyncio: 3.4-
|
|
68
|
-
asyncio.mixins: 3.10-
|
|
69
69
|
asyncio.exceptions: 3.8-
|
|
70
70
|
asyncio.format_helpers: 3.7-
|
|
71
|
+
asyncio.mixins: 3.10-
|
|
71
72
|
asyncio.runners: 3.7-
|
|
72
73
|
asyncio.staggered: 3.8-
|
|
73
74
|
asyncio.taskgroups: 3.11-
|
|
@@ -270,6 +271,7 @@ threading: 3.0-
|
|
|
270
271
|
time: 3.0-
|
|
271
272
|
timeit: 3.0-
|
|
272
273
|
tkinter: 3.0-
|
|
274
|
+
tkinter.tix: 3.0-3.12
|
|
273
275
|
token: 3.0-
|
|
274
276
|
tokenize: 3.0-
|
|
275
277
|
tomllib: 3.11-
|
|
@@ -11,7 +11,7 @@ if sys.version_info >= (3, 13):
|
|
|
11
11
|
PyCF_OPTIMIZED_AST: Literal[33792]
|
|
12
12
|
|
|
13
13
|
# Used for node end positions in constructor keyword arguments
|
|
14
|
-
_EndPositionT = typing_extensions.TypeVar("_EndPositionT", int, int | None, default=int | None)
|
|
14
|
+
_EndPositionT = typing_extensions.TypeVar("_EndPositionT", int, int | None, default=int | None)
|
|
15
15
|
|
|
16
16
|
# Alias used for fields that must always be valid identifiers
|
|
17
17
|
# A string `x` counts as a valid identifier if both the following are True
|
|
@@ -1,221 +1,221 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Bisection algorithms.
|
|
3
|
-
|
|
4
|
-
This module provides support for maintaining a list in sorted order without
|
|
5
|
-
having to sort the list after each insertion. For long lists of items with
|
|
6
|
-
expensive comparison operations, this can be an improvement over the more
|
|
7
|
-
common approach.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import sys
|
|
11
|
-
from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
|
|
12
|
-
from collections.abc import Callable, MutableSequence
|
|
13
|
-
from typing import TypeVar, overload
|
|
14
|
-
|
|
15
|
-
_T = TypeVar("_T")
|
|
16
|
-
|
|
17
|
-
if sys.version_info >= (3, 10):
|
|
18
|
-
@overload
|
|
19
|
-
def bisect_left(
|
|
20
|
-
a: SupportsLenAndGetItem[SupportsRichComparisonT],
|
|
21
|
-
x: SupportsRichComparisonT,
|
|
22
|
-
lo: int = 0,
|
|
23
|
-
hi: int | None = None,
|
|
24
|
-
*,
|
|
25
|
-
key: None = None,
|
|
26
|
-
) -> int:
|
|
27
|
-
"""
|
|
28
|
-
Return the index where to insert item x in list a, assuming a is sorted.
|
|
29
|
-
|
|
30
|
-
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
31
|
-
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
|
|
32
|
-
insert just before the leftmost x already there.
|
|
33
|
-
|
|
34
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
35
|
-
slice of a to be searched.
|
|
36
|
-
"""
|
|
37
|
-
...
|
|
38
|
-
@overload
|
|
39
|
-
def bisect_left(
|
|
40
|
-
a: SupportsLenAndGetItem[_T],
|
|
41
|
-
x: SupportsRichComparisonT,
|
|
42
|
-
lo: int = 0,
|
|
43
|
-
hi: int | None = None,
|
|
44
|
-
*,
|
|
45
|
-
key: Callable[[_T], SupportsRichComparisonT],
|
|
46
|
-
) -> int:
|
|
47
|
-
"""
|
|
48
|
-
Return the index where to insert item x in list a, assuming a is sorted.
|
|
49
|
-
|
|
50
|
-
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
51
|
-
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
|
|
52
|
-
insert just before the leftmost x already there.
|
|
53
|
-
|
|
54
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
55
|
-
slice of a to be searched.
|
|
56
|
-
"""
|
|
57
|
-
...
|
|
58
|
-
@overload
|
|
59
|
-
def bisect_right(
|
|
60
|
-
a: SupportsLenAndGetItem[SupportsRichComparisonT],
|
|
61
|
-
x: SupportsRichComparisonT,
|
|
62
|
-
lo: int = 0,
|
|
63
|
-
hi: int | None = None,
|
|
64
|
-
*,
|
|
65
|
-
key: None = None,
|
|
66
|
-
) -> int:
|
|
67
|
-
"""
|
|
68
|
-
Return the index where to insert item x in list a, assuming a is sorted.
|
|
69
|
-
|
|
70
|
-
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
71
|
-
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
|
|
72
|
-
insert just after the rightmost x already there.
|
|
73
|
-
|
|
74
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
75
|
-
slice of a to be searched.
|
|
76
|
-
"""
|
|
77
|
-
...
|
|
78
|
-
@overload
|
|
79
|
-
def bisect_right(
|
|
80
|
-
a: SupportsLenAndGetItem[_T],
|
|
81
|
-
x: SupportsRichComparisonT,
|
|
82
|
-
lo: int = 0,
|
|
83
|
-
hi: int | None = None,
|
|
84
|
-
*,
|
|
85
|
-
key: Callable[[_T], SupportsRichComparisonT],
|
|
86
|
-
) -> int:
|
|
87
|
-
"""
|
|
88
|
-
Return the index where to insert item x in list a, assuming a is sorted.
|
|
89
|
-
|
|
90
|
-
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
91
|
-
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
|
|
92
|
-
insert just after the rightmost x already there.
|
|
93
|
-
|
|
94
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
95
|
-
slice of a to be searched.
|
|
96
|
-
"""
|
|
97
|
-
...
|
|
98
|
-
@overload
|
|
99
|
-
def insort_left(
|
|
100
|
-
a: MutableSequence[SupportsRichComparisonT],
|
|
101
|
-
x: SupportsRichComparisonT,
|
|
102
|
-
lo: int = 0,
|
|
103
|
-
hi: int | None = None,
|
|
104
|
-
*,
|
|
105
|
-
key: None = None,
|
|
106
|
-
) -> None:
|
|
107
|
-
"""
|
|
108
|
-
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
109
|
-
|
|
110
|
-
If x is already in a, insert it to the left of the leftmost x.
|
|
111
|
-
|
|
112
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
113
|
-
slice of a to be searched.
|
|
114
|
-
"""
|
|
115
|
-
...
|
|
116
|
-
@overload
|
|
117
|
-
def insort_left(
|
|
118
|
-
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
|
|
119
|
-
) -> None:
|
|
120
|
-
"""
|
|
121
|
-
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
122
|
-
|
|
123
|
-
If x is already in a, insert it to the left of the leftmost x.
|
|
124
|
-
|
|
125
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
126
|
-
slice of a to be searched.
|
|
127
|
-
"""
|
|
128
|
-
...
|
|
129
|
-
@overload
|
|
130
|
-
def insort_right(
|
|
131
|
-
a: MutableSequence[SupportsRichComparisonT],
|
|
132
|
-
x: SupportsRichComparisonT,
|
|
133
|
-
lo: int = 0,
|
|
134
|
-
hi: int | None = None,
|
|
135
|
-
*,
|
|
136
|
-
key: None = None,
|
|
137
|
-
) -> None:
|
|
138
|
-
"""
|
|
139
|
-
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
140
|
-
|
|
141
|
-
If x is already in a, insert it to the right of the rightmost x.
|
|
142
|
-
|
|
143
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
144
|
-
slice of a to be searched.
|
|
145
|
-
"""
|
|
146
|
-
...
|
|
147
|
-
@overload
|
|
148
|
-
def insort_right(
|
|
149
|
-
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
|
|
150
|
-
) -> None:
|
|
151
|
-
"""
|
|
152
|
-
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
153
|
-
|
|
154
|
-
If x is already in a, insert it to the right of the rightmost x.
|
|
155
|
-
|
|
156
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
157
|
-
slice of a to be searched.
|
|
158
|
-
"""
|
|
159
|
-
...
|
|
160
|
-
|
|
161
|
-
else:
|
|
162
|
-
def bisect_left(
|
|
163
|
-
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
164
|
-
) -> int:
|
|
165
|
-
"""
|
|
166
|
-
bisect_left(a, x[, lo[, hi]]) -> index
|
|
167
|
-
|
|
168
|
-
Return the index where to insert item x in list a, assuming a is sorted.
|
|
169
|
-
|
|
170
|
-
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
171
|
-
a[i:] have e >= x. So if x already appears in the list, i points just
|
|
172
|
-
before the leftmost x already there.
|
|
173
|
-
|
|
174
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
175
|
-
slice of a to be searched.
|
|
176
|
-
"""
|
|
177
|
-
...
|
|
178
|
-
def bisect_right(
|
|
179
|
-
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
180
|
-
) -> int:
|
|
181
|
-
"""
|
|
182
|
-
bisect_right(a, x[, lo[, hi]]) -> index
|
|
183
|
-
|
|
184
|
-
Return the index where to insert item x in list a, assuming a is sorted.
|
|
185
|
-
|
|
186
|
-
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
187
|
-
a[i:] have e > x. So if x already appears in the list, i points just
|
|
188
|
-
beyond the rightmost x already there
|
|
189
|
-
|
|
190
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
191
|
-
slice of a to be searched.
|
|
192
|
-
"""
|
|
193
|
-
...
|
|
194
|
-
def insort_left(
|
|
195
|
-
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
196
|
-
) -> None:
|
|
197
|
-
"""
|
|
198
|
-
insort_left(a, x[, lo[, hi]])
|
|
199
|
-
|
|
200
|
-
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
201
|
-
|
|
202
|
-
If x is already in a, insert it to the left of the leftmost x.
|
|
203
|
-
|
|
204
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
205
|
-
slice of a to be searched.
|
|
206
|
-
"""
|
|
207
|
-
...
|
|
208
|
-
def insort_right(
|
|
209
|
-
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
210
|
-
) -> None:
|
|
211
|
-
"""
|
|
212
|
-
insort_right(a, x[, lo[, hi]])
|
|
213
|
-
|
|
214
|
-
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
215
|
-
|
|
216
|
-
If x is already in a, insert it to the right of the rightmost x.
|
|
217
|
-
|
|
218
|
-
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
219
|
-
slice of a to be searched.
|
|
220
|
-
"""
|
|
221
|
-
...
|
|
1
|
+
"""
|
|
2
|
+
Bisection algorithms.
|
|
3
|
+
|
|
4
|
+
This module provides support for maintaining a list in sorted order without
|
|
5
|
+
having to sort the list after each insertion. For long lists of items with
|
|
6
|
+
expensive comparison operations, this can be an improvement over the more
|
|
7
|
+
common approach.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
|
|
12
|
+
from collections.abc import Callable, MutableSequence
|
|
13
|
+
from typing import TypeVar, overload
|
|
14
|
+
|
|
15
|
+
_T = TypeVar("_T")
|
|
16
|
+
|
|
17
|
+
if sys.version_info >= (3, 10):
|
|
18
|
+
@overload
|
|
19
|
+
def bisect_left(
|
|
20
|
+
a: SupportsLenAndGetItem[SupportsRichComparisonT],
|
|
21
|
+
x: SupportsRichComparisonT,
|
|
22
|
+
lo: int = 0,
|
|
23
|
+
hi: int | None = None,
|
|
24
|
+
*,
|
|
25
|
+
key: None = None,
|
|
26
|
+
) -> int:
|
|
27
|
+
"""
|
|
28
|
+
Return the index where to insert item x in list a, assuming a is sorted.
|
|
29
|
+
|
|
30
|
+
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
31
|
+
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
|
|
32
|
+
insert just before the leftmost x already there.
|
|
33
|
+
|
|
34
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
35
|
+
slice of a to be searched.
|
|
36
|
+
"""
|
|
37
|
+
...
|
|
38
|
+
@overload
|
|
39
|
+
def bisect_left(
|
|
40
|
+
a: SupportsLenAndGetItem[_T],
|
|
41
|
+
x: SupportsRichComparisonT,
|
|
42
|
+
lo: int = 0,
|
|
43
|
+
hi: int | None = None,
|
|
44
|
+
*,
|
|
45
|
+
key: Callable[[_T], SupportsRichComparisonT],
|
|
46
|
+
) -> int:
|
|
47
|
+
"""
|
|
48
|
+
Return the index where to insert item x in list a, assuming a is sorted.
|
|
49
|
+
|
|
50
|
+
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
51
|
+
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
|
|
52
|
+
insert just before the leftmost x already there.
|
|
53
|
+
|
|
54
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
55
|
+
slice of a to be searched.
|
|
56
|
+
"""
|
|
57
|
+
...
|
|
58
|
+
@overload
|
|
59
|
+
def bisect_right(
|
|
60
|
+
a: SupportsLenAndGetItem[SupportsRichComparisonT],
|
|
61
|
+
x: SupportsRichComparisonT,
|
|
62
|
+
lo: int = 0,
|
|
63
|
+
hi: int | None = None,
|
|
64
|
+
*,
|
|
65
|
+
key: None = None,
|
|
66
|
+
) -> int:
|
|
67
|
+
"""
|
|
68
|
+
Return the index where to insert item x in list a, assuming a is sorted.
|
|
69
|
+
|
|
70
|
+
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
71
|
+
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
|
|
72
|
+
insert just after the rightmost x already there.
|
|
73
|
+
|
|
74
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
75
|
+
slice of a to be searched.
|
|
76
|
+
"""
|
|
77
|
+
...
|
|
78
|
+
@overload
|
|
79
|
+
def bisect_right(
|
|
80
|
+
a: SupportsLenAndGetItem[_T],
|
|
81
|
+
x: SupportsRichComparisonT,
|
|
82
|
+
lo: int = 0,
|
|
83
|
+
hi: int | None = None,
|
|
84
|
+
*,
|
|
85
|
+
key: Callable[[_T], SupportsRichComparisonT],
|
|
86
|
+
) -> int:
|
|
87
|
+
"""
|
|
88
|
+
Return the index where to insert item x in list a, assuming a is sorted.
|
|
89
|
+
|
|
90
|
+
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
91
|
+
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
|
|
92
|
+
insert just after the rightmost x already there.
|
|
93
|
+
|
|
94
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
95
|
+
slice of a to be searched.
|
|
96
|
+
"""
|
|
97
|
+
...
|
|
98
|
+
@overload
|
|
99
|
+
def insort_left(
|
|
100
|
+
a: MutableSequence[SupportsRichComparisonT],
|
|
101
|
+
x: SupportsRichComparisonT,
|
|
102
|
+
lo: int = 0,
|
|
103
|
+
hi: int | None = None,
|
|
104
|
+
*,
|
|
105
|
+
key: None = None,
|
|
106
|
+
) -> None:
|
|
107
|
+
"""
|
|
108
|
+
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
109
|
+
|
|
110
|
+
If x is already in a, insert it to the left of the leftmost x.
|
|
111
|
+
|
|
112
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
113
|
+
slice of a to be searched.
|
|
114
|
+
"""
|
|
115
|
+
...
|
|
116
|
+
@overload
|
|
117
|
+
def insort_left(
|
|
118
|
+
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
|
|
119
|
+
) -> None:
|
|
120
|
+
"""
|
|
121
|
+
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
122
|
+
|
|
123
|
+
If x is already in a, insert it to the left of the leftmost x.
|
|
124
|
+
|
|
125
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
126
|
+
slice of a to be searched.
|
|
127
|
+
"""
|
|
128
|
+
...
|
|
129
|
+
@overload
|
|
130
|
+
def insort_right(
|
|
131
|
+
a: MutableSequence[SupportsRichComparisonT],
|
|
132
|
+
x: SupportsRichComparisonT,
|
|
133
|
+
lo: int = 0,
|
|
134
|
+
hi: int | None = None,
|
|
135
|
+
*,
|
|
136
|
+
key: None = None,
|
|
137
|
+
) -> None:
|
|
138
|
+
"""
|
|
139
|
+
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
140
|
+
|
|
141
|
+
If x is already in a, insert it to the right of the rightmost x.
|
|
142
|
+
|
|
143
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
144
|
+
slice of a to be searched.
|
|
145
|
+
"""
|
|
146
|
+
...
|
|
147
|
+
@overload
|
|
148
|
+
def insort_right(
|
|
149
|
+
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
|
|
150
|
+
) -> None:
|
|
151
|
+
"""
|
|
152
|
+
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
153
|
+
|
|
154
|
+
If x is already in a, insert it to the right of the rightmost x.
|
|
155
|
+
|
|
156
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
157
|
+
slice of a to be searched.
|
|
158
|
+
"""
|
|
159
|
+
...
|
|
160
|
+
|
|
161
|
+
else:
|
|
162
|
+
def bisect_left(
|
|
163
|
+
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
164
|
+
) -> int:
|
|
165
|
+
"""
|
|
166
|
+
bisect_left(a, x[, lo[, hi]]) -> index
|
|
167
|
+
|
|
168
|
+
Return the index where to insert item x in list a, assuming a is sorted.
|
|
169
|
+
|
|
170
|
+
The return value i is such that all e in a[:i] have e < x, and all e in
|
|
171
|
+
a[i:] have e >= x. So if x already appears in the list, i points just
|
|
172
|
+
before the leftmost x already there.
|
|
173
|
+
|
|
174
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
175
|
+
slice of a to be searched.
|
|
176
|
+
"""
|
|
177
|
+
...
|
|
178
|
+
def bisect_right(
|
|
179
|
+
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
180
|
+
) -> int:
|
|
181
|
+
"""
|
|
182
|
+
bisect_right(a, x[, lo[, hi]]) -> index
|
|
183
|
+
|
|
184
|
+
Return the index where to insert item x in list a, assuming a is sorted.
|
|
185
|
+
|
|
186
|
+
The return value i is such that all e in a[:i] have e <= x, and all e in
|
|
187
|
+
a[i:] have e > x. So if x already appears in the list, i points just
|
|
188
|
+
beyond the rightmost x already there
|
|
189
|
+
|
|
190
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
191
|
+
slice of a to be searched.
|
|
192
|
+
"""
|
|
193
|
+
...
|
|
194
|
+
def insort_left(
|
|
195
|
+
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
196
|
+
) -> None:
|
|
197
|
+
"""
|
|
198
|
+
insort_left(a, x[, lo[, hi]])
|
|
199
|
+
|
|
200
|
+
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
201
|
+
|
|
202
|
+
If x is already in a, insert it to the left of the leftmost x.
|
|
203
|
+
|
|
204
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
205
|
+
slice of a to be searched.
|
|
206
|
+
"""
|
|
207
|
+
...
|
|
208
|
+
def insort_right(
|
|
209
|
+
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
|
|
210
|
+
) -> None:
|
|
211
|
+
"""
|
|
212
|
+
insort_right(a, x[, lo[, hi]])
|
|
213
|
+
|
|
214
|
+
Insert item x in list a, and keep it sorted assuming a is sorted.
|
|
215
|
+
|
|
216
|
+
If x is already in a, insert it to the right of the rightmost x.
|
|
217
|
+
|
|
218
|
+
Optional args lo (default 0) and hi (default len(a)) bound the
|
|
219
|
+
slice of a to be searched.
|
|
220
|
+
"""
|
|
221
|
+
...
|