aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-03-04 21:16:16 +0300
committershadchin <shadchin@yandex-team.com>2024-03-04 21:43:39 +0300
commit74819c4157bd388a7d429c870ea4b343a282dafa (patch)
tree4bff355b03dfb24b14d33581357cc8e624d170fd
parentf64c28a5443395e3a8f27e6f1b15a3507812d2de (diff)
downloadydb-74819c4157bd388a7d429c870ea4b343a282dafa.tar.gz
Extend support pyi files
Сейчас pyi файлы в макросе PY_SRCS используются исключительно в Arcadia плагине для продуктов JB, при сборке эти файлы просто игнорируются. В этом PR добавил шаг, который будет содержимое этих файлов складывать в ресурсы, секция PY_SRCS удобна тем, что позволяет раскладывать pyi файлы с учетом TOP_LEVEL/NAMESPACE, а это необходимо для правильной работы mypy. 3924b0556bc99947e6893cd79e5ce62ec72a18a9
-rw-r--r--build/plugins/pybuild.py18
-rw-r--r--contrib/python/MarkupSafe/py3/markupsafe/_speedups.pyi9
-rw-r--r--contrib/python/Werkzeug/py3/werkzeug/datastructures.pyi912
-rw-r--r--contrib/python/aiohttp/aiohttp/_helpers.pyi6
-rw-r--r--contrib/python/aiosignal/aiosignal/__init__.pyi12
-rw-r--r--contrib/python/attrs/py2/attr/__init__.pyi475
-rw-r--r--contrib/python/attrs/py2/attr/_cmp.pyi14
-rw-r--r--contrib/python/attrs/py2/attr/_version_info.pyi9
-rw-r--r--contrib/python/attrs/py2/attr/converters.pyi13
-rw-r--r--contrib/python/attrs/py2/attr/exceptions.pyi18
-rw-r--r--contrib/python/attrs/py2/attr/filters.pyi7
-rw-r--r--contrib/python/attrs/py2/attr/setters.pyi20
-rw-r--r--contrib/python/attrs/py2/attr/validators.pyi68
-rw-r--r--contrib/python/attrs/py3/attr/__init__.pyi555
-rw-r--r--contrib/python/attrs/py3/attr/_cmp.pyi13
-rw-r--r--contrib/python/attrs/py3/attr/_typing_compat.pyi15
-rw-r--r--contrib/python/attrs/py3/attr/_version_info.pyi9
-rw-r--r--contrib/python/attrs/py3/attr/converters.pyi13
-rw-r--r--contrib/python/attrs/py3/attr/exceptions.pyi17
-rw-r--r--contrib/python/attrs/py3/attr/filters.pyi6
-rw-r--r--contrib/python/attrs/py3/attr/setters.pyi19
-rw-r--r--contrib/python/attrs/py3/attr/validators.pyi88
-rw-r--r--contrib/python/attrs/py3/attrs/__init__.pyi67
-rw-r--r--contrib/python/contextlib2/py3/contextlib2/__init__.pyi132
-rw-r--r--contrib/python/contourpy/contourpy/_contourpy.pyi202
-rw-r--r--contrib/python/contourpy/contourpy/util/_build_config.pyi5
-rw-r--r--contrib/python/freezegun/py3/freezegun/__init__.pyi2
-rw-r--r--contrib/python/freezegun/py3/freezegun/api.pyi62
-rw-r--r--contrib/python/frozenlist/frozenlist/__init__.pyi47
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/__init__.pyi113
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi59
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi76
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi1
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_color_data.pyi6
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_docstring.pyi29
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_enums.pyi18
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_image.pyi0
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_path.pyi9
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi29
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_qhull.pyi0
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_tri.pyi23
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi0
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/animation.pyi219
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/artist.pyi181
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi16
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi767
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi453
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi42
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/axis.pyi278
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi490
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi64
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi121
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi0
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi0
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi0
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/bezier.pyi74
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/cbook.pyi175
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/cm.pyi54
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/collections.pyi242
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/colorbar.pyi136
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/colors.pyi354
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/container.pyi56
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/contour.pyi169
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/dviread.pyi90
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/figure.pyi416
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/font_manager.pyi136
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/ft2font.pyi253
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/gridspec.pyi134
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/hatch.pyi68
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/image.pyi209
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi62
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/legend.pyi154
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi294
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/lines.pyi153
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/markers.pyi51
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/mathtext.pyi33
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/mlab.pyi100
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi321
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/patches.pyi751
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/path.pyi140
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/patheffects.pyi106
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi15
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi112
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi196
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/quiver.pyi187
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi157
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/sankey.pyi61
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/scale.pyi178
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/spines.pyi83
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/stackplot.pyi17
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/streamplot.pyi82
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/style/core.pyi19
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/table.pyi85
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi49
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi32
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi12
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi25
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi31
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/texmanager.pyi38
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/text.pyi214
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/textpath.pyi74
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/ticker.pyi301
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/transforms.pyi335
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi33
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi52
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi10
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi30
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi71
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi15
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi31
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi12
-rw-r--r--contrib/python/matplotlib/py3/matplotlib/widgets.pyi487
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/__init__.pyi2
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/more.pyi695
-rw-r--r--contrib/python/more-itertools/py3/more_itertools/recipes.pyi128
-rw-r--r--contrib/python/multidict/multidict/__init__.pyi152
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/algos.pyi420
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/arrays.pyi34
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/groupby.pyi191
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/hashing.pyi9
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/hashtable.pyi251
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/index.pyi105
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/indexing.pyi17
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/internals.pyi102
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/interval.pyi174
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/join.pyi78
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/json.pyi23
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/lib.pyi250
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/missing.pyi17
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/ops.pyi50
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/ops_dispatch.pyi5
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/parsers.pyi75
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/properties.pyi27
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/reduction.pyi6
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/reshape.pyi16
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/sparse.pyi49
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/testing.pyi12
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslib.pyi32
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/ccalendar.pyi12
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/conversion.pyi14
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/dtypes.pyi81
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/fields.pyi62
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/nattype.pyi132
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/np_datetime.pyi21
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/offsets.pyi279
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/parsing.pyi38
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/period.pyi127
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/strptime.pyi13
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/timedeltas.pyi163
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/timestamps.pyi228
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/timezones.pyi21
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/tzconversion.pyi21
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/tslibs/vectorized.pyi43
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/window/aggregations.pyi127
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/window/indexers.pyi12
-rw-r--r--contrib/python/pandas/py3/pandas/_libs/writers.pyi20
-rw-r--r--contrib/python/pandas/py3/pandas/io/sas/_byteswap.pyi5
-rw-r--r--contrib/python/pandas/py3/pandas/io/sas/_sas.pyi7
-rw-r--r--contrib/python/parso/py2/parso/__init__.pyi19
-rw-r--r--contrib/python/parso/py2/parso/grammar.pyi38
-rw-r--r--contrib/python/parso/py2/parso/pgen2/__init__.pyi1
-rw-r--r--contrib/python/parso/py2/parso/pgen2/generator.pyi38
-rw-r--r--contrib/python/parso/py2/parso/pgen2/grammar_parser.pyi20
-rw-r--r--contrib/python/parso/py2/parso/python/token.pyi30
-rw-r--r--contrib/python/parso/py2/parso/python/tokenize.pyi24
-rw-r--r--contrib/python/parso/py2/parso/utils.pyi29
-rw-r--r--contrib/python/py/py2/py/__init__.pyi20
-rw-r--r--contrib/python/py/py2/py/_vendored_packages/iniconfig/__init__.pyi31
-rw-r--r--contrib/python/py/py2/py/error.pyi129
-rw-r--r--contrib/python/py/py2/py/iniconfig.pyi31
-rw-r--r--contrib/python/py/py2/py/io.pyi130
-rw-r--r--contrib/python/py/py2/py/path.pyi197
-rw-r--r--contrib/python/py/py2/py/xml.pyi25
-rw-r--r--contrib/python/py/py3/py/__init__.pyi20
-rw-r--r--contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.pyi31
-rw-r--r--contrib/python/py/py3/py/error.pyi129
-rw-r--r--contrib/python/py/py3/py/iniconfig.pyi31
-rw-r--r--contrib/python/py/py3/py/io.pyi130
-rw-r--r--contrib/python/py/py3/py/path.pyi197
-rw-r--r--contrib/python/py/py3/py/xml.pyi25
-rw-r--r--contrib/python/pyrsistent/py2/pyrsistent/__init__.pyi213
-rw-r--r--contrib/python/pyrsistent/py2/pyrsistent/typing.pyi292
-rw-r--r--contrib/python/pyrsistent/py3/pyrsistent/__init__.pyi213
-rw-r--r--contrib/python/pyrsistent/py3/pyrsistent/typing.pyi292
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/__init__.pyi33
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/adapter.pyi75
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/contrib/_pytest_plugin.pyi6
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/exceptions.pyi13
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/mocker.pyi263
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/request.pyi41
-rw-r--r--contrib/python/requests-mock/py3/requests_mock/response.pyi38
-rw-r--r--contrib/python/responses/py2/responses/__init__.pyi334
-rw-r--r--contrib/python/responses/py2/responses/matchers.pyi44
-rw-r--r--contrib/python/responses/py2/responses/registries.pyi17
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/__init__.pyi2
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/more.pyi666
-rw-r--r--contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/recipes.pyi119
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/__init__.pyi2
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.pyi480
-rw-r--r--contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/recipes.pyi103
-rw-r--r--contrib/python/toml/py2/toml/__init__.pyi15
-rw-r--r--contrib/python/toml/py2/toml/decoder.pyi52
-rw-r--r--contrib/python/toml/py2/toml/encoder.pyi34
-rw-r--r--contrib/python/toml/py2/toml/ordered.pyi7
-rw-r--r--contrib/python/toml/py2/toml/tz.pyi9
-rw-r--r--contrib/python/toml/py3/toml/__init__.pyi15
-rw-r--r--contrib/python/toml/py3/toml/decoder.pyi52
-rw-r--r--contrib/python/toml/py3/toml/encoder.pyi34
-rw-r--r--contrib/python/toml/py3/toml/ordered.pyi7
-rw-r--r--contrib/python/toml/py3/toml/tz.pyi9
-rw-r--r--contrib/python/tornado/tornado-4/tornado/platform/auto.pyi4
-rw-r--r--contrib/python/tornado/tornado-4/tornado/speedups.pyi1
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/__init__.pyi1
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/compiler/__init__.pyi0
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/descriptor.pyi352
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/descriptor_pool.pyi26
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/__init__.pyi0
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/api_implementation.pyi3
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/builder.pyi5
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi100
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/decoder.pyi63
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/encoder.pyi41
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/enum_type_wrapper.pyi21
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/extension_dict.pyi27
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/message_listener.pyi5
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/python_message.pyi3
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/type_checkers.pyi11
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi103
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/internal/wire_format.pyi50
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/json_format.pyi44
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/message.pyi46
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/message_factory.pyi17
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/reflection.pyi6
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/service.pyi39
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/symbol_database.pyi16
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/text_format.pyi216
-rw-r--r--contrib/python/types-protobuf/google-stubs/protobuf/util/__init__.pyi0
-rw-r--r--contrib/python/yarl/yarl/__init__.pyi121
-rw-r--r--contrib/python/yarl/yarl/_quoting_c.pyi16
-rw-r--r--contrib/python/zstandard/py3/zstandard/__init__.pyi480
240 files changed, 24568 insertions, 2 deletions
diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py
index 399dac5102..526f98b3cf 100644
--- a/build/plugins/pybuild.py
+++ b/build/plugins/pybuild.py
@@ -332,6 +332,7 @@ def onpy_srcs(unit, *args):
swigs_cpp = []
swigs = swigs_cpp
pys = []
+ pyis = []
protos = []
evs = []
fbss = []
@@ -450,9 +451,8 @@ def onpy_srcs(unit, *args):
evs.append(pathmod)
elif path.endswith('.swg'):
swigs.append(pathmod)
- # Allow pyi files in PY_SRCS for autocomplete in IDE, but skip it during building
elif path.endswith('.pyi'):
- pass
+ pyis.append(pathmod)
elif path.endswith('.fbs'):
fbss.append(pathmod)
else:
@@ -629,6 +629,20 @@ def onpy_srcs(unit, *args):
unit, 2, [path for path, mod in pys] + unit.get(['_PY_EXTRA_LINT_FILES_VALUE']).split()
)
+ if pyis:
+ pyis_seen = set()
+ pyis_dups = {m for _, m in pyis if (m in pyis_seen or pyis_seen.add(m))}
+ if pyis_dups:
+ pyis_dups = ', '.join(name for name in sorted(pyis_dups))
+ ymake.report_configure_error('Duplicate(s) is found in the PY_SRCS macro: {}'.format(pyis_dups))
+
+ res = []
+ for path, mod in pyis:
+ dest = 'py/' + mod.replace('.', '/') + '.pyi'
+ res += ['DEST', dest, path]
+
+ unit.onresource_files(res)
+
use_vanilla_protoc = unit.get('USE_VANILLA_PROTOC') == 'yes'
if use_vanilla_protoc:
cpp_runtime_path = 'contrib/libs/protobuf_std'
diff --git a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.pyi b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.pyi
new file mode 100644
index 0000000000..f673240f6d
--- /dev/null
+++ b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.pyi
@@ -0,0 +1,9 @@
+from typing import Any
+from typing import Optional
+
+from . import Markup
+
+def escape(s: Any) -> Markup: ...
+def escape_silent(s: Optional[Any]) -> Markup: ...
+def soft_str(s: Any) -> str: ...
+def soft_unicode(s: Any) -> str: ...
diff --git a/contrib/python/Werkzeug/py3/werkzeug/datastructures.pyi b/contrib/python/Werkzeug/py3/werkzeug/datastructures.pyi
new file mode 100644
index 0000000000..ee6e46d583
--- /dev/null
+++ b/contrib/python/Werkzeug/py3/werkzeug/datastructures.pyi
@@ -0,0 +1,912 @@
+from datetime import datetime
+from os import PathLike
+from typing import Any
+from typing import Callable
+from typing import Collection
+from typing import Dict
+from typing import FrozenSet
+from typing import Generic
+from typing import Hashable
+from typing import IO
+from typing import Iterable
+from typing import Iterator
+from typing import List
+from typing import Mapping
+from typing import NoReturn
+from typing import Optional
+from typing import overload
+from typing import Set
+from typing import Tuple
+from typing import Type
+from typing import TypeVar
+from typing import Union
+from _typeshed.wsgi import WSGIEnvironment
+
+from typing_extensions import Literal
+from typing_extensions import SupportsIndex
+
+K = TypeVar("K")
+V = TypeVar("V")
+T = TypeVar("T")
+D = TypeVar("D")
+_CD = TypeVar("_CD", bound="CallbackDict")
+
+def is_immutable(self: object) -> NoReturn: ...
+def iter_multi_items(
+ mapping: Union[Mapping[K, Union[V, Iterable[V]]], Iterable[Tuple[K, V]]]
+) -> Iterator[Tuple[K, V]]: ...
+
+class ImmutableListMixin(List[V]):
+ _hash_cache: Optional[int]
+ def __hash__(self) -> int: ... # type: ignore
+ def __delitem__(self, key: Union[SupportsIndex, slice]) -> NoReturn: ...
+ def __iadd__(self, other: t.Any) -> NoReturn: ... # type: ignore
+ def __imul__(self, other: SupportsIndex) -> NoReturn: ...
+ def __setitem__( # type: ignore
+ self, key: Union[int, slice], value: V
+ ) -> NoReturn: ...
+ def append(self, value: V) -> NoReturn: ...
+ def remove(self, value: V) -> NoReturn: ...
+ def extend(self, values: Iterable[V]) -> NoReturn: ...
+ def insert(self, pos: SupportsIndex, value: V) -> NoReturn: ...
+ def pop(self, index: SupportsIndex = -1) -> NoReturn: ...
+ def reverse(self) -> NoReturn: ...
+ def sort(
+ self, key: Optional[Callable[[V], Any]] = None, reverse: bool = False
+ ) -> NoReturn: ...
+
+class ImmutableList(ImmutableListMixin[V]): ...
+
+class ImmutableDictMixin(Dict[K, V]):
+ _hash_cache: Optional[int]
+ @classmethod
+ def fromkeys( # type: ignore
+ cls, keys: Iterable[K], value: Optional[V] = None
+ ) -> ImmutableDictMixin[K, V]: ...
+ def _iter_hashitems(self) -> Iterable[Hashable]: ...
+ def __hash__(self) -> int: ... # type: ignore
+ def setdefault(self, key: K, default: Optional[V] = None) -> NoReturn: ...
+ def update(self, *args: Any, **kwargs: V) -> NoReturn: ...
+ def pop(self, key: K, default: Optional[V] = None) -> NoReturn: ... # type: ignore
+ def popitem(self) -> NoReturn: ...
+ def __setitem__(self, key: K, value: V) -> NoReturn: ...
+ def __delitem__(self, key: K) -> NoReturn: ...
+ def clear(self) -> NoReturn: ...
+
+class ImmutableMultiDictMixin(ImmutableDictMixin[K, V]):
+ def _iter_hashitems(self) -> Iterable[Hashable]: ...
+ def add(self, key: K, value: V) -> NoReturn: ...
+ def popitemlist(self) -> NoReturn: ...
+ def poplist(self, key: K) -> NoReturn: ...
+ def setlist(self, key: K, new_list: Iterable[V]) -> NoReturn: ...
+ def setlistdefault(
+ self, key: K, default_list: Optional[Iterable[V]] = None
+ ) -> NoReturn: ...
+
+def _calls_update(name: str) -> Callable[[UpdateDictMixin[K, V]], Any]: ...
+
+class UpdateDictMixin(Dict[K, V]):
+ on_update: Optional[Callable[[UpdateDictMixin[K, V]], None]]
+ def setdefault(self, key: K, default: Optional[V] = None) -> V: ...
+ @overload
+ def pop(self, key: K) -> V: ...
+ @overload
+ def pop(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
+ def __setitem__(self, key: K, value: V) -> None: ...
+ def __delitem__(self, key: K) -> None: ...
+ def clear(self) -> None: ...
+ def popitem(self) -> Tuple[K, V]: ...
+ def update(
+ self, *args: Union[Mapping[K, V], Iterable[Tuple[K, V]]], **kwargs: V
+ ) -> None: ...
+
+class TypeConversionDict(Dict[K, V]):
+ @overload
+ def get(self, key: K, default: None = ..., type: None = ...) -> Optional[V]: ...
+ @overload
+ def get(self, key: K, default: D, type: None = ...) -> Union[D, V]: ...
+ @overload
+ def get(self, key: K, default: D, type: Callable[[V], T]) -> Union[D, T]: ...
+ @overload
+ def get(self, key: K, type: Callable[[V], T]) -> Optional[T]: ...
+
+class ImmutableTypeConversionDict(ImmutableDictMixin[K, V], TypeConversionDict[K, V]):
+ def copy(self) -> TypeConversionDict[K, V]: ...
+ def __copy__(self) -> ImmutableTypeConversionDict: ...
+
+class MultiDict(TypeConversionDict[K, V]):
+ def __init__(
+ self,
+ mapping: Optional[
+ Union[Mapping[K, Union[Iterable[V], V]], Iterable[Tuple[K, V]]]
+ ] = None,
+ ) -> None: ...
+ def __getitem__(self, item: K) -> V: ...
+ def __setitem__(self, key: K, value: V) -> None: ...
+ def add(self, key: K, value: V) -> None: ...
+ @overload
+ def getlist(self, key: K) -> List[V]: ...
+ @overload
+ def getlist(self, key: K, type: Callable[[V], T] = ...) -> List[T]: ...
+ def setlist(self, key: K, new_list: Iterable[V]) -> None: ...
+ def setdefault(self, key: K, default: Optional[V] = None) -> V: ...
+ def setlistdefault(
+ self, key: K, default_list: Optional[Iterable[V]] = None
+ ) -> List[V]: ...
+ def items(self, multi: bool = False) -> Iterator[Tuple[K, V]]: ... # type: ignore
+ def lists(self) -> Iterator[Tuple[K, List[V]]]: ...
+ def values(self) -> Iterator[V]: ... # type: ignore
+ def listvalues(self) -> Iterator[List[V]]: ...
+ def copy(self) -> MultiDict[K, V]: ...
+ def deepcopy(self, memo: Any = None) -> MultiDict[K, V]: ...
+ @overload
+ def to_dict(self) -> Dict[K, V]: ...
+ @overload
+ def to_dict(self, flat: Literal[False]) -> Dict[K, List[V]]: ...
+ def update( # type: ignore
+ self, mapping: Union[Mapping[K, Union[Iterable[V], V]], Iterable[Tuple[K, V]]]
+ ) -> None: ...
+ @overload
+ def pop(self, key: K) -> V: ...
+ @overload
+ def pop(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
+ def popitem(self) -> Tuple[K, V]: ...
+ def poplist(self, key: K) -> List[V]: ...
+ def popitemlist(self) -> Tuple[K, List[V]]: ...
+ def __copy__(self) -> MultiDict[K, V]: ...
+ def __deepcopy__(self, memo: Any) -> MultiDict[K, V]: ...
+
+class _omd_bucket(Generic[K, V]):
+ prev: Optional[_omd_bucket]
+ next: Optional[_omd_bucket]
+ key: K
+ value: V
+ def __init__(self, omd: OrderedMultiDict, key: K, value: V) -> None: ...
+ def unlink(self, omd: OrderedMultiDict) -> None: ...
+
+class OrderedMultiDict(MultiDict[K, V]):
+ _first_bucket: Optional[_omd_bucket]
+ _last_bucket: Optional[_omd_bucket]
+ def __init__(self, mapping: Optional[Mapping[K, V]] = None) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __getitem__(self, key: K) -> V: ...
+ def __setitem__(self, key: K, value: V) -> None: ...
+ def __delitem__(self, key: K) -> None: ...
+ def keys(self) -> Iterator[K]: ... # type: ignore
+ def __iter__(self) -> Iterator[K]: ...
+ def values(self) -> Iterator[V]: ... # type: ignore
+ def items(self, multi: bool = False) -> Iterator[Tuple[K, V]]: ... # type: ignore
+ def lists(self) -> Iterator[Tuple[K, List[V]]]: ...
+ def listvalues(self) -> Iterator[List[V]]: ...
+ def add(self, key: K, value: V) -> None: ...
+ @overload
+ def getlist(self, key: K) -> List[V]: ...
+ @overload
+ def getlist(self, key: K, type: Callable[[V], T] = ...) -> List[T]: ...
+ def setlist(self, key: K, new_list: Iterable[V]) -> None: ...
+ def setlistdefault(
+ self, key: K, default_list: Optional[Iterable[V]] = None
+ ) -> List[V]: ...
+ def update( # type: ignore
+ self, mapping: Union[Mapping[K, V], Iterable[Tuple[K, V]]]
+ ) -> None: ...
+ def poplist(self, key: K) -> List[V]: ...
+ @overload
+ def pop(self, key: K) -> V: ...
+ @overload
+ def pop(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
+ def popitem(self) -> Tuple[K, V]: ...
+ def popitemlist(self) -> Tuple[K, List[V]]: ...
+
+def _options_header_vkw(
+ value: str, kw: Mapping[str, Optional[Union[str, int]]]
+) -> str: ...
+def _unicodify_header_value(value: Union[str, int]) -> str: ...
+
+HV = Union[str, int]
+
+class Headers(Dict[str, str]):
+ _list: List[Tuple[str, str]]
+ def __init__(
+ self,
+ defaults: Optional[
+ Union[Mapping[str, Union[HV, Iterable[HV]]], Iterable[Tuple[str, HV]]]
+ ] = None,
+ ) -> None: ...
+ @overload
+ def __getitem__(self, key: str) -> str: ...
+ @overload
+ def __getitem__(self, key: int) -> Tuple[str, str]: ...
+ @overload
+ def __getitem__(self, key: slice) -> Headers: ...
+ @overload
+ def __getitem__(self, key: str, _get_mode: Literal[True] = ...) -> str: ...
+ def __eq__(self, other: object) -> bool: ...
+ @overload # type: ignore
+ def get(self, key: str, default: str) -> str: ...
+ @overload
+ def get(self, key: str, default: Optional[str] = None) -> Optional[str]: ...
+ @overload
+ def get(
+ self, key: str, default: Optional[T] = None, type: Callable[[str], T] = ...
+ ) -> Optional[T]: ...
+ @overload
+ def getlist(self, key: str) -> List[str]: ...
+ @overload
+ def getlist(self, key: str, type: Callable[[str], T]) -> List[T]: ...
+ def get_all(self, name: str) -> List[str]: ...
+ def items( # type: ignore
+ self, lower: bool = False
+ ) -> Iterator[Tuple[str, str]]: ...
+ def keys(self, lower: bool = False) -> Iterator[str]: ... # type: ignore
+ def values(self) -> Iterator[str]: ... # type: ignore
+ def extend(
+ self,
+ *args: Union[Mapping[str, Union[HV, Iterable[HV]]], Iterable[Tuple[str, HV]]],
+ **kwargs: Union[HV, Iterable[HV]],
+ ) -> None: ...
+ @overload
+ def __delitem__(self, key: Union[str, int, slice]) -> None: ...
+ @overload
+ def __delitem__(self, key: str, _index_operation: Literal[False]) -> None: ...
+ def remove(self, key: str) -> None: ...
+ @overload # type: ignore
+ def pop(self, key: str, default: Optional[str] = None) -> str: ...
+ @overload
+ def pop(
+ self, key: Optional[int] = None, default: Optional[Tuple[str, str]] = None
+ ) -> Tuple[str, str]: ...
+ def popitem(self) -> Tuple[str, str]: ...
+ def __contains__(self, key: str) -> bool: ... # type: ignore
+ def has_key(self, key: str) -> bool: ...
+ def __iter__(self) -> Iterator[Tuple[str, str]]: ... # type: ignore
+ def add(self, _key: str, _value: HV, **kw: HV) -> None: ...
+ def _validate_value(self, value: str) -> None: ...
+ def add_header(self, _key: str, _value: HV, **_kw: HV) -> None: ...
+ def clear(self) -> None: ...
+ def set(self, _key: str, _value: HV, **kw: HV) -> None: ...
+ def setlist(self, key: str, values: Iterable[HV]) -> None: ...
+ def setdefault(self, key: str, default: HV) -> str: ... # type: ignore
+ def setlistdefault(self, key: str, default: Iterable[HV]) -> None: ...
+ @overload
+ def __setitem__(self, key: str, value: HV) -> None: ...
+ @overload
+ def __setitem__(self, key: int, value: Tuple[str, HV]) -> None: ...
+ @overload
+ def __setitem__(self, key: slice, value: Iterable[Tuple[str, HV]]) -> None: ...
+ def update(
+ self,
+ *args: Union[Mapping[str, HV], Iterable[Tuple[str, HV]]],
+ **kwargs: Union[HV, Iterable[HV]],
+ ) -> None: ...
+ def to_wsgi_list(self) -> List[Tuple[str, str]]: ...
+ def copy(self) -> Headers: ...
+ def __copy__(self) -> Headers: ...
+
+class ImmutableHeadersMixin(Headers):
+ def __delitem__(self, key: Any, _index_operation: bool = True) -> NoReturn: ...
+ def __setitem__(self, key: Any, value: Any) -> NoReturn: ...
+ def set(self, _key: Any, _value: Any, **kw: Any) -> NoReturn: ...
+ def setlist(self, key: Any, values: Any) -> NoReturn: ...
+ def add(self, _key: Any, _value: Any, **kw: Any) -> NoReturn: ...
+ def add_header(self, _key: Any, _value: Any, **_kw: Any) -> NoReturn: ...
+ def remove(self, key: Any) -> NoReturn: ...
+ def extend(self, *args: Any, **kwargs: Any) -> NoReturn: ...
+ def update(self, *args: Any, **kwargs: Any) -> NoReturn: ...
+ def insert(self, pos: Any, value: Any) -> NoReturn: ...
+ def pop(self, key: Any = None, default: Any = ...) -> NoReturn: ...
+ def popitem(self) -> NoReturn: ...
+ def setdefault(self, key: Any, default: Any) -> NoReturn: ... # type: ignore
+ def setlistdefault(self, key: Any, default: Any) -> NoReturn: ...
+
+class EnvironHeaders(ImmutableHeadersMixin, Headers):
+ environ: WSGIEnvironment
+ def __init__(self, environ: WSGIEnvironment) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __getitem__( # type: ignore
+ self, key: str, _get_mode: Literal[False] = False
+ ) -> str: ...
+ def __iter__(self) -> Iterator[Tuple[str, str]]: ... # type: ignore
+ def copy(self) -> NoReturn: ...
+
+class CombinedMultiDict(ImmutableMultiDictMixin[K, V], MultiDict[K, V]): # type: ignore
+ dicts: List[MultiDict[K, V]]
+ def __init__(self, dicts: Optional[Iterable[MultiDict[K, V]]]) -> None: ...
+ @classmethod
+ def fromkeys(cls, keys: Any, value: Any = None) -> NoReturn: ...
+ def __getitem__(self, key: K) -> V: ...
+ @overload # type: ignore
+ def get(self, key: K) -> Optional[V]: ...
+ @overload
+ def get(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
+ @overload
+ def get(
+ self, key: K, default: Optional[T] = None, type: Callable[[V], T] = ...
+ ) -> Optional[T]: ...
+ @overload
+ def getlist(self, key: K) -> List[V]: ...
+ @overload
+ def getlist(self, key: K, type: Callable[[V], T] = ...) -> List[T]: ...
+ def _keys_impl(self) -> Set[K]: ...
+ def keys(self) -> Set[K]: ... # type: ignore
+ def __iter__(self) -> Set[K]: ... # type: ignore
+ def items(self, multi: bool = False) -> Iterator[Tuple[K, V]]: ... # type: ignore
+ def values(self) -> Iterator[V]: ... # type: ignore
+ def lists(self) -> Iterator[Tuple[K, List[V]]]: ...
+ def listvalues(self) -> Iterator[List[V]]: ...
+ def copy(self) -> MultiDict[K, V]: ...
+ @overload
+ def to_dict(self) -> Dict[K, V]: ...
+ @overload
+ def to_dict(self, flat: Literal[False]) -> Dict[K, List[V]]: ...
+ def __contains__(self, key: K) -> bool: ... # type: ignore
+ def has_key(self, key: K) -> bool: ...
+
+class FileMultiDict(MultiDict[str, "FileStorage"]):
+ def add_file(
+ self,
+ name: str,
+ file: Union[FileStorage, str, IO[bytes]],
+ filename: Optional[str] = None,
+ content_type: Optional[str] = None,
+ ) -> None: ...
+
+class ImmutableDict(ImmutableDictMixin[K, V], Dict[K, V]):
+ def copy(self) -> Dict[K, V]: ...
+ def __copy__(self) -> ImmutableDict[K, V]: ...
+
+class ImmutableMultiDict( # type: ignore
+ ImmutableMultiDictMixin[K, V], MultiDict[K, V]
+):
+ def copy(self) -> MultiDict[K, V]: ...
+ def __copy__(self) -> ImmutableMultiDict[K, V]: ...
+
+class ImmutableOrderedMultiDict( # type: ignore
+ ImmutableMultiDictMixin[K, V], OrderedMultiDict[K, V]
+):
+ def _iter_hashitems(self) -> Iterator[Tuple[int, Tuple[K, V]]]: ...
+ def copy(self) -> OrderedMultiDict[K, V]: ...
+ def __copy__(self) -> ImmutableOrderedMultiDict[K, V]: ...
+
+class Accept(ImmutableList[Tuple[str, int]]):
+ provided: bool
+ def __init__(
+ self, values: Optional[Union[Accept, Iterable[Tuple[str, float]]]] = None
+ ) -> None: ...
+ def _specificity(self, value: str) -> Tuple[bool, ...]: ...
+ def _value_matches(self, value: str, item: str) -> bool: ...
+ @overload # type: ignore
+ def __getitem__(self, key: str) -> int: ...
+ @overload
+ def __getitem__(self, key: int) -> Tuple[str, int]: ...
+ @overload
+ def __getitem__(self, key: slice) -> Iterable[Tuple[str, int]]: ...
+ def quality(self, key: str) -> int: ...
+ def __contains__(self, value: str) -> bool: ... # type: ignore
+ def index(self, key: str) -> int: ... # type: ignore
+ def find(self, key: str) -> int: ...
+ def values(self) -> Iterator[str]: ...
+ def to_header(self) -> str: ...
+ def _best_single_match(self, match: str) -> Optional[Tuple[str, int]]: ...
+ def best_match(
+ self, matches: Iterable[str], default: Optional[str] = None
+ ) -> Optional[str]: ...
+ @property
+ def best(self) -> str: ...
+
+def _normalize_mime(value: str) -> List[str]: ...
+
+class MIMEAccept(Accept):
+ def _specificity(self, value: str) -> Tuple[bool, ...]: ...
+ def _value_matches(self, value: str, item: str) -> bool: ...
+ @property
+ def accept_html(self) -> bool: ...
+ @property
+ def accept_xhtml(self) -> bool: ...
+ @property
+ def accept_json(self) -> bool: ...
+
+def _normalize_lang(value: str) -> List[str]: ...
+
+class LanguageAccept(Accept):
+ def _value_matches(self, value: str, item: str) -> bool: ...
+ def best_match(
+ self, matches: Iterable[str], default: Optional[str] = None
+ ) -> Optional[str]: ...
+
+class CharsetAccept(Accept):
+ def _value_matches(self, value: str, item: str) -> bool: ...
+
+_CPT = TypeVar("_CPT", str, int, bool)
+_OptCPT = Optional[_CPT]
+
+def cache_property(key: str, empty: _OptCPT, type: Type[_CPT]) -> property: ...
+
+class _CacheControl(UpdateDictMixin[str, _OptCPT], Dict[str, _OptCPT]):
+ provided: bool
+ def __init__(
+ self,
+ values: Union[Mapping[str, _OptCPT], Iterable[Tuple[str, _OptCPT]]] = (),
+ on_update: Optional[Callable[[_CacheControl], None]] = None,
+ ) -> None: ...
+ @property
+ def no_cache(self) -> Optional[bool]: ...
+ @no_cache.setter
+ def no_cache(self, value: Optional[bool]) -> None: ...
+ @no_cache.deleter
+ def no_cache(self) -> None: ...
+ @property
+ def no_store(self) -> Optional[bool]: ...
+ @no_store.setter
+ def no_store(self, value: Optional[bool]) -> None: ...
+ @no_store.deleter
+ def no_store(self) -> None: ...
+ @property
+ def max_age(self) -> Optional[int]: ...
+ @max_age.setter
+ def max_age(self, value: Optional[int]) -> None: ...
+ @max_age.deleter
+ def max_age(self) -> None: ...
+ @property
+ def no_transform(self) -> Optional[bool]: ...
+ @no_transform.setter
+ def no_transform(self, value: Optional[bool]) -> None: ...
+ @no_transform.deleter
+ def no_transform(self) -> None: ...
+ def _get_cache_value(self, key: str, empty: Optional[T], type: Type[T]) -> T: ...
+ def _set_cache_value(self, key: str, value: Optional[T], type: Type[T]) -> None: ...
+ def _del_cache_value(self, key: str) -> None: ...
+ def to_header(self) -> str: ...
+ @staticmethod
+ def cache_property(key: str, empty: _OptCPT, type: Type[_CPT]) -> property: ...
+
+class RequestCacheControl(ImmutableDictMixin[str, _OptCPT], _CacheControl):
+ @property
+ def max_stale(self) -> Optional[int]: ...
+ @max_stale.setter
+ def max_stale(self, value: Optional[int]) -> None: ...
+ @max_stale.deleter
+ def max_stale(self) -> None: ...
+ @property
+ def min_fresh(self) -> Optional[int]: ...
+ @min_fresh.setter
+ def min_fresh(self, value: Optional[int]) -> None: ...
+ @min_fresh.deleter
+ def min_fresh(self) -> None: ...
+ @property
+ def only_if_cached(self) -> Optional[bool]: ...
+ @only_if_cached.setter
+ def only_if_cached(self, value: Optional[bool]) -> None: ...
+ @only_if_cached.deleter
+ def only_if_cached(self) -> None: ...
+
+class ResponseCacheControl(_CacheControl):
+ @property
+ def public(self) -> Optional[bool]: ...
+ @public.setter
+ def public(self, value: Optional[bool]) -> None: ...
+ @public.deleter
+ def public(self) -> None: ...
+ @property
+ def private(self) -> Optional[bool]: ...
+ @private.setter
+ def private(self, value: Optional[bool]) -> None: ...
+ @private.deleter
+ def private(self) -> None: ...
+ @property
+ def must_revalidate(self) -> Optional[bool]: ...
+ @must_revalidate.setter
+ def must_revalidate(self, value: Optional[bool]) -> None: ...
+ @must_revalidate.deleter
+ def must_revalidate(self) -> None: ...
+ @property
+ def proxy_revalidate(self) -> Optional[bool]: ...
+ @proxy_revalidate.setter
+ def proxy_revalidate(self, value: Optional[bool]) -> None: ...
+ @proxy_revalidate.deleter
+ def proxy_revalidate(self) -> None: ...
+ @property
+ def s_maxage(self) -> Optional[int]: ...
+ @s_maxage.setter
+ def s_maxage(self, value: Optional[int]) -> None: ...
+ @s_maxage.deleter
+ def s_maxage(self) -> None: ...
+ @property
+ def immutable(self) -> Optional[bool]: ...
+ @immutable.setter
+ def immutable(self, value: Optional[bool]) -> None: ...
+ @immutable.deleter
+ def immutable(self) -> None: ...
+
+def csp_property(key: str) -> property: ...
+
+class ContentSecurityPolicy(UpdateDictMixin[str, str], Dict[str, str]):
+ @property
+ def base_uri(self) -> Optional[str]: ...
+ @base_uri.setter
+ def base_uri(self, value: Optional[str]) -> None: ...
+ @base_uri.deleter
+ def base_uri(self) -> None: ...
+ @property
+ def child_src(self) -> Optional[str]: ...
+ @child_src.setter
+ def child_src(self, value: Optional[str]) -> None: ...
+ @child_src.deleter
+ def child_src(self) -> None: ...
+ @property
+ def connect_src(self) -> Optional[str]: ...
+ @connect_src.setter
+ def connect_src(self, value: Optional[str]) -> None: ...
+ @connect_src.deleter
+ def connect_src(self) -> None: ...
+ @property
+ def default_src(self) -> Optional[str]: ...
+ @default_src.setter
+ def default_src(self, value: Optional[str]) -> None: ...
+ @default_src.deleter
+ def default_src(self) -> None: ...
+ @property
+ def font_src(self) -> Optional[str]: ...
+ @font_src.setter
+ def font_src(self, value: Optional[str]) -> None: ...
+ @font_src.deleter
+ def font_src(self) -> None: ...
+ @property
+ def form_action(self) -> Optional[str]: ...
+ @form_action.setter
+ def form_action(self, value: Optional[str]) -> None: ...
+ @form_action.deleter
+ def form_action(self) -> None: ...
+ @property
+ def frame_ancestors(self) -> Optional[str]: ...
+ @frame_ancestors.setter
+ def frame_ancestors(self, value: Optional[str]) -> None: ...
+ @frame_ancestors.deleter
+ def frame_ancestors(self) -> None: ...
+ @property
+ def frame_src(self) -> Optional[str]: ...
+ @frame_src.setter
+ def frame_src(self, value: Optional[str]) -> None: ...
+ @frame_src.deleter
+ def frame_src(self) -> None: ...
+ @property
+ def img_src(self) -> Optional[str]: ...
+ @img_src.setter
+ def img_src(self, value: Optional[str]) -> None: ...
+ @img_src.deleter
+ def img_src(self) -> None: ...
+ @property
+ def manifest_src(self) -> Optional[str]: ...
+ @manifest_src.setter
+ def manifest_src(self, value: Optional[str]) -> None: ...
+ @manifest_src.deleter
+ def manifest_src(self) -> None: ...
+ @property
+ def media_src(self) -> Optional[str]: ...
+ @media_src.setter
+ def media_src(self, value: Optional[str]) -> None: ...
+ @media_src.deleter
+ def media_src(self) -> None: ...
+ @property
+ def navigate_to(self) -> Optional[str]: ...
+ @navigate_to.setter
+ def navigate_to(self, value: Optional[str]) -> None: ...
+ @navigate_to.deleter
+ def navigate_to(self) -> None: ...
+ @property
+ def object_src(self) -> Optional[str]: ...
+ @object_src.setter
+ def object_src(self, value: Optional[str]) -> None: ...
+ @object_src.deleter
+ def object_src(self) -> None: ...
+ @property
+ def prefetch_src(self) -> Optional[str]: ...
+ @prefetch_src.setter
+ def prefetch_src(self, value: Optional[str]) -> None: ...
+ @prefetch_src.deleter
+ def prefetch_src(self) -> None: ...
+ @property
+ def plugin_types(self) -> Optional[str]: ...
+ @plugin_types.setter
+ def plugin_types(self, value: Optional[str]) -> None: ...
+ @plugin_types.deleter
+ def plugin_types(self) -> None: ...
+ @property
+ def report_to(self) -> Optional[str]: ...
+ @report_to.setter
+ def report_to(self, value: Optional[str]) -> None: ...
+ @report_to.deleter
+ def report_to(self) -> None: ...
+ @property
+ def report_uri(self) -> Optional[str]: ...
+ @report_uri.setter
+ def report_uri(self, value: Optional[str]) -> None: ...
+ @report_uri.deleter
+ def report_uri(self) -> None: ...
+ @property
+ def sandbox(self) -> Optional[str]: ...
+ @sandbox.setter
+ def sandbox(self, value: Optional[str]) -> None: ...
+ @sandbox.deleter
+ def sandbox(self) -> None: ...
+ @property
+ def script_src(self) -> Optional[str]: ...
+ @script_src.setter
+ def script_src(self, value: Optional[str]) -> None: ...
+ @script_src.deleter
+ def script_src(self) -> None: ...
+ @property
+ def script_src_attr(self) -> Optional[str]: ...
+ @script_src_attr.setter
+ def script_src_attr(self, value: Optional[str]) -> None: ...
+ @script_src_attr.deleter
+ def script_src_attr(self) -> None: ...
+ @property
+ def script_src_elem(self) -> Optional[str]: ...
+ @script_src_elem.setter
+ def script_src_elem(self, value: Optional[str]) -> None: ...
+ @script_src_elem.deleter
+ def script_src_elem(self) -> None: ...
+ @property
+ def style_src(self) -> Optional[str]: ...
+ @style_src.setter
+ def style_src(self, value: Optional[str]) -> None: ...
+ @style_src.deleter
+ def style_src(self) -> None: ...
+ @property
+ def style_src_attr(self) -> Optional[str]: ...
+ @style_src_attr.setter
+ def style_src_attr(self, value: Optional[str]) -> None: ...
+ @style_src_attr.deleter
+ def style_src_attr(self) -> None: ...
+ @property
+ def style_src_elem(self) -> Optional[str]: ...
+ @style_src_elem.setter
+ def style_src_elem(self, value: Optional[str]) -> None: ...
+ @style_src_elem.deleter
+ def style_src_elem(self) -> None: ...
+ @property
+ def worker_src(self) -> Optional[str]: ...
+ @worker_src.setter
+ def worker_src(self, value: Optional[str]) -> None: ...
+ @worker_src.deleter
+ def worker_src(self) -> None: ...
+ provided: bool
+ def __init__(
+ self,
+ values: Union[Mapping[str, str], Iterable[Tuple[str, str]]] = (),
+ on_update: Optional[Callable[[ContentSecurityPolicy], None]] = None,
+ ) -> None: ...
+ def _get_value(self, key: str) -> Optional[str]: ...
+ def _set_value(self, key: str, value: str) -> None: ...
+ def _del_value(self, key: str) -> None: ...
+ def to_header(self) -> str: ...
+
+class CallbackDict(UpdateDictMixin[K, V], Dict[K, V]):
+ def __init__(
+ self,
+ initial: Optional[Union[Mapping[K, V], Iterable[Tuple[K, V]]]] = None,
+ on_update: Optional[Callable[[_CD], None]] = None,
+ ) -> None: ...
+
+class HeaderSet(Set[str]):
+ _headers: List[str]
+ _set: Set[str]
+ on_update: Optional[Callable[[HeaderSet], None]]
+ def __init__(
+ self,
+ headers: Optional[Iterable[str]] = None,
+ on_update: Optional[Callable[[HeaderSet], None]] = None,
+ ) -> None: ...
+ def add(self, header: str) -> None: ...
+ def remove(self, header: str) -> None: ...
+ def update(self, iterable: Iterable[str]) -> None: ... # type: ignore
+ def discard(self, header: str) -> None: ...
+ def find(self, header: str) -> int: ...
+ def index(self, header: str) -> int: ...
+ def clear(self) -> None: ...
+ def as_set(self, preserve_casing: bool = False) -> Set[str]: ...
+ def to_header(self) -> str: ...
+ def __getitem__(self, idx: int) -> str: ...
+ def __delitem__(self, idx: int) -> None: ...
+ def __setitem__(self, idx: int, value: str) -> None: ...
+ def __contains__(self, header: str) -> bool: ... # type: ignore
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[str]: ...
+
+class ETags(Collection[str]):
+ _strong: FrozenSet[str]
+ _weak: FrozenSet[str]
+ star_tag: bool
+ def __init__(
+ self,
+ strong_etags: Optional[Iterable[str]] = None,
+ weak_etags: Optional[Iterable[str]] = None,
+ star_tag: bool = False,
+ ) -> None: ...
+ def as_set(self, include_weak: bool = False) -> Set[str]: ...
+ def is_weak(self, etag: str) -> bool: ...
+ def is_strong(self, etag: str) -> bool: ...
+ def contains_weak(self, etag: str) -> bool: ...
+ def contains(self, etag: str) -> bool: ...
+ def contains_raw(self, etag: str) -> bool: ...
+ def to_header(self) -> str: ...
+ def __call__(
+ self,
+ etag: Optional[str] = None,
+ data: Optional[bytes] = None,
+ include_weak: bool = False,
+ ) -> bool: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def __contains__(self, item: str) -> bool: ... # type: ignore
+
+class IfRange:
+ etag: Optional[str]
+ date: Optional[datetime]
+ def __init__(
+ self, etag: Optional[str] = None, date: Optional[datetime] = None
+ ) -> None: ...
+ def to_header(self) -> str: ...
+
+class Range:
+ units: str
+ ranges: List[Tuple[int, Optional[int]]]
+ def __init__(self, units: str, ranges: List[Tuple[int, Optional[int]]]) -> None: ...
+ def range_for_length(self, length: Optional[int]) -> Optional[Tuple[int, int]]: ...
+ def make_content_range(self, length: Optional[int]) -> Optional[ContentRange]: ...
+ def to_header(self) -> str: ...
+ def to_content_range_header(self, length: Optional[int]) -> Optional[str]: ...
+
+def _callback_property(name: str) -> property: ...
+
+class ContentRange:
+ on_update: Optional[Callable[[ContentRange], None]]
+ def __init__(
+ self,
+ units: Optional[str],
+ start: Optional[int],
+ stop: Optional[int],
+ length: Optional[int] = None,
+ on_update: Optional[Callable[[ContentRange], None]] = None,
+ ) -> None: ...
+ @property
+ def units(self) -> Optional[str]: ...
+ @units.setter
+ def units(self, value: Optional[str]) -> None: ...
+ @property
+ def start(self) -> Optional[int]: ...
+ @start.setter
+ def start(self, value: Optional[int]) -> None: ...
+ @property
+ def stop(self) -> Optional[int]: ...
+ @stop.setter
+ def stop(self, value: Optional[int]) -> None: ...
+ @property
+ def length(self) -> Optional[int]: ...
+ @length.setter
+ def length(self, value: Optional[int]) -> None: ...
+ def set(
+ self,
+ start: Optional[int],
+ stop: Optional[int],
+ length: Optional[int] = None,
+ units: Optional[str] = "bytes",
+ ) -> None: ...
+ def unset(self) -> None: ...
+ def to_header(self) -> str: ...
+
+class Authorization(ImmutableDictMixin[str, str], Dict[str, str]):
+ type: str
+ def __init__(
+ self,
+ auth_type: str,
+ data: Optional[Union[Mapping[str, str], Iterable[Tuple[str, str]]]] = None,
+ ) -> None: ...
+ @property
+ def username(self) -> Optional[str]: ...
+ @property
+ def password(self) -> Optional[str]: ...
+ @property
+ def realm(self) -> Optional[str]: ...
+ @property
+ def nonce(self) -> Optional[str]: ...
+ @property
+ def uri(self) -> Optional[str]: ...
+ @property
+ def nc(self) -> Optional[str]: ...
+ @property
+ def cnonce(self) -> Optional[str]: ...
+ @property
+ def response(self) -> Optional[str]: ...
+ @property
+ def opaque(self) -> Optional[str]: ...
+ @property
+ def qop(self) -> Optional[str]: ...
+ def to_header(self) -> str: ...
+
+def auth_property(name: str, doc: Optional[str] = None) -> property: ...
+def _set_property(name: str, doc: Optional[str] = None) -> property: ...
+
+class WWWAuthenticate(UpdateDictMixin[str, str], Dict[str, str]):
+ _require_quoting: FrozenSet[str]
+ def __init__(
+ self,
+ auth_type: Optional[str] = None,
+ values: Optional[Union[Mapping[str, str], Iterable[Tuple[str, str]]]] = None,
+ on_update: Optional[Callable[[WWWAuthenticate], None]] = None,
+ ) -> None: ...
+ def set_basic(self, realm: str = ...) -> None: ...
+ def set_digest(
+ self,
+ realm: str,
+ nonce: str,
+ qop: Iterable[str] = ("auth",),
+ opaque: Optional[str] = None,
+ algorithm: Optional[str] = None,
+ stale: bool = False,
+ ) -> None: ...
+ def to_header(self) -> str: ...
+ @property
+ def type(self) -> Optional[str]: ...
+ @type.setter
+ def type(self, value: Optional[str]) -> None: ...
+ @property
+ def realm(self) -> Optional[str]: ...
+ @realm.setter
+ def realm(self, value: Optional[str]) -> None: ...
+ @property
+ def domain(self) -> HeaderSet: ...
+ @property
+ def nonce(self) -> Optional[str]: ...
+ @nonce.setter
+ def nonce(self, value: Optional[str]) -> None: ...
+ @property
+ def opaque(self) -> Optional[str]: ...
+ @opaque.setter
+ def opaque(self, value: Optional[str]) -> None: ...
+ @property
+ def algorithm(self) -> Optional[str]: ...
+ @algorithm.setter
+ def algorithm(self, value: Optional[str]) -> None: ...
+ @property
+ def qop(self) -> HeaderSet: ...
+ @property
+ def stale(self) -> Optional[bool]: ...
+ @stale.setter
+ def stale(self, value: Optional[bool]) -> None: ...
+ @staticmethod
+ def auth_property(name: str, doc: Optional[str] = None) -> property: ...
+
+class FileStorage:
+ name: Optional[str]
+ stream: IO[bytes]
+ filename: Optional[str]
+ headers: Headers
+ _parsed_content_type: Tuple[str, Dict[str, str]]
+ def __init__(
+ self,
+ stream: Optional[IO[bytes]] = None,
+ filename: Optional[str] = None,
+ name: Optional[str] = None,
+ content_type: Optional[str] = None,
+ content_length: Optional[int] = None,
+ headers: Optional[Headers] = None,
+ ) -> None: ...
+ def _parse_content_type(self) -> None: ...
+ @property
+ def content_type(self) -> str: ...
+ @property
+ def content_length(self) -> int: ...
+ @property
+ def mimetype(self) -> str: ...
+ @property
+ def mimetype_params(self) -> Dict[str, str]: ...
+ def save(
+ self, dst: Union[str, PathLike, IO[bytes]], buffer_size: int = ...
+ ) -> None: ...
+ def close(self) -> None: ...
+ def __bool__(self) -> bool: ...
+ def __getattr__(self, name: str) -> Any: ...
+ def __iter__(self) -> Iterator[bytes]: ...
+ def __repr__(self) -> str: ...
diff --git a/contrib/python/aiohttp/aiohttp/_helpers.pyi b/contrib/python/aiohttp/aiohttp/_helpers.pyi
new file mode 100644
index 0000000000..1e35893702
--- /dev/null
+++ b/contrib/python/aiohttp/aiohttp/_helpers.pyi
@@ -0,0 +1,6 @@
+from typing import Any
+
+class reify:
+ def __init__(self, wrapped: Any) -> None: ...
+ def __get__(self, inst: Any, owner: Any) -> Any: ...
+ def __set__(self, inst: Any, value: Any) -> None: ...
diff --git a/contrib/python/aiosignal/aiosignal/__init__.pyi b/contrib/python/aiosignal/aiosignal/__init__.pyi
new file mode 100644
index 0000000000..d4e3416d72
--- /dev/null
+++ b/contrib/python/aiosignal/aiosignal/__init__.pyi
@@ -0,0 +1,12 @@
+from typing import Any, Generic, TypeVar
+
+from frozenlist import FrozenList
+
+__all__ = ("Signal",)
+
+_T = TypeVar("_T")
+
+class Signal(FrozenList[_T], Generic[_T]):
+ def __init__(self, owner: Any) -> None: ...
+ def __repr__(self) -> str: ...
+ async def send(self, *args: Any, **kwargs: Any) -> None: ...
diff --git a/contrib/python/attrs/py2/attr/__init__.pyi b/contrib/python/attrs/py2/attr/__init__.pyi
new file mode 100644
index 0000000000..3503b073b4
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/__init__.pyi
@@ -0,0 +1,475 @@
+import sys
+
+from typing import (
+ Any,
+ Callable,
+ Dict,
+ Generic,
+ List,
+ Mapping,
+ Optional,
+ Sequence,
+ Tuple,
+ Type,
+ TypeVar,
+ Union,
+ overload,
+)
+
+# `import X as X` is required to make these public
+from . import converters as converters
+from . import exceptions as exceptions
+from . import filters as filters
+from . import setters as setters
+from . import validators as validators
+from ._version_info import VersionInfo
+
+
+__version__: str
+__version_info__: VersionInfo
+__title__: str
+__description__: str
+__url__: str
+__uri__: str
+__author__: str
+__email__: str
+__license__: str
+__copyright__: str
+
+_T = TypeVar("_T")
+_C = TypeVar("_C", bound=type)
+
+_EqOrderType = Union[bool, Callable[[Any], Any]]
+_ValidatorType = Callable[[Any, Attribute[_T], _T], Any]
+_ConverterType = Callable[[Any], Any]
+_FilterType = Callable[[Attribute[_T], _T], bool]
+_ReprType = Callable[[Any], str]
+_ReprArgType = Union[bool, _ReprType]
+_OnSetAttrType = Callable[[Any, Attribute[Any], Any], Any]
+_OnSetAttrArgType = Union[
+ _OnSetAttrType, List[_OnSetAttrType], setters._NoOpType
+]
+_FieldTransformer = Callable[[type, List[Attribute[Any]]], List[Attribute[Any]]]
+# FIXME: in reality, if multiple validators are passed they must be in a list
+# or tuple, but those are invariant and so would prevent subtypes of
+# _ValidatorType from working when passed in a list or tuple.
+_ValidatorArgType = Union[_ValidatorType[_T], Sequence[_ValidatorType[_T]]]
+
+# _make --
+
+NOTHING: object
+
+# NOTE: Factory lies about its return type to make this possible:
+# `x: List[int] # = Factory(list)`
+# Work around mypy issue #4554 in the common case by using an overload.
+if sys.version_info >= (3, 8):
+ from typing import Literal
+
+ @overload
+ def Factory(factory: Callable[[], _T]) -> _T: ...
+ @overload
+ def Factory(
+ factory: Callable[[Any], _T],
+ takes_self: Literal[True],
+ ) -> _T: ...
+ @overload
+ def Factory(
+ factory: Callable[[], _T],
+ takes_self: Literal[False],
+ ) -> _T: ...
+else:
+ @overload
+ def Factory(factory: Callable[[], _T]) -> _T: ...
+ @overload
+ def Factory(
+ factory: Union[Callable[[Any], _T], Callable[[], _T]],
+ takes_self: bool = ...,
+ ) -> _T: ...
+
+# Static type inference support via __dataclass_transform__ implemented as per:
+# https://github.com/microsoft/pyright/blob/1.1.135/specs/dataclass_transforms.md
+# This annotation must be applied to all overloads of "define" and "attrs"
+#
+# NOTE: This is a typing construct and does not exist at runtime. Extensions
+# wrapping attrs decorators should declare a separate __dataclass_transform__
+# signature in the extension module using the specification linked above to
+# provide pyright support.
+def __dataclass_transform__(
+ *,
+ eq_default: bool = True,
+ order_default: bool = False,
+ kw_only_default: bool = False,
+ field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()),
+) -> Callable[[_T], _T]: ...
+
+class Attribute(Generic[_T]):
+ name: str
+ default: Optional[_T]
+ validator: Optional[_ValidatorType[_T]]
+ repr: _ReprArgType
+ cmp: _EqOrderType
+ eq: _EqOrderType
+ order: _EqOrderType
+ hash: Optional[bool]
+ init: bool
+ converter: Optional[_ConverterType]
+ metadata: Dict[Any, Any]
+ type: Optional[Type[_T]]
+ kw_only: bool
+ on_setattr: _OnSetAttrType
+
+ def evolve(self, **changes: Any) -> "Attribute[Any]": ...
+
+# NOTE: We had several choices for the annotation to use for type arg:
+# 1) Type[_T]
+# - Pros: Handles simple cases correctly
+# - Cons: Might produce less informative errors in the case of conflicting
+# TypeVars e.g. `attr.ib(default='bad', type=int)`
+# 2) Callable[..., _T]
+# - Pros: Better error messages than #1 for conflicting TypeVars
+# - Cons: Terrible error messages for validator checks.
+# e.g. attr.ib(type=int, validator=validate_str)
+# -> error: Cannot infer function type argument
+# 3) type (and do all of the work in the mypy plugin)
+# - Pros: Simple here, and we could customize the plugin with our own errors.
+# - Cons: Would need to write mypy plugin code to handle all the cases.
+# We chose option #1.
+
+# `attr` lies about its return type to make the following possible:
+# attr() -> Any
+# attr(8) -> int
+# attr(validator=<some callable>) -> Whatever the callable expects.
+# This makes this type of assignments possible:
+# x: int = attr(8)
+#
+# This form catches explicit None or no default but with no other arguments
+# returns Any.
+@overload
+def attrib(
+ default: None = ...,
+ validator: None = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: None = ...,
+ converter: None = ...,
+ factory: None = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> Any: ...
+
+# This form catches an explicit None or no default and infers the type from the
+# other arguments.
+@overload
+def attrib(
+ default: None = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: Optional[Type[_T]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> _T: ...
+
+# This form catches an explicit default argument.
+@overload
+def attrib(
+ default: _T,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: Optional[Type[_T]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> _T: ...
+
+# This form covers type=non-Type: e.g. forward references (str), Any
+@overload
+def attrib(
+ default: Optional[_T] = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: object = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> Any: ...
+@overload
+def field(
+ *,
+ default: None = ...,
+ validator: None = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: None = ...,
+ factory: None = ...,
+ kw_only: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> Any: ...
+
+# This form catches an explicit None or no default and infers the type from the
+# other arguments.
+@overload
+def field(
+ *,
+ default: None = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> _T: ...
+
+# This form catches an explicit default argument.
+@overload
+def field(
+ *,
+ default: _T,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> _T: ...
+
+# This form covers type=non-Type: e.g. forward references (str), Any
+@overload
+def field(
+ *,
+ default: Optional[_T] = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+) -> Any: ...
+@overload
+@__dataclass_transform__(order_default=True, field_descriptors=(attrib, field))
+def attrs(
+ maybe_cls: _C,
+ these: Optional[Dict[str, Any]] = ...,
+ repr_ns: Optional[str] = ...,
+ repr: bool = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ auto_detect: bool = ...,
+ collect_by_mro: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+) -> _C: ...
+@overload
+@__dataclass_transform__(order_default=True, field_descriptors=(attrib, field))
+def attrs(
+ maybe_cls: None = ...,
+ these: Optional[Dict[str, Any]] = ...,
+ repr_ns: Optional[str] = ...,
+ repr: bool = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ auto_detect: bool = ...,
+ collect_by_mro: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+) -> Callable[[_C], _C]: ...
+@overload
+@__dataclass_transform__(field_descriptors=(attrib, field))
+def define(
+ maybe_cls: _C,
+ *,
+ these: Optional[Dict[str, Any]] = ...,
+ repr: bool = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ auto_detect: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+) -> _C: ...
+@overload
+@__dataclass_transform__(field_descriptors=(attrib, field))
+def define(
+ maybe_cls: None = ...,
+ *,
+ these: Optional[Dict[str, Any]] = ...,
+ repr: bool = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ auto_detect: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+) -> Callable[[_C], _C]: ...
+
+mutable = define
+frozen = define # they differ only in their defaults
+
+# TODO: add support for returning NamedTuple from the mypy plugin
+class _Fields(Tuple[Attribute[Any], ...]):
+ def __getattr__(self, name: str) -> Attribute[Any]: ...
+
+def fields(cls: type) -> _Fields: ...
+def fields_dict(cls: type) -> Dict[str, Attribute[Any]]: ...
+def validate(inst: Any) -> None: ...
+def resolve_types(
+ cls: _C,
+ globalns: Optional[Dict[str, Any]] = ...,
+ localns: Optional[Dict[str, Any]] = ...,
+ attribs: Optional[List[Attribute[Any]]] = ...,
+) -> _C: ...
+
+# TODO: add support for returning a proper attrs class from the mypy plugin
+# we use Any instead of _CountingAttr so that e.g. `make_class('Foo',
+# [attr.ib()])` is valid
+def make_class(
+ name: str,
+ attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]],
+ bases: Tuple[type, ...] = ...,
+ repr_ns: Optional[str] = ...,
+ repr: bool = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ collect_by_mro: bool = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+) -> type: ...
+
+# _funcs --
+
+# TODO: add support for returning TypedDict from the mypy plugin
+# FIXME: asdict/astuple do not honor their factory args. Waiting on one of
+# these:
+# https://github.com/python/mypy/issues/4236
+# https://github.com/python/typing/issues/253
+def asdict(
+ inst: Any,
+ recurse: bool = ...,
+ filter: Optional[_FilterType[Any]] = ...,
+ dict_factory: Type[Mapping[Any, Any]] = ...,
+ retain_collection_types: bool = ...,
+ value_serializer: Optional[Callable[[type, Attribute[Any], Any], Any]] = ...,
+) -> Dict[str, Any]: ...
+
+# TODO: add support for returning NamedTuple from the mypy plugin
+def astuple(
+ inst: Any,
+ recurse: bool = ...,
+ filter: Optional[_FilterType[Any]] = ...,
+ tuple_factory: Type[Sequence[Any]] = ...,
+ retain_collection_types: bool = ...,
+) -> Tuple[Any, ...]: ...
+def has(cls: type) -> bool: ...
+def assoc(inst: _T, **changes: Any) -> _T: ...
+def evolve(inst: _T, **changes: Any) -> _T: ...
+
+# _config --
+
+def set_run_validators(run: bool) -> None: ...
+def get_run_validators() -> bool: ...
+
+# aliases --
+
+s = attributes = attrs
+ib = attr = attrib
+dataclass = attrs # Technically, partial(attrs, auto_attribs=True) ;)
diff --git a/contrib/python/attrs/py2/attr/_cmp.pyi b/contrib/python/attrs/py2/attr/_cmp.pyi
new file mode 100644
index 0000000000..7093550f0f
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/_cmp.pyi
@@ -0,0 +1,14 @@
+from typing import Type
+
+from . import _CompareWithType
+
+
+def cmp_using(
+ eq: Optional[_CompareWithType],
+ lt: Optional[_CompareWithType],
+ le: Optional[_CompareWithType],
+ gt: Optional[_CompareWithType],
+ ge: Optional[_CompareWithType],
+ require_same_type: bool,
+ class_name: str,
+) -> Type: ...
diff --git a/contrib/python/attrs/py2/attr/_version_info.pyi b/contrib/python/attrs/py2/attr/_version_info.pyi
new file mode 100644
index 0000000000..45ced08633
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/_version_info.pyi
@@ -0,0 +1,9 @@
+class VersionInfo:
+ @property
+ def year(self) -> int: ...
+ @property
+ def minor(self) -> int: ...
+ @property
+ def micro(self) -> int: ...
+ @property
+ def releaselevel(self) -> str: ...
diff --git a/contrib/python/attrs/py2/attr/converters.pyi b/contrib/python/attrs/py2/attr/converters.pyi
new file mode 100644
index 0000000000..84a57590b0
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/converters.pyi
@@ -0,0 +1,13 @@
+from typing import Callable, Optional, TypeVar, overload
+
+from . import _ConverterType
+
+
+_T = TypeVar("_T")
+
+def pipe(*validators: _ConverterType) -> _ConverterType: ...
+def optional(converter: _ConverterType) -> _ConverterType: ...
+@overload
+def default_if_none(default: _T) -> _ConverterType: ...
+@overload
+def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType: ...
diff --git a/contrib/python/attrs/py2/attr/exceptions.pyi b/contrib/python/attrs/py2/attr/exceptions.pyi
new file mode 100644
index 0000000000..a800fb26bb
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/exceptions.pyi
@@ -0,0 +1,18 @@
+from typing import Any
+
+
+class FrozenError(AttributeError):
+ msg: str = ...
+
+class FrozenInstanceError(FrozenError): ...
+class FrozenAttributeError(FrozenError): ...
+class AttrsAttributeNotFoundError(ValueError): ...
+class NotAnAttrsClassError(ValueError): ...
+class DefaultAlreadySetError(RuntimeError): ...
+class UnannotatedAttributeError(RuntimeError): ...
+class PythonTooOldError(RuntimeError): ...
+
+class NotCallableError(TypeError):
+ msg: str = ...
+ value: Any = ...
+ def __init__(self, msg: str, value: Any) -> None: ...
diff --git a/contrib/python/attrs/py2/attr/filters.pyi b/contrib/python/attrs/py2/attr/filters.pyi
new file mode 100644
index 0000000000..f7b63f1bb4
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/filters.pyi
@@ -0,0 +1,7 @@
+from typing import Any, Union
+
+from . import Attribute, _FilterType
+
+
+def include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ...
+def exclude(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ...
diff --git a/contrib/python/attrs/py2/attr/setters.pyi b/contrib/python/attrs/py2/attr/setters.pyi
new file mode 100644
index 0000000000..a921e07deb
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/setters.pyi
@@ -0,0 +1,20 @@
+from typing import Any, NewType, NoReturn, TypeVar, cast
+
+from . import Attribute, _OnSetAttrType
+
+
+_T = TypeVar("_T")
+
+def frozen(
+ instance: Any, attribute: Attribute[Any], new_value: Any
+) -> NoReturn: ...
+def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
+def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
+
+# convert is allowed to return Any, because they can be chained using pipe.
+def convert(
+ instance: Any, attribute: Attribute[Any], new_value: Any
+) -> Any: ...
+
+_NoOpType = NewType("_NoOpType", object)
+NO_OP: _NoOpType
diff --git a/contrib/python/attrs/py2/attr/validators.pyi b/contrib/python/attrs/py2/attr/validators.pyi
new file mode 100644
index 0000000000..fe92aac421
--- /dev/null
+++ b/contrib/python/attrs/py2/attr/validators.pyi
@@ -0,0 +1,68 @@
+from typing import (
+ Any,
+ AnyStr,
+ Callable,
+ Container,
+ Iterable,
+ List,
+ Mapping,
+ Match,
+ Optional,
+ Tuple,
+ Type,
+ TypeVar,
+ Union,
+ overload,
+)
+
+from . import _ValidatorType
+
+
+_T = TypeVar("_T")
+_T1 = TypeVar("_T1")
+_T2 = TypeVar("_T2")
+_T3 = TypeVar("_T3")
+_I = TypeVar("_I", bound=Iterable)
+_K = TypeVar("_K")
+_V = TypeVar("_V")
+_M = TypeVar("_M", bound=Mapping)
+
+# To be more precise on instance_of use some overloads.
+# If there are more than 3 items in the tuple then we fall back to Any
+@overload
+def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ...
+@overload
+def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ...
+@overload
+def instance_of(
+ type: Tuple[Type[_T1], Type[_T2]]
+) -> _ValidatorType[Union[_T1, _T2]]: ...
+@overload
+def instance_of(
+ type: Tuple[Type[_T1], Type[_T2], Type[_T3]]
+) -> _ValidatorType[Union[_T1, _T2, _T3]]: ...
+@overload
+def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ...
+def provides(interface: Any) -> _ValidatorType[Any]: ...
+def optional(
+ validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]
+) -> _ValidatorType[Optional[_T]]: ...
+def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
+def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
+def matches_re(
+ regex: AnyStr,
+ flags: int = ...,
+ func: Optional[
+ Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]]
+ ] = ...,
+) -> _ValidatorType[AnyStr]: ...
+def deep_iterable(
+ member_validator: _ValidatorType[_T],
+ iterable_validator: Optional[_ValidatorType[_I]] = ...,
+) -> _ValidatorType[_I]: ...
+def deep_mapping(
+ key_validator: _ValidatorType[_K],
+ value_validator: _ValidatorType[_V],
+ mapping_validator: Optional[_ValidatorType[_M]] = ...,
+) -> _ValidatorType[_M]: ...
+def is_callable() -> _ValidatorType[_T]: ...
diff --git a/contrib/python/attrs/py3/attr/__init__.pyi b/contrib/python/attrs/py3/attr/__init__.pyi
new file mode 100644
index 0000000000..37a208732a
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/__init__.pyi
@@ -0,0 +1,555 @@
+import enum
+import sys
+
+from typing import (
+ Any,
+ Callable,
+ Dict,
+ Generic,
+ List,
+ Mapping,
+ Optional,
+ Protocol,
+ Sequence,
+ Tuple,
+ Type,
+ TypeVar,
+ Union,
+ overload,
+)
+
+# `import X as X` is required to make these public
+from . import converters as converters
+from . import exceptions as exceptions
+from . import filters as filters
+from . import setters as setters
+from . import validators as validators
+from ._cmp import cmp_using as cmp_using
+from ._typing_compat import AttrsInstance_
+from ._version_info import VersionInfo
+
+if sys.version_info >= (3, 10):
+ from typing import TypeGuard
+else:
+ from typing_extensions import TypeGuard
+
+if sys.version_info >= (3, 11):
+ from typing import dataclass_transform
+else:
+ from typing_extensions import dataclass_transform
+
+__version__: str
+__version_info__: VersionInfo
+__title__: str
+__description__: str
+__url__: str
+__uri__: str
+__author__: str
+__email__: str
+__license__: str
+__copyright__: str
+
+_T = TypeVar("_T")
+_C = TypeVar("_C", bound=type)
+
+_EqOrderType = Union[bool, Callable[[Any], Any]]
+_ValidatorType = Callable[[Any, "Attribute[_T]", _T], Any]
+_ConverterType = Callable[[Any], Any]
+_FilterType = Callable[["Attribute[_T]", _T], bool]
+_ReprType = Callable[[Any], str]
+_ReprArgType = Union[bool, _ReprType]
+_OnSetAttrType = Callable[[Any, "Attribute[Any]", Any], Any]
+_OnSetAttrArgType = Union[
+ _OnSetAttrType, List[_OnSetAttrType], setters._NoOpType
+]
+_FieldTransformer = Callable[
+ [type, List["Attribute[Any]"]], List["Attribute[Any]"]
+]
+# FIXME: in reality, if multiple validators are passed they must be in a list
+# or tuple, but those are invariant and so would prevent subtypes of
+# _ValidatorType from working when passed in a list or tuple.
+_ValidatorArgType = Union[_ValidatorType[_T], Sequence[_ValidatorType[_T]]]
+
+# We subclass this here to keep the protocol's qualified name clean.
+class AttrsInstance(AttrsInstance_, Protocol):
+ pass
+
+_A = TypeVar("_A", bound=type[AttrsInstance])
+
+class _Nothing(enum.Enum):
+ NOTHING = enum.auto()
+
+NOTHING = _Nothing.NOTHING
+
+# NOTE: Factory lies about its return type to make this possible:
+# `x: List[int] # = Factory(list)`
+# Work around mypy issue #4554 in the common case by using an overload.
+if sys.version_info >= (3, 8):
+ from typing import Literal
+ @overload
+ def Factory(factory: Callable[[], _T]) -> _T: ...
+ @overload
+ def Factory(
+ factory: Callable[[Any], _T],
+ takes_self: Literal[True],
+ ) -> _T: ...
+ @overload
+ def Factory(
+ factory: Callable[[], _T],
+ takes_self: Literal[False],
+ ) -> _T: ...
+
+else:
+ @overload
+ def Factory(factory: Callable[[], _T]) -> _T: ...
+ @overload
+ def Factory(
+ factory: Union[Callable[[Any], _T], Callable[[], _T]],
+ takes_self: bool = ...,
+ ) -> _T: ...
+
+class Attribute(Generic[_T]):
+ name: str
+ default: Optional[_T]
+ validator: Optional[_ValidatorType[_T]]
+ repr: _ReprArgType
+ cmp: _EqOrderType
+ eq: _EqOrderType
+ order: _EqOrderType
+ hash: Optional[bool]
+ init: bool
+ converter: Optional[_ConverterType]
+ metadata: Dict[Any, Any]
+ type: Optional[Type[_T]]
+ kw_only: bool
+ on_setattr: _OnSetAttrType
+ alias: Optional[str]
+
+ def evolve(self, **changes: Any) -> "Attribute[Any]": ...
+
+# NOTE: We had several choices for the annotation to use for type arg:
+# 1) Type[_T]
+# - Pros: Handles simple cases correctly
+# - Cons: Might produce less informative errors in the case of conflicting
+# TypeVars e.g. `attr.ib(default='bad', type=int)`
+# 2) Callable[..., _T]
+# - Pros: Better error messages than #1 for conflicting TypeVars
+# - Cons: Terrible error messages for validator checks.
+# e.g. attr.ib(type=int, validator=validate_str)
+# -> error: Cannot infer function type argument
+# 3) type (and do all of the work in the mypy plugin)
+# - Pros: Simple here, and we could customize the plugin with our own errors.
+# - Cons: Would need to write mypy plugin code to handle all the cases.
+# We chose option #1.
+
+# `attr` lies about its return type to make the following possible:
+# attr() -> Any
+# attr(8) -> int
+# attr(validator=<some callable>) -> Whatever the callable expects.
+# This makes this type of assignments possible:
+# x: int = attr(8)
+#
+# This form catches explicit None or no default but with no other arguments
+# returns Any.
+@overload
+def attrib(
+ default: None = ...,
+ validator: None = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: None = ...,
+ converter: None = ...,
+ factory: None = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+) -> Any: ...
+
+# This form catches an explicit None or no default and infers the type from the
+# other arguments.
+@overload
+def attrib(
+ default: None = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: Optional[Type[_T]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+) -> _T: ...
+
+# This form catches an explicit default argument.
+@overload
+def attrib(
+ default: _T,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: Optional[Type[_T]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+) -> _T: ...
+
+# This form covers type=non-Type: e.g. forward references (str), Any
+@overload
+def attrib(
+ default: Optional[_T] = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ type: object = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+) -> Any: ...
+@overload
+def field(
+ *,
+ default: None = ...,
+ validator: None = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: None = ...,
+ factory: None = ...,
+ kw_only: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+ type: Optional[type] = ...,
+) -> Any: ...
+
+# This form catches an explicit None or no default and infers the type from the
+# other arguments.
+@overload
+def field(
+ *,
+ default: None = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+ type: Optional[type] = ...,
+) -> _T: ...
+
+# This form catches an explicit default argument.
+@overload
+def field(
+ *,
+ default: _T,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+ type: Optional[type] = ...,
+) -> _T: ...
+
+# This form covers type=non-Type: e.g. forward references (str), Any
+@overload
+def field(
+ *,
+ default: Optional[_T] = ...,
+ validator: Optional[_ValidatorArgType[_T]] = ...,
+ repr: _ReprArgType = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ metadata: Optional[Mapping[Any, Any]] = ...,
+ converter: Optional[_ConverterType] = ...,
+ factory: Optional[Callable[[], _T]] = ...,
+ kw_only: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ alias: Optional[str] = ...,
+ type: Optional[type] = ...,
+) -> Any: ...
+@overload
+@dataclass_transform(order_default=True, field_specifiers=(attrib, field))
+def attrs(
+ maybe_cls: _C,
+ these: Optional[Dict[str, Any]] = ...,
+ repr_ns: Optional[str] = ...,
+ repr: bool = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ auto_detect: bool = ...,
+ collect_by_mro: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+ match_args: bool = ...,
+ unsafe_hash: Optional[bool] = ...,
+) -> _C: ...
+@overload
+@dataclass_transform(order_default=True, field_specifiers=(attrib, field))
+def attrs(
+ maybe_cls: None = ...,
+ these: Optional[Dict[str, Any]] = ...,
+ repr_ns: Optional[str] = ...,
+ repr: bool = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ auto_detect: bool = ...,
+ collect_by_mro: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+ match_args: bool = ...,
+ unsafe_hash: Optional[bool] = ...,
+) -> Callable[[_C], _C]: ...
+@overload
+@dataclass_transform(field_specifiers=(attrib, field))
+def define(
+ maybe_cls: _C,
+ *,
+ these: Optional[Dict[str, Any]] = ...,
+ repr: bool = ...,
+ unsafe_hash: Optional[bool] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ auto_detect: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+ match_args: bool = ...,
+) -> _C: ...
+@overload
+@dataclass_transform(field_specifiers=(attrib, field))
+def define(
+ maybe_cls: None = ...,
+ *,
+ these: Optional[Dict[str, Any]] = ...,
+ repr: bool = ...,
+ unsafe_hash: Optional[bool] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ auto_detect: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+ match_args: bool = ...,
+) -> Callable[[_C], _C]: ...
+
+mutable = define
+
+@overload
+@dataclass_transform(frozen_default=True, field_specifiers=(attrib, field))
+def frozen(
+ maybe_cls: _C,
+ *,
+ these: Optional[Dict[str, Any]] = ...,
+ repr: bool = ...,
+ unsafe_hash: Optional[bool] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ auto_detect: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+ match_args: bool = ...,
+) -> _C: ...
+@overload
+@dataclass_transform(frozen_default=True, field_specifiers=(attrib, field))
+def frozen(
+ maybe_cls: None = ...,
+ *,
+ these: Optional[Dict[str, Any]] = ...,
+ repr: bool = ...,
+ unsafe_hash: Optional[bool] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[bool] = ...,
+ order: Optional[bool] = ...,
+ auto_detect: bool = ...,
+ getstate_setstate: Optional[bool] = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+ match_args: bool = ...,
+) -> Callable[[_C], _C]: ...
+def fields(cls: Type[AttrsInstance]) -> Any: ...
+def fields_dict(cls: Type[AttrsInstance]) -> Dict[str, Attribute[Any]]: ...
+def validate(inst: AttrsInstance) -> None: ...
+def resolve_types(
+ cls: _A,
+ globalns: Optional[Dict[str, Any]] = ...,
+ localns: Optional[Dict[str, Any]] = ...,
+ attribs: Optional[List[Attribute[Any]]] = ...,
+ include_extras: bool = ...,
+) -> _A: ...
+
+# TODO: add support for returning a proper attrs class from the mypy plugin
+# we use Any instead of _CountingAttr so that e.g. `make_class('Foo',
+# [attr.ib()])` is valid
+def make_class(
+ name: str,
+ attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]],
+ bases: Tuple[type, ...] = ...,
+ class_body: Optional[Dict[str, Any]] = ...,
+ repr_ns: Optional[str] = ...,
+ repr: bool = ...,
+ cmp: Optional[_EqOrderType] = ...,
+ hash: Optional[bool] = ...,
+ init: bool = ...,
+ slots: bool = ...,
+ frozen: bool = ...,
+ weakref_slot: bool = ...,
+ str: bool = ...,
+ auto_attribs: bool = ...,
+ kw_only: bool = ...,
+ cache_hash: bool = ...,
+ auto_exc: bool = ...,
+ eq: Optional[_EqOrderType] = ...,
+ order: Optional[_EqOrderType] = ...,
+ collect_by_mro: bool = ...,
+ on_setattr: Optional[_OnSetAttrArgType] = ...,
+ field_transformer: Optional[_FieldTransformer] = ...,
+) -> type: ...
+
+# _funcs --
+
+# TODO: add support for returning TypedDict from the mypy plugin
+# FIXME: asdict/astuple do not honor their factory args. Waiting on one of
+# these:
+# https://github.com/python/mypy/issues/4236
+# https://github.com/python/typing/issues/253
+# XXX: remember to fix attrs.asdict/astuple too!
+def asdict(
+ inst: AttrsInstance,
+ recurse: bool = ...,
+ filter: Optional[_FilterType[Any]] = ...,
+ dict_factory: Type[Mapping[Any, Any]] = ...,
+ retain_collection_types: bool = ...,
+ value_serializer: Optional[
+ Callable[[type, Attribute[Any], Any], Any]
+ ] = ...,
+ tuple_keys: Optional[bool] = ...,
+) -> Dict[str, Any]: ...
+
+# TODO: add support for returning NamedTuple from the mypy plugin
+def astuple(
+ inst: AttrsInstance,
+ recurse: bool = ...,
+ filter: Optional[_FilterType[Any]] = ...,
+ tuple_factory: Type[Sequence[Any]] = ...,
+ retain_collection_types: bool = ...,
+) -> Tuple[Any, ...]: ...
+def has(cls: type) -> TypeGuard[Type[AttrsInstance]]: ...
+def assoc(inst: _T, **changes: Any) -> _T: ...
+def evolve(inst: _T, **changes: Any) -> _T: ...
+
+# _config --
+
+def set_run_validators(run: bool) -> None: ...
+def get_run_validators() -> bool: ...
+
+# aliases --
+
+s = attributes = attrs
+ib = attr = attrib
+dataclass = attrs # Technically, partial(attrs, auto_attribs=True) ;)
diff --git a/contrib/python/attrs/py3/attr/_cmp.pyi b/contrib/python/attrs/py3/attr/_cmp.pyi
new file mode 100644
index 0000000000..f3dcdc1a75
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/_cmp.pyi
@@ -0,0 +1,13 @@
+from typing import Any, Callable, Optional, Type
+
+_CompareWithType = Callable[[Any, Any], bool]
+
+def cmp_using(
+ eq: Optional[_CompareWithType] = ...,
+ lt: Optional[_CompareWithType] = ...,
+ le: Optional[_CompareWithType] = ...,
+ gt: Optional[_CompareWithType] = ...,
+ ge: Optional[_CompareWithType] = ...,
+ require_same_type: bool = ...,
+ class_name: str = ...,
+) -> Type: ...
diff --git a/contrib/python/attrs/py3/attr/_typing_compat.pyi b/contrib/python/attrs/py3/attr/_typing_compat.pyi
new file mode 100644
index 0000000000..ca7b71e906
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/_typing_compat.pyi
@@ -0,0 +1,15 @@
+from typing import Any, ClassVar, Protocol
+
+# MYPY is a special constant in mypy which works the same way as `TYPE_CHECKING`.
+MYPY = False
+
+if MYPY:
+ # A protocol to be able to statically accept an attrs class.
+ class AttrsInstance_(Protocol):
+ __attrs_attrs__: ClassVar[Any]
+
+else:
+ # For type checkers without plug-in support use an empty protocol that
+ # will (hopefully) be combined into a union.
+ class AttrsInstance_(Protocol):
+ pass
diff --git a/contrib/python/attrs/py3/attr/_version_info.pyi b/contrib/python/attrs/py3/attr/_version_info.pyi
new file mode 100644
index 0000000000..45ced08633
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/_version_info.pyi
@@ -0,0 +1,9 @@
+class VersionInfo:
+ @property
+ def year(self) -> int: ...
+ @property
+ def minor(self) -> int: ...
+ @property
+ def micro(self) -> int: ...
+ @property
+ def releaselevel(self) -> str: ...
diff --git a/contrib/python/attrs/py3/attr/converters.pyi b/contrib/python/attrs/py3/attr/converters.pyi
new file mode 100644
index 0000000000..5abb49f6d5
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/converters.pyi
@@ -0,0 +1,13 @@
+from typing import Callable, TypeVar, overload
+
+from . import _ConverterType
+
+_T = TypeVar("_T")
+
+def pipe(*validators: _ConverterType) -> _ConverterType: ...
+def optional(converter: _ConverterType) -> _ConverterType: ...
+@overload
+def default_if_none(default: _T) -> _ConverterType: ...
+@overload
+def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType: ...
+def to_bool(val: str) -> bool: ...
diff --git a/contrib/python/attrs/py3/attr/exceptions.pyi b/contrib/python/attrs/py3/attr/exceptions.pyi
new file mode 100644
index 0000000000..f2680118b4
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/exceptions.pyi
@@ -0,0 +1,17 @@
+from typing import Any
+
+class FrozenError(AttributeError):
+ msg: str = ...
+
+class FrozenInstanceError(FrozenError): ...
+class FrozenAttributeError(FrozenError): ...
+class AttrsAttributeNotFoundError(ValueError): ...
+class NotAnAttrsClassError(ValueError): ...
+class DefaultAlreadySetError(RuntimeError): ...
+class UnannotatedAttributeError(RuntimeError): ...
+class PythonTooOldError(RuntimeError): ...
+
+class NotCallableError(TypeError):
+ msg: str = ...
+ value: Any = ...
+ def __init__(self, msg: str, value: Any) -> None: ...
diff --git a/contrib/python/attrs/py3/attr/filters.pyi b/contrib/python/attrs/py3/attr/filters.pyi
new file mode 100644
index 0000000000..8a02fa0fc0
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/filters.pyi
@@ -0,0 +1,6 @@
+from typing import Any, Union
+
+from . import Attribute, _FilterType
+
+def include(*what: Union[type, str, Attribute[Any]]) -> _FilterType[Any]: ...
+def exclude(*what: Union[type, str, Attribute[Any]]) -> _FilterType[Any]: ...
diff --git a/contrib/python/attrs/py3/attr/setters.pyi b/contrib/python/attrs/py3/attr/setters.pyi
new file mode 100644
index 0000000000..72f7ce4761
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/setters.pyi
@@ -0,0 +1,19 @@
+from typing import Any, NewType, NoReturn, TypeVar
+
+from . import Attribute, _OnSetAttrType
+
+_T = TypeVar("_T")
+
+def frozen(
+ instance: Any, attribute: Attribute[Any], new_value: Any
+) -> NoReturn: ...
+def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
+def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
+
+# convert is allowed to return Any, because they can be chained using pipe.
+def convert(
+ instance: Any, attribute: Attribute[Any], new_value: Any
+) -> Any: ...
+
+_NoOpType = NewType("_NoOpType", object)
+NO_OP: _NoOpType
diff --git a/contrib/python/attrs/py3/attr/validators.pyi b/contrib/python/attrs/py3/attr/validators.pyi
new file mode 100644
index 0000000000..d194a75abc
--- /dev/null
+++ b/contrib/python/attrs/py3/attr/validators.pyi
@@ -0,0 +1,88 @@
+from typing import (
+ Any,
+ AnyStr,
+ Callable,
+ Container,
+ ContextManager,
+ Iterable,
+ List,
+ Mapping,
+ Match,
+ Optional,
+ Pattern,
+ Tuple,
+ Type,
+ TypeVar,
+ Union,
+ overload,
+)
+
+from . import _ValidatorType
+from . import _ValidatorArgType
+
+_T = TypeVar("_T")
+_T1 = TypeVar("_T1")
+_T2 = TypeVar("_T2")
+_T3 = TypeVar("_T3")
+_I = TypeVar("_I", bound=Iterable)
+_K = TypeVar("_K")
+_V = TypeVar("_V")
+_M = TypeVar("_M", bound=Mapping)
+
+def set_disabled(run: bool) -> None: ...
+def get_disabled() -> bool: ...
+def disabled() -> ContextManager[None]: ...
+
+# To be more precise on instance_of use some overloads.
+# If there are more than 3 items in the tuple then we fall back to Any
+@overload
+def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ...
+@overload
+def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ...
+@overload
+def instance_of(
+ type: Tuple[Type[_T1], Type[_T2]]
+) -> _ValidatorType[Union[_T1, _T2]]: ...
+@overload
+def instance_of(
+ type: Tuple[Type[_T1], Type[_T2], Type[_T3]]
+) -> _ValidatorType[Union[_T1, _T2, _T3]]: ...
+@overload
+def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ...
+def provides(interface: Any) -> _ValidatorType[Any]: ...
+def optional(
+ validator: Union[
+ _ValidatorType[_T], List[_ValidatorType[_T]], Tuple[_ValidatorType[_T]]
+ ]
+) -> _ValidatorType[Optional[_T]]: ...
+def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
+def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
+def matches_re(
+ regex: Union[Pattern[AnyStr], AnyStr],
+ flags: int = ...,
+ func: Optional[
+ Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]]
+ ] = ...,
+) -> _ValidatorType[AnyStr]: ...
+def deep_iterable(
+ member_validator: _ValidatorArgType[_T],
+ iterable_validator: Optional[_ValidatorType[_I]] = ...,
+) -> _ValidatorType[_I]: ...
+def deep_mapping(
+ key_validator: _ValidatorType[_K],
+ value_validator: _ValidatorType[_V],
+ mapping_validator: Optional[_ValidatorType[_M]] = ...,
+) -> _ValidatorType[_M]: ...
+def is_callable() -> _ValidatorType[_T]: ...
+def lt(val: _T) -> _ValidatorType[_T]: ...
+def le(val: _T) -> _ValidatorType[_T]: ...
+def ge(val: _T) -> _ValidatorType[_T]: ...
+def gt(val: _T) -> _ValidatorType[_T]: ...
+def max_len(length: int) -> _ValidatorType[_T]: ...
+def min_len(length: int) -> _ValidatorType[_T]: ...
+def not_(
+ validator: _ValidatorType[_T],
+ *,
+ msg: Optional[str] = None,
+ exc_types: Union[Type[Exception], Iterable[Type[Exception]]] = ...,
+) -> _ValidatorType[_T]: ...
diff --git a/contrib/python/attrs/py3/attrs/__init__.pyi b/contrib/python/attrs/py3/attrs/__init__.pyi
new file mode 100644
index 0000000000..9372cfea16
--- /dev/null
+++ b/contrib/python/attrs/py3/attrs/__init__.pyi
@@ -0,0 +1,67 @@
+from typing import (
+ Any,
+ Callable,
+ Dict,
+ Mapping,
+ Optional,
+ Sequence,
+ Tuple,
+ Type,
+)
+
+# Because we need to type our own stuff, we have to make everything from
+# attr explicitly public too.
+from attr import __author__ as __author__
+from attr import __copyright__ as __copyright__
+from attr import __description__ as __description__
+from attr import __email__ as __email__
+from attr import __license__ as __license__
+from attr import __title__ as __title__
+from attr import __url__ as __url__
+from attr import __version__ as __version__
+from attr import __version_info__ as __version_info__
+from attr import _FilterType
+from attr import assoc as assoc
+from attr import Attribute as Attribute
+from attr import AttrsInstance as AttrsInstance
+from attr import cmp_using as cmp_using
+from attr import converters as converters
+from attr import define as define
+from attr import evolve as evolve
+from attr import exceptions as exceptions
+from attr import Factory as Factory
+from attr import field as field
+from attr import fields as fields
+from attr import fields_dict as fields_dict
+from attr import filters as filters
+from attr import frozen as frozen
+from attr import has as has
+from attr import make_class as make_class
+from attr import mutable as mutable
+from attr import NOTHING as NOTHING
+from attr import resolve_types as resolve_types
+from attr import setters as setters
+from attr import validate as validate
+from attr import validators as validators
+
+# TODO: see definition of attr.asdict/astuple
+def asdict(
+ inst: AttrsInstance,
+ recurse: bool = ...,
+ filter: Optional[_FilterType[Any]] = ...,
+ dict_factory: Type[Mapping[Any, Any]] = ...,
+ retain_collection_types: bool = ...,
+ value_serializer: Optional[
+ Callable[[type, Attribute[Any], Any], Any]
+ ] = ...,
+ tuple_keys: bool = ...,
+) -> Dict[str, Any]: ...
+
+# TODO: add support for returning NamedTuple from the mypy plugin
+def astuple(
+ inst: AttrsInstance,
+ recurse: bool = ...,
+ filter: Optional[_FilterType[Any]] = ...,
+ tuple_factory: Type[Sequence[Any]] = ...,
+ retain_collection_types: bool = ...,
+) -> Tuple[Any, ...]: ...
diff --git a/contrib/python/contextlib2/py3/contextlib2/__init__.pyi b/contrib/python/contextlib2/py3/contextlib2/__init__.pyi
new file mode 100644
index 0000000000..d42c6b05cb
--- /dev/null
+++ b/contrib/python/contextlib2/py3/contextlib2/__init__.pyi
@@ -0,0 +1,132 @@
+# Type hints copied from the typeshed project under the Apache License 2.0
+# https://github.com/python/typeshed/blob/64c85cdd449ccaff90b546676220c9ecfa6e697f/LICENSE
+
+import sys
+from types import TracebackType
+from typing import (
+ IO,
+ Any,
+ AsyncContextManager,
+ AsyncIterator,
+ Awaitable,
+ Callable,
+ ContextManager,
+ Iterator,
+ Optional,
+ Type,
+ TypeVar,
+ overload,
+)
+from typing_extensions import ParamSpec, Protocol
+
+# contextlib2 API adaptation notes:
+# * the various 'if True:' guards replace sys.version checks in the original
+# typeshed file (those APIs are available on all supported versions)
+# * deliberately omitted APIs are listed in `dev/mypy.allowlist`
+# (e.g. deprecated experimental APIs that never graduated to the stdlib)
+
+AbstractContextManager = ContextManager
+if True:
+ AbstractAsyncContextManager = AsyncContextManager
+
+_T = TypeVar("_T")
+_T_co = TypeVar("_T_co", covariant=True)
+_T_io = TypeVar("_T_io", bound=Optional[IO[str]])
+_F = TypeVar("_F", bound=Callable[..., Any])
+_P = ParamSpec("_P")
+
+_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool]
+_CM_EF = TypeVar("_CM_EF", ContextManager[Any], _ExitFunc)
+
+class _GeneratorContextManager(ContextManager[_T_co]):
+ def __call__(self, func: _F) -> _F: ...
+
+# type ignore to deal with incomplete ParamSpec support in mypy
+def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, _GeneratorContextManager[_T]]: ... # type: ignore
+
+if True:
+ def asynccontextmanager(func: Callable[_P, AsyncIterator[_T]]) -> Callable[_P, AsyncContextManager[_T]]: ... # type: ignore
+
+class _SupportsClose(Protocol):
+ def close(self) -> object: ...
+
+_SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose)
+
+class closing(ContextManager[_SupportsCloseT]):
+ def __init__(self, thing: _SupportsCloseT) -> None: ...
+
+if True:
+ class _SupportsAclose(Protocol):
+ async def aclose(self) -> object: ...
+ _SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose)
+ class aclosing(AsyncContextManager[_SupportsAcloseT]):
+ def __init__(self, thing: _SupportsAcloseT) -> None: ...
+ _AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]])
+ class AsyncContextDecorator:
+ def __call__(self, func: _AF) -> _AF: ...
+
+class suppress(ContextManager[None]):
+ def __init__(self, *exceptions: Type[BaseException]) -> None: ...
+ def __exit__(
+ self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
+ ) -> bool: ...
+
+class redirect_stdout(ContextManager[_T_io]):
+ def __init__(self, new_target: _T_io) -> None: ...
+
+class redirect_stderr(ContextManager[_T_io]):
+ def __init__(self, new_target: _T_io) -> None: ...
+
+class ContextDecorator:
+ def __call__(self, func: _F) -> _F: ...
+
+_U = TypeVar("_U", bound=ExitStack)
+
+class ExitStack(ContextManager[ExitStack]):
+ def __init__(self) -> None: ...
+ def enter_context(self, cm: ContextManager[_T]) -> _T: ...
+ def push(self, exit: _CM_EF) -> _CM_EF: ...
+ def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ...
+ def pop_all(self: _U) -> _U: ...
+ def close(self) -> None: ...
+ def __enter__(self: _U) -> _U: ...
+ def __exit__(
+ self,
+ __exc_type: Optional[Type[BaseException]],
+ __exc_value: Optional[BaseException],
+ __traceback: Optional[TracebackType],
+ ) -> bool: ...
+
+if True:
+ _S = TypeVar("_S", bound=AsyncExitStack)
+
+ _ExitCoroFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]]
+ _CallbackCoroFunc = Callable[..., Awaitable[Any]]
+ _ACM_EF = TypeVar("_ACM_EF", AsyncContextManager[Any], _ExitCoroFunc)
+ class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
+ def __init__(self) -> None: ...
+ def enter_context(self, cm: ContextManager[_T]) -> _T: ...
+ def enter_async_context(self, cm: AsyncContextManager[_T]) -> Awaitable[_T]: ...
+ def push(self, exit: _CM_EF) -> _CM_EF: ...
+ def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ...
+ def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ...
+ def push_async_callback(self, callback: _CallbackCoroFunc, *args: Any, **kwds: Any) -> _CallbackCoroFunc: ...
+ def pop_all(self: _S) -> _S: ...
+ def aclose(self) -> Awaitable[None]: ...
+ def __aenter__(self: _S) -> Awaitable[_S]: ...
+ def __aexit__(
+ self,
+ __exc_type: Optional[Type[BaseException]],
+ __exc_value: Optional[BaseException],
+ __traceback: Optional[TracebackType],
+ ) -> Awaitable[bool]: ...
+
+if True:
+ class nullcontext(AbstractContextManager[_T]):
+ enter_result: _T
+ @overload
+ def __init__(self: nullcontext[None], enter_result: None = ...) -> None: ...
+ @overload
+ def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
+ def __enter__(self) -> _T: ...
+ def __exit__(self, *exctype: Any) -> bool: ...
diff --git a/contrib/python/contourpy/contourpy/_contourpy.pyi b/contrib/python/contourpy/contourpy/_contourpy.pyi
new file mode 100644
index 0000000000..7cbca59023
--- /dev/null
+++ b/contrib/python/contourpy/contourpy/_contourpy.pyi
@@ -0,0 +1,202 @@
+from __future__ import annotations
+
+from typing import ClassVar, NoReturn
+
+import numpy as np
+import numpy.typing as npt
+from typing_extensions import TypeAlias
+
+import contourpy._contourpy as cpy
+
+# Input numpy array types, the same as in common.h
+CoordinateArray: TypeAlias = npt.NDArray[np.float64]
+MaskArray: TypeAlias = npt.NDArray[np.bool_]
+
+# Output numpy array types, the same as in common.h
+PointArray: TypeAlias = npt.NDArray[np.float64]
+CodeArray: TypeAlias = npt.NDArray[np.uint8]
+OffsetArray: TypeAlias = npt.NDArray[np.uint32]
+
+# Types returned from filled()
+FillReturn_OuterCode: TypeAlias = tuple[list[PointArray], list[CodeArray]]
+FillReturn_OuterOffset: TypeAlias = tuple[list[PointArray], list[OffsetArray]]
+FillReturn_ChunkCombinedCode: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None]]
+FillReturn_ChunkCombinedOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None]]
+FillReturn_ChunkCombinedCodeOffset: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None], list[OffsetArray | None]]
+FillReturn_ChunkCombinedOffsetOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None], list[OffsetArray | None]]
+FillReturn_Chunk: TypeAlias = FillReturn_ChunkCombinedCode | FillReturn_ChunkCombinedOffset | FillReturn_ChunkCombinedCodeOffset | FillReturn_ChunkCombinedOffsetOffset
+FillReturn: TypeAlias = FillReturn_OuterCode | FillReturn_OuterOffset | FillReturn_Chunk
+
+# Types returned from lines()
+LineReturn_Separate: TypeAlias = list[PointArray]
+LineReturn_SeparateCode: TypeAlias = tuple[list[PointArray], list[CodeArray]]
+LineReturn_ChunkCombinedCode: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None]]
+LineReturn_ChunkCombinedOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None]]
+LineReturn_ChunkCombinedNan: TypeAlias = tuple[list[PointArray | None]]
+LineReturn_Chunk: TypeAlias = LineReturn_ChunkCombinedCode | LineReturn_ChunkCombinedOffset | LineReturn_ChunkCombinedNan
+LineReturn: TypeAlias = LineReturn_Separate | LineReturn_SeparateCode | LineReturn_Chunk
+
+
+NDEBUG: int
+__version__: str
+
+class FillType:
+ ChunkCombinedCode: ClassVar[cpy.FillType]
+ ChunkCombinedCodeOffset: ClassVar[cpy.FillType]
+ ChunkCombinedOffset: ClassVar[cpy.FillType]
+ ChunkCombinedOffsetOffset: ClassVar[cpy.FillType]
+ OuterCode: ClassVar[cpy.FillType]
+ OuterOffset: ClassVar[cpy.FillType]
+ __members__: ClassVar[dict[str, cpy.FillType]]
+ def __eq__(self, other: object) -> bool: ...
+ def __getstate__(self) -> int: ...
+ def __hash__(self) -> int: ...
+ def __index__(self) -> int: ...
+ def __init__(self, value: int) -> None: ...
+ def __int__(self) -> int: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __repr__(self) -> str: ...
+ def __setstate__(self, state: int) -> NoReturn: ...
+ @property
+ def name(self) -> str: ...
+ @property
+ def value(self) -> int: ...
+
+class LineType:
+ ChunkCombinedCode: ClassVar[cpy.LineType]
+ ChunkCombinedNan: ClassVar[cpy.LineType]
+ ChunkCombinedOffset: ClassVar[cpy.LineType]
+ Separate: ClassVar[cpy.LineType]
+ SeparateCode: ClassVar[cpy.LineType]
+ __members__: ClassVar[dict[str, cpy.LineType]]
+ def __eq__(self, other: object) -> bool: ...
+ def __getstate__(self) -> int: ...
+ def __hash__(self) -> int: ...
+ def __index__(self) -> int: ...
+ def __init__(self, value: int) -> None: ...
+ def __int__(self) -> int: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __repr__(self) -> str: ...
+ def __setstate__(self, state: int) -> NoReturn: ...
+ @property
+ def name(self) -> str: ...
+ @property
+ def value(self) -> int: ...
+
+class ZInterp:
+ Linear: ClassVar[cpy.ZInterp]
+ Log: ClassVar[cpy.ZInterp]
+ __members__: ClassVar[dict[str, cpy.ZInterp]]
+ def __eq__(self, other: object) -> bool: ...
+ def __getstate__(self) -> int: ...
+ def __hash__(self) -> int: ...
+ def __index__(self) -> int: ...
+ def __init__(self, value: int) -> None: ...
+ def __int__(self) -> int: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __repr__(self) -> str: ...
+ def __setstate__(self, state: int) -> NoReturn: ...
+ @property
+ def name(self) -> str: ...
+ @property
+ def value(self) -> int: ...
+
+def max_threads() -> int: ...
+
+class ContourGenerator:
+ def create_contour(self, level: float) -> LineReturn: ...
+ def create_filled_contour(self, lower_level: float, upper_level: float) -> FillReturn: ...
+ def filled(self, lower_level: float, upper_level: float) -> FillReturn: ...
+ def lines(self, level: float) -> LineReturn: ...
+ @staticmethod
+ def supports_corner_mask() -> bool: ...
+ @staticmethod
+ def supports_fill_type(fill_type: FillType) -> bool: ...
+ @staticmethod
+ def supports_line_type(line_type: LineType) -> bool: ...
+ @staticmethod
+ def supports_quad_as_tri() -> bool: ...
+ @staticmethod
+ def supports_threads() -> bool: ...
+ @staticmethod
+ def supports_z_interp() -> bool: ...
+ @property
+ def chunk_count(self) -> tuple[int, int]: ...
+ @property
+ def chunk_size(self) -> tuple[int, int]: ...
+ @property
+ def corner_mask(self) -> bool: ...
+ @property
+ def fill_type(self) -> FillType: ...
+ @property
+ def line_type(self) -> LineType: ...
+ @property
+ def quad_as_tri(self) -> bool: ...
+ @property
+ def thread_count(self) -> int: ...
+ @property
+ def z_interp(self) -> ZInterp: ...
+ default_fill_type: cpy.FillType
+ default_line_type: cpy.LineType
+
+class Mpl2005ContourGenerator(ContourGenerator):
+ def __init__(
+ self,
+ x: CoordinateArray,
+ y: CoordinateArray,
+ z: CoordinateArray,
+ mask: MaskArray,
+ *,
+ x_chunk_size: int = 0,
+ y_chunk_size: int = 0,
+ ) -> None: ...
+
+class Mpl2014ContourGenerator(ContourGenerator):
+ def __init__(
+ self,
+ x: CoordinateArray,
+ y: CoordinateArray,
+ z: CoordinateArray,
+ mask: MaskArray,
+ *,
+ corner_mask: bool,
+ x_chunk_size: int = 0,
+ y_chunk_size: int = 0,
+ ) -> None: ...
+
+class SerialContourGenerator(ContourGenerator):
+ def __init__(
+ self,
+ x: CoordinateArray,
+ y: CoordinateArray,
+ z: CoordinateArray,
+ mask: MaskArray,
+ *,
+ corner_mask: bool,
+ line_type: LineType,
+ fill_type: FillType,
+ quad_as_tri: bool,
+ z_interp: ZInterp,
+ x_chunk_size: int = 0,
+ y_chunk_size: int = 0,
+ ) -> None: ...
+ def _write_cache(self) -> NoReturn: ...
+
+class ThreadedContourGenerator(ContourGenerator):
+ def __init__(
+ self,
+ x: CoordinateArray,
+ y: CoordinateArray,
+ z: CoordinateArray,
+ mask: MaskArray,
+ *,
+ corner_mask: bool,
+ line_type: LineType,
+ fill_type: FillType,
+ quad_as_tri: bool,
+ z_interp: ZInterp,
+ x_chunk_size: int = 0,
+ y_chunk_size: int = 0,
+ thread_count: int = 0,
+ ) -> None: ...
+ def _write_cache(self) -> None: ...
diff --git a/contrib/python/contourpy/contourpy/util/_build_config.pyi b/contrib/python/contourpy/contourpy/util/_build_config.pyi
new file mode 100644
index 0000000000..7ca4b0eb8c
--- /dev/null
+++ b/contrib/python/contourpy/contourpy/util/_build_config.pyi
@@ -0,0 +1,5 @@
+# Explicit type hints for dynamically-generated python file that mypy may not be able to find.
+
+from __future__ import annotations
+
+def build_config() -> dict[str, str]: ...
diff --git a/contrib/python/freezegun/py3/freezegun/__init__.pyi b/contrib/python/freezegun/py3/freezegun/__init__.pyi
new file mode 100644
index 0000000000..17dd86ac05
--- /dev/null
+++ b/contrib/python/freezegun/py3/freezegun/__init__.pyi
@@ -0,0 +1,2 @@
+from .api import freeze_time as freeze_time
+
diff --git a/contrib/python/freezegun/py3/freezegun/api.pyi b/contrib/python/freezegun/py3/freezegun/api.pyi
new file mode 100644
index 0000000000..2ff9bdc5da
--- /dev/null
+++ b/contrib/python/freezegun/py3/freezegun/api.pyi
@@ -0,0 +1,62 @@
+from collections.abc import Awaitable, Callable, Iterator, Sequence
+from datetime import date, datetime, timedelta
+from numbers import Real
+from typing import Any, TypeVar, overload
+from typing_extensions import TypeAlias
+
+_T = TypeVar("_T")
+_Freezable: TypeAlias = str | datetime | date | timedelta
+
+class TickingDateTimeFactory:
+ def __init__(self, time_to_freeze: datetime, start: datetime) -> None: ...
+ def __call__(self) -> datetime: ...
+
+class FrozenDateTimeFactory:
+ def __init__(self, time_to_freeze: datetime) -> None: ...
+ def __call__(self) -> datetime: ...
+ def tick(self, delta: float | Real | timedelta = ...) -> None: ...
+ def move_to(self, target_datetime: _Freezable | None) -> None: ...
+
+class StepTickTimeFactory:
+ def __init__(self, time_to_freeze: datetime, step_width: float) -> None: ...
+ def __call__(self) -> datetime: ...
+ def tick(self, delta: timedelta | None = ...) -> None: ...
+ def update_step_width(self, step_width: float) -> None: ...
+ def move_to(self, target_datetime: _Freezable | None) -> None: ...
+
+class _freeze_time:
+ def __init__(
+ self,
+ time_to_freeze_str: _Freezable | None,
+ tz_offset: int | timedelta,
+ ignore: Sequence[str],
+ tick: bool,
+ as_arg: bool,
+ as_kwarg: str,
+ auto_tick_seconds: float,
+ real_asyncio: bool,
+ ) -> None: ...
+ @overload
+ def __call__(self, func: type[_T]) -> type[_T]: ...
+ @overload
+ def __call__(self, func: Callable[..., Awaitable[_T]]) -> Callable[..., Awaitable[_T]]: ...
+ @overload
+ def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
+ def __enter__(self) -> FrozenDateTimeFactory | StepTickTimeFactory: ...
+ def __exit__(self, *args: object) -> None: ...
+ def start(self) -> Any: ...
+ def stop(self) -> None: ...
+ def decorate_class(self, klass: type[_T]) -> _T: ...
+ def decorate_coroutine(self, coroutine: _T) -> _T: ...
+ def decorate_callable(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
+
+def freeze_time(
+ time_to_freeze: _Freezable | Callable[..., _Freezable] | Iterator[_Freezable] | None = ...,
+ tz_offset: int | timedelta | None = ...,
+ ignore: Sequence[str] | None = ...,
+ tick: bool | None = ...,
+ as_arg: bool | None = ...,
+ as_kwarg: str | None = ...,
+ auto_tick_seconds: float | None = ...,
+ real_asyncio: bool | None = ...
+) -> _freeze_time: ...
diff --git a/contrib/python/frozenlist/frozenlist/__init__.pyi b/contrib/python/frozenlist/frozenlist/__init__.pyi
new file mode 100644
index 0000000000..ae803ef6aa
--- /dev/null
+++ b/contrib/python/frozenlist/frozenlist/__init__.pyi
@@ -0,0 +1,47 @@
+from typing import (
+ Generic,
+ Iterable,
+ Iterator,
+ List,
+ MutableSequence,
+ Optional,
+ TypeVar,
+ Union,
+ overload,
+)
+
+_T = TypeVar("_T")
+_Arg = Union[List[_T], Iterable[_T]]
+
+class FrozenList(MutableSequence[_T], Generic[_T]):
+ def __init__(self, items: Optional[_Arg[_T]] = None) -> None: ...
+ @property
+ def frozen(self) -> bool: ...
+ def freeze(self) -> None: ...
+ @overload
+ def __getitem__(self, i: int) -> _T: ...
+ @overload
+ def __getitem__(self, s: slice) -> FrozenList[_T]: ...
+ @overload
+ def __setitem__(self, i: int, o: _T) -> None: ...
+ @overload
+ def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
+ @overload
+ def __delitem__(self, i: int) -> None: ...
+ @overload
+ def __delitem__(self, i: slice) -> None: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[_T]: ...
+ def __reversed__(self) -> Iterator[_T]: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __le__(self, other: FrozenList[_T]) -> bool: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __lt__(self, other: FrozenList[_T]) -> bool: ...
+ def __ge__(self, other: FrozenList[_T]) -> bool: ...
+ def __gt__(self, other: FrozenList[_T]) -> bool: ...
+ def insert(self, pos: int, item: _T) -> None: ...
+ def __repr__(self) -> str: ...
+ def __hash__(self) -> int: ...
+
+# types for C accelerators are the same
+CFrozenList = PyFrozenList = FrozenList
diff --git a/contrib/python/matplotlib/py3/matplotlib/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/__init__.pyi
new file mode 100644
index 0000000000..8ef23a3dc4
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/__init__.pyi
@@ -0,0 +1,113 @@
+__all__ = [
+ "__bibtex__",
+ "__version__",
+ "__version_info__",
+ "set_loglevel",
+ "ExecutableNotFoundError",
+ "get_configdir",
+ "get_cachedir",
+ "get_data_path",
+ "matplotlib_fname",
+ "MatplotlibDeprecationWarning",
+ "RcParams",
+ "rc_params",
+ "rc_params_from_file",
+ "rcParamsDefault",
+ "rcParams",
+ "rcParamsOrig",
+ "defaultParams",
+ "rc",
+ "rcdefaults",
+ "rc_file_defaults",
+ "rc_file",
+ "rc_context",
+ "use",
+ "get_backend",
+ "interactive",
+ "is_interactive",
+ "colormaps",
+ "color_sequences",
+]
+
+import os
+from pathlib import Path
+
+from collections.abc import Callable, Generator
+import contextlib
+from packaging.version import Version
+
+from matplotlib._api import MatplotlibDeprecationWarning
+from typing import Any, NamedTuple
+
+class _VersionInfo(NamedTuple):
+ major: int
+ minor: int
+ micro: int
+ releaselevel: str
+ serial: int
+
+__bibtex__: str
+__version__: str
+__version_info__: _VersionInfo
+
+def set_loglevel(level: str) -> None: ...
+
+class _ExecInfo(NamedTuple):
+ executable: str
+ raw_version: str
+ version: Version
+
+class ExecutableNotFoundError(FileNotFoundError): ...
+
+def _get_executable_info(name: str) -> _ExecInfo: ...
+def get_configdir() -> str: ...
+def get_cachedir() -> str: ...
+def get_data_path() -> str: ...
+def matplotlib_fname() -> str: ...
+
+class RcParams(dict[str, Any]):
+ validate: dict[str, Callable]
+ def __init__(self, *args, **kwargs) -> None: ...
+ def __setitem__(self, key: str, val: Any) -> None: ...
+ def __getitem__(self, key: str) -> Any: ...
+ def __iter__(self) -> Generator[str, None, None]: ...
+ def __len__(self) -> int: ...
+ def find_all(self, pattern: str) -> RcParams: ...
+ def copy(self) -> RcParams: ...
+
+def rc_params(fail_on_error: bool = ...) -> RcParams: ...
+def rc_params_from_file(
+ fname: str | Path | os.PathLike,
+ fail_on_error: bool = ...,
+ use_default_template: bool = ...,
+) -> RcParams: ...
+
+rcParamsDefault: RcParams
+rcParams: RcParams
+rcParamsOrig: RcParams
+defaultParams: dict[str, Any]
+
+def rc(group: str, **kwargs) -> None: ...
+def rcdefaults() -> None: ...
+def rc_file_defaults() -> None: ...
+def rc_file(
+ fname: str | Path | os.PathLike, *, use_default_template: bool = ...
+) -> None: ...
+@contextlib.contextmanager
+def rc_context(
+ rc: dict[str, Any] | None = ..., fname: str | Path | os.PathLike | None = ...
+) -> Generator[None, None, None]: ...
+def use(backend: str, *, force: bool = ...) -> None: ...
+def get_backend() -> str: ...
+def interactive(b: bool) -> None: ...
+def is_interactive() -> bool: ...
+
+def _preprocess_data(
+ func: Callable | None = ...,
+ *,
+ replace_names: list[str] | None = ...,
+ label_namer: str | None = ...
+) -> Callable: ...
+
+from matplotlib.cm import _colormaps as colormaps
+from matplotlib.colors import _color_sequences as color_sequences
diff --git a/contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi
new file mode 100644
index 0000000000..4baff7cd80
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi
@@ -0,0 +1,59 @@
+from collections.abc import Callable, Generator, Mapping, Sequence
+from typing import Any, Iterable, TypeVar, overload
+
+from numpy.typing import NDArray
+
+from .deprecation import ( # noqa: re-exported API
+ deprecated as deprecated,
+ warn_deprecated as warn_deprecated,
+ rename_parameter as rename_parameter,
+ delete_parameter as delete_parameter,
+ make_keyword_only as make_keyword_only,
+ deprecate_method_override as deprecate_method_override,
+ deprecate_privatize_attribute as deprecate_privatize_attribute,
+ suppress_matplotlib_deprecation_warning as suppress_matplotlib_deprecation_warning,
+ MatplotlibDeprecationWarning as MatplotlibDeprecationWarning,
+)
+
+_T = TypeVar("_T")
+
+class classproperty(Any):
+ def __init__(
+ self,
+ fget: Callable[[_T], Any],
+ fset: None = ...,
+ fdel: None = ...,
+ doc: str | None = None,
+ ): ...
+ # Replace return with Self when py3.9 is dropped
+ @overload
+ def __get__(self, instance: None, owner: None) -> classproperty: ...
+ @overload
+ def __get__(self, instance: object, owner: type[object]) -> Any: ...
+ @property
+ def fget(self) -> Callable[[_T], Any]: ...
+
+def check_isinstance(
+ types: type | tuple[type | None, ...], /, **kwargs: Any
+) -> None: ...
+def check_in_list(
+ values: Sequence[Any], /, *, _print_supported_values: bool = ..., **kwargs: Any
+) -> None: ...
+def check_shape(shape: tuple[int | None, ...], /, **kwargs: NDArray) -> None: ...
+def check_getitem(mapping: Mapping[Any, Any], /, **kwargs: Any) -> Any: ...
+def caching_module_getattr(cls: type) -> Callable[[str], Any]: ...
+@overload
+def define_aliases(
+ alias_d: dict[str, list[str]], cls: None = ...
+) -> Callable[[type[_T]], type[_T]]: ...
+@overload
+def define_aliases(alias_d: dict[str, list[str]], cls: type[_T]) -> type[_T]: ...
+def select_matching_signature(
+ funcs: list[Callable], *args: Any, **kwargs: Any
+) -> Any: ...
+def nargs_error(name: str, takes: int | str, given: int) -> TypeError: ...
+def kwarg_error(name: str, kw: str | Iterable[str]) -> TypeError: ...
+def recursive_subclasses(cls: type) -> Generator[type, None, None]: ...
+def warn_external(
+ message: str | Warning, category: type[Warning] | None = ...
+) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi b/contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi
new file mode 100644
index 0000000000..9619d1b484
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi
@@ -0,0 +1,76 @@
+from collections.abc import Callable
+import contextlib
+from typing import Any, TypedDict, TypeVar, overload
+from typing_extensions import (
+ ParamSpec, # < Py 3.10
+ Unpack, # < Py 3.11
+)
+
+_P = ParamSpec("_P")
+_R = TypeVar("_R")
+_T = TypeVar("_T")
+
+class MatplotlibDeprecationWarning(DeprecationWarning): ...
+
+class DeprecationKwargs(TypedDict, total=False):
+ message: str
+ alternative: str
+ pending: bool
+ obj_type: str
+ addendum: str
+ removal: str
+
+class NamedDeprecationKwargs(DeprecationKwargs, total=False):
+ name: str
+
+def warn_deprecated(since: str, **kwargs: Unpack[NamedDeprecationKwargs]) -> None: ...
+def deprecated(
+ since: str, **kwargs: Unpack[NamedDeprecationKwargs]
+) -> Callable[[_T], _T]: ...
+
+class deprecate_privatize_attribute(Any):
+ def __init__(self, since: str, **kwargs: Unpack[NamedDeprecationKwargs]): ...
+ def __set_name__(self, owner: type[object], name: str) -> None: ...
+
+DECORATORS: dict[Callable, Callable] = ...
+
+@overload
+def rename_parameter(
+ since: str, old: str, new: str, func: None = ...
+) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
+@overload
+def rename_parameter(
+ since: str, old: str, new: str, func: Callable[_P, _R]
+) -> Callable[_P, _R]: ...
+
+class _deprecated_parameter_class: ...
+
+_deprecated_parameter: _deprecated_parameter_class
+
+@overload
+def delete_parameter(
+ since: str, name: str, func: None = ..., **kwargs: Unpack[DeprecationKwargs]
+) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
+@overload
+def delete_parameter(
+ since: str, name: str, func: Callable[_P, _R], **kwargs: Unpack[DeprecationKwargs]
+) -> Callable[_P, _R]: ...
+@overload
+def make_keyword_only(
+ since: str, name: str, func: None = ...
+) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
+@overload
+def make_keyword_only(
+ since: str, name: str, func: Callable[_P, _R]
+) -> Callable[_P, _R]: ...
+def deprecate_method_override(
+ method: Callable[_P, _R],
+ obj: object | type,
+ *,
+ allow_empty: bool = ...,
+ since: str,
+ **kwargs: Unpack[NamedDeprecationKwargs]
+) -> Callable[_P, _R]: ...
+def suppress_matplotlib_deprecation_warning() -> (
+ contextlib.AbstractContextManager[None]
+): ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi b/contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi
new file mode 100644
index 0000000000..3a211223be
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi
@@ -0,0 +1 @@
+def display_is_valid() -> bool: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_color_data.pyi b/contrib/python/matplotlib/py3/matplotlib/_color_data.pyi
new file mode 100644
index 0000000000..feb3de9c30
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_color_data.pyi
@@ -0,0 +1,6 @@
+from .typing import ColorType
+
+BASE_COLORS: dict[str, ColorType]
+TABLEAU_COLORS: dict[str, ColorType]
+XKCD_COLORS: dict[str, ColorType]
+CSS4_COLORS: dict[str, ColorType]
diff --git a/contrib/python/matplotlib/py3/matplotlib/_docstring.pyi b/contrib/python/matplotlib/py3/matplotlib/_docstring.pyi
new file mode 100644
index 0000000000..0377dc5fe9
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_docstring.pyi
@@ -0,0 +1,29 @@
+from typing import Any, Callable, TypeVar, overload
+
+
+_T = TypeVar('_T')
+
+
+class Substitution:
+ @overload
+ def __init__(self, *args: str): ...
+ @overload
+ def __init__(self, **kwargs: str): ...
+ def __call__(self, func: _T) -> _T: ...
+ def update(self, *args, **kwargs): ... # type: ignore[no-untyped-def]
+
+
+class _ArtistKwdocLoader(dict[str, str]):
+ def __missing__(self, key: str) -> str: ...
+
+
+class _ArtistPropertiesSubstitution(Substitution):
+ def __init__(self) -> None: ...
+ def __call__(self, obj: _T) -> _T: ...
+
+
+def copy(source: Any) -> Callable[[_T], _T]: ...
+
+
+dedent_interpd: _ArtistPropertiesSubstitution
+interpd: _ArtistPropertiesSubstitution
diff --git a/contrib/python/matplotlib/py3/matplotlib/_enums.pyi b/contrib/python/matplotlib/py3/matplotlib/_enums.pyi
new file mode 100644
index 0000000000..351088b364
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_enums.pyi
@@ -0,0 +1,18 @@
+from enum import Enum
+
+class _AutoStringNameEnum(Enum):
+ def __hash__(self) -> int: ...
+
+class JoinStyle(str, _AutoStringNameEnum):
+ miter: str
+ round: str
+ bevel: str
+ @staticmethod
+ def demo() -> None: ...
+
+class CapStyle(str, _AutoStringNameEnum):
+ butt: str
+ projecting: str
+ round: str
+ @staticmethod
+ def demo() -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_image.pyi b/contrib/python/matplotlib/py3/matplotlib/_image.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_image.pyi
diff --git a/contrib/python/matplotlib/py3/matplotlib/_path.pyi b/contrib/python/matplotlib/py3/matplotlib/_path.pyi
new file mode 100644
index 0000000000..456905528b
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_path.pyi
@@ -0,0 +1,9 @@
+from collections.abc import Sequence
+
+import numpy as np
+
+from .transforms import BboxBase
+
+def affine_transform(points: np.ndarray, trans: np.ndarray) -> np.ndarray: ...
+def count_bboxes_overlapping_bbox(bbox: BboxBase, bboxes: Sequence[BboxBase]) -> int: ...
+def update_path_extents(path, trans, rect, minpos, ignore): ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi b/contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi
new file mode 100644
index 0000000000..bdd8cfba31
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi
@@ -0,0 +1,29 @@
+from collections import OrderedDict
+
+from matplotlib.backend_bases import FigureManagerBase
+from matplotlib.figure import Figure
+
+class Gcf:
+ figs: OrderedDict[int, FigureManagerBase]
+ @classmethod
+ def get_fig_manager(cls, num: int) -> FigureManagerBase | None: ...
+ @classmethod
+ def destroy(cls, num: int | FigureManagerBase) -> None: ...
+ @classmethod
+ def destroy_fig(cls, fig: Figure) -> None: ...
+ @classmethod
+ def destroy_all(cls) -> None: ...
+ @classmethod
+ def has_fignum(cls, num: int) -> bool: ...
+ @classmethod
+ def get_all_fig_managers(cls) -> list[FigureManagerBase]: ...
+ @classmethod
+ def get_num_fig_managers(cls) -> int: ...
+ @classmethod
+ def get_active(cls) -> FigureManagerBase | None: ...
+ @classmethod
+ def _set_new_active_manager(cls, manager: FigureManagerBase) -> None: ...
+ @classmethod
+ def set_active(cls, manager: FigureManagerBase) -> None: ...
+ @classmethod
+ def draw_all(cls, force: bool = ...) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_qhull.pyi b/contrib/python/matplotlib/py3/matplotlib/_qhull.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_qhull.pyi
diff --git a/contrib/python/matplotlib/py3/matplotlib/_tri.pyi b/contrib/python/matplotlib/py3/matplotlib/_tri.pyi
new file mode 100644
index 0000000000..cab7fcf2bc
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_tri.pyi
@@ -0,0 +1,23 @@
+# This is a private module implemented in C++
+# As such these type stubs are overly generic, but here to allow these types
+# as return types for public methods
+from typing import Any
+
+class TrapezoidMapTriFinder:
+ def __init__(self, *args, **kwargs) -> None: ...
+ def find_many(self, *args, **kwargs) -> Any: ...
+ def get_tree_stats(self, *args, **kwargs) -> Any: ...
+ def initialize(self, *args, **kwargs) -> Any: ...
+ def print_tree(self, *args, **kwargs) -> Any: ...
+
+class TriContourGenerator:
+ def __init__(self, *args, **kwargs) -> None: ...
+ def create_contour(self, *args, **kwargs) -> Any: ...
+ def create_filled_contour(self, *args, **kwargs) -> Any: ...
+
+class Triangulation:
+ def __init__(self, *args, **kwargs) -> None: ...
+ def calculate_plane_coefficients(self, *args, **kwargs) -> Any: ...
+ def get_edges(self, *args, **kwargs) -> Any: ...
+ def get_neighbors(self, *args, **kwargs) -> Any: ...
+ def set_mask(self, *args, **kwargs) -> Any: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi b/contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi
diff --git a/contrib/python/matplotlib/py3/matplotlib/animation.pyi b/contrib/python/matplotlib/py3/matplotlib/animation.pyi
new file mode 100644
index 0000000000..de1b9926af
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/animation.pyi
@@ -0,0 +1,219 @@
+import abc
+from collections.abc import Callable, Collection, Iterable, Sequence, Generator
+import contextlib
+from pathlib import Path
+from matplotlib.artist import Artist
+from matplotlib.backend_bases import TimerBase
+from matplotlib.figure import Figure
+
+from typing import Any
+
+subprocess_creation_flags: int
+
+def adjusted_figsize(w: float, h: float, dpi: float, n: int) -> tuple[float, float]: ...
+
+class MovieWriterRegistry:
+ def __init__(self) -> None: ...
+ def register(
+ self, name: str
+ ) -> Callable[[type[AbstractMovieWriter]], type[AbstractMovieWriter]]: ...
+ def is_available(self, name: str) -> bool: ...
+ def __iter__(self) -> Generator[str, None, None]: ...
+ def list(self) -> list[str]: ...
+ def __getitem__(self, name: str) -> type[AbstractMovieWriter]: ...
+
+writers: MovieWriterRegistry
+
+class AbstractMovieWriter(abc.ABC, metaclass=abc.ABCMeta):
+ fps: int
+ metadata: dict[str, str]
+ codec: str
+ bitrate: int
+ def __init__(
+ self,
+ fps: int = ...,
+ metadata: dict[str, str] | None = ...,
+ codec: str | None = ...,
+ bitrate: int | None = ...,
+ ) -> None: ...
+ outfile: str | Path
+ fig: Figure
+ dpi: float
+
+ @abc.abstractmethod
+ def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ...
+ @property
+ def frame_size(self) -> tuple[int, int]: ...
+ @abc.abstractmethod
+ def grab_frame(self, **savefig_kwargs) -> None: ...
+ @abc.abstractmethod
+ def finish(self) -> None: ...
+ @contextlib.contextmanager
+ def saving(
+ self, fig: Figure, outfile: str | Path, dpi: float | None, *args, **kwargs
+ ) -> Generator[AbstractMovieWriter, None, None]: ...
+
+class MovieWriter(AbstractMovieWriter):
+ supported_formats: list[str]
+ frame_format: str
+ extra_args: list[str] | None
+ def __init__(
+ self,
+ fps: int = ...,
+ codec: str | None = ...,
+ bitrate: int | None = ...,
+ extra_args: list[str] | None = ...,
+ metadata: dict[str, str] | None = ...,
+ ) -> None: ...
+ def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ...
+ def grab_frame(self, **savefig_kwargs) -> None: ...
+ def finish(self) -> None: ...
+ @classmethod
+ def bin_path(cls) -> str: ...
+ @classmethod
+ def isAvailable(cls) -> bool: ...
+
+class FileMovieWriter(MovieWriter):
+ fig: Figure
+ outfile: str | Path
+ dpi: float
+ temp_prefix: str
+ fname_format_str: str
+ def setup(
+ self,
+ fig: Figure,
+ outfile: str | Path,
+ dpi: float | None = ...,
+ frame_prefix: str | Path | None = ...,
+ ) -> None: ...
+ def __del__(self) -> None: ...
+ @property
+ def frame_format(self) -> str: ...
+ @frame_format.setter
+ def frame_format(self, frame_format: str) -> None: ...
+
+class PillowWriter(AbstractMovieWriter):
+ @classmethod
+ def isAvailable(cls) -> bool: ...
+ def setup(
+ self, fig: Figure, outfile: str | Path, dpi: float | None = ...
+ ) -> None: ...
+ def grab_frame(self, **savefig_kwargs) -> None: ...
+ def finish(self) -> None: ...
+
+class FFMpegBase:
+ codec: str
+ @property
+ def output_args(self) -> list[str]: ...
+
+class FFMpegWriter(FFMpegBase, MovieWriter): ...
+
+class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
+ supported_formats: list[str]
+
+class ImageMagickBase:
+ @classmethod
+ def bin_path(cls) -> str: ...
+ @classmethod
+ def isAvailable(cls) -> bool: ...
+
+class ImageMagickWriter(ImageMagickBase, MovieWriter):
+ input_names: str
+
+class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
+ supported_formats: list[str]
+ @property
+ def input_names(self) -> str: ...
+
+class HTMLWriter(FileMovieWriter):
+ supported_formats: list[str]
+ @classmethod
+ def isAvailable(cls) -> bool: ...
+ embed_frames: bool
+ default_mode: str
+ def __init__(
+ self,
+ fps: int = ...,
+ codec: str | None = ...,
+ bitrate: int | None = ...,
+ extra_args: list[str] | None = ...,
+ metadata: dict[str, str] | None = ...,
+ embed_frames: bool = ...,
+ default_mode: str = ...,
+ embed_limit: float | None = ...,
+ ) -> None: ...
+ def setup(
+ self,
+ fig: Figure,
+ outfile: str | Path,
+ dpi: float | None = ...,
+ frame_dir: str | Path | None = ...,
+ ) -> None: ...
+ def grab_frame(self, **savefig_kwargs): ...
+ def finish(self) -> None: ...
+
+class Animation:
+ frame_seq: Iterable[Artist]
+ event_source: Any
+ def __init__(
+ self, fig: Figure, event_source: Any | None = ..., blit: bool = ...
+ ) -> None: ...
+ def __del__(self) -> None: ...
+ def save(
+ self,
+ filename: str | Path,
+ writer: AbstractMovieWriter | str | None = ...,
+ fps: int | None = ...,
+ dpi: float | None = ...,
+ codec: str | None = ...,
+ bitrate: int | None = ...,
+ extra_args: list[str] | None = ...,
+ metadata: dict[str, str] | None = ...,
+ extra_anim: list[Animation] | None = ...,
+ savefig_kwargs: dict[str, Any] | None = ...,
+ *,
+ progress_callback: Callable[[int, int], Any] | None = ...
+ ) -> None: ...
+ def new_frame_seq(self) -> Iterable[Artist]: ...
+ def new_saved_frame_seq(self) -> Iterable[Artist]: ...
+ def to_html5_video(self, embed_limit: float | None = ...) -> str: ...
+ def to_jshtml(
+ self,
+ fps: int | None = ...,
+ embed_frames: bool = ...,
+ default_mode: str | None = ...,
+ ) -> str: ...
+ def _repr_html_(self) -> str: ...
+ def pause(self) -> None: ...
+ def resume(self) -> None: ...
+
+class TimedAnimation(Animation):
+ repeat: bool
+ def __init__(
+ self,
+ fig: Figure,
+ interval: int = ...,
+ repeat_delay: int = ...,
+ repeat: bool = ...,
+ event_source: TimerBase | None = ...,
+ *args,
+ **kwargs
+ ) -> None: ...
+
+class ArtistAnimation(TimedAnimation):
+ def __init__(self, fig: Figure, artists: Sequence[Collection[Artist]], *args, **kwargs) -> None: ...
+
+class FuncAnimation(TimedAnimation):
+ save_count: int
+ def __init__(
+ self,
+ fig: Figure,
+ func: Callable[..., Iterable[Artist]],
+ frames: Iterable[Artist] | int | Callable[[], Generator] | None = ...,
+ init_func: Callable[[], Iterable[Artist]] | None = ...,
+ fargs: tuple[Any, ...] | None = ...,
+ save_count: int | None = ...,
+ *,
+ cache_frame_data: bool = ...,
+ **kwargs
+ ) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/artist.pyi b/contrib/python/matplotlib/py3/matplotlib/artist.pyi
new file mode 100644
index 0000000000..101e97a9a0
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/artist.pyi
@@ -0,0 +1,181 @@
+from .axes._base import _AxesBase
+from .backend_bases import RendererBase, MouseEvent
+from .figure import Figure, SubFigure
+from .path import Path
+from .patches import Patch
+from .patheffects import AbstractPathEffect
+from .transforms import (
+ BboxBase,
+ Bbox,
+ Transform,
+ TransformedPatchPath,
+ TransformedPath,
+)
+
+import numpy as np
+
+from collections.abc import Callable, Iterable
+from typing import Any, NamedTuple, TextIO, overload
+from numpy.typing import ArrayLike
+
+def allow_rasterization(draw): ...
+
+class _XYPair(NamedTuple):
+ x: ArrayLike
+ y: ArrayLike
+
+class _Unset: ...
+
+class Artist:
+ zorder: float
+ stale_callback: Callable[[Artist, bool], None] | None
+ figure: Figure | SubFigure | None
+ clipbox: BboxBase | None
+ def __init__(self) -> None: ...
+ def remove(self) -> None: ...
+ def have_units(self) -> bool: ...
+ # TODO units
+ def convert_xunits(self, x): ...
+ def convert_yunits(self, y): ...
+ @property
+ def axes(self) -> _AxesBase | None: ...
+ @axes.setter
+ def axes(self, new_axes: _AxesBase | None) -> None: ...
+ @property
+ def stale(self) -> bool: ...
+ @stale.setter
+ def stale(self, val: bool) -> None: ...
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
+ def get_tightbbox(self, renderer: RendererBase | None = ...) -> Bbox | None: ...
+ def add_callback(self, func: Callable[[Artist], Any]) -> int: ...
+ def remove_callback(self, oid: int) -> None: ...
+ def pchanged(self) -> None: ...
+ def is_transform_set(self) -> bool: ...
+ def set_transform(self, t: Transform | None) -> None: ...
+ def get_transform(self) -> Transform: ...
+ def get_children(self) -> list[Artist]: ...
+ # TODO can these dicts be type narrowed? e.g. str keys
+ def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ...
+ def pickable(self) -> bool: ...
+ def pick(self, mouseevent: MouseEvent) -> None: ...
+ def set_picker(
+ self,
+ picker: None
+ | bool
+ | float
+ | Callable[[Artist, MouseEvent], tuple[bool, dict[Any, Any]]],
+ ) -> None: ...
+ def get_picker(
+ self,
+ ) -> None | bool | float | Callable[
+ [Artist, MouseEvent], tuple[bool, dict[Any, Any]]
+ ]: ...
+ def get_url(self) -> str | None: ...
+ def set_url(self, url: str | None) -> None: ...
+ def get_gid(self) -> str | None: ...
+ def set_gid(self, gid: str | None) -> None: ...
+ def get_snap(self) -> bool | None: ...
+ def set_snap(self, snap: bool | None) -> None: ...
+ def get_sketch_params(self) -> tuple[float, float, float] | None: ...
+ def set_sketch_params(
+ self,
+ scale: float | None = ...,
+ length: float | None = ...,
+ randomness: float | None = ...,
+ ) -> None: ...
+ def set_path_effects(self, path_effects: list[AbstractPathEffect]) -> None: ...
+ def get_path_effects(self) -> list[AbstractPathEffect]: ...
+ def get_figure(self) -> Figure | None: ...
+ def set_figure(self, fig: Figure) -> None: ...
+ def set_clip_box(self, clipbox: BboxBase | None) -> None: ...
+ def set_clip_path(
+ self,
+ path: Patch | Path | TransformedPath | TransformedPatchPath | None,
+ transform: Transform | None = ...,
+ ) -> None: ...
+ def get_alpha(self) -> float | None: ...
+ def get_visible(self) -> bool: ...
+ def get_animated(self) -> bool: ...
+ def get_in_layout(self) -> bool: ...
+ def get_clip_on(self) -> bool: ...
+ def get_clip_box(self) -> Bbox | None: ...
+ def get_clip_path(
+ self,
+ ) -> Patch | Path | TransformedPath | TransformedPatchPath | None: ...
+ def get_transformed_clip_path_and_affine(
+ self,
+ ) -> tuple[None, None] | tuple[Path, Transform]: ...
+ def set_clip_on(self, b: bool) -> None: ...
+ def get_rasterized(self) -> bool: ...
+ def set_rasterized(self, rasterized: bool) -> None: ...
+ def get_agg_filter(self) -> Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None: ...
+ def set_agg_filter(
+ self, filter_func: Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None
+ ) -> None: ...
+ def draw(self, renderer: RendererBase) -> None: ...
+ def set_alpha(self, alpha: float | None) -> None: ...
+ def set_visible(self, b: bool) -> None: ...
+ def set_animated(self, b: bool) -> None: ...
+ def set_in_layout(self, in_layout: bool) -> None: ...
+ def get_label(self) -> object: ...
+ def set_label(self, s: object) -> None: ...
+ def get_zorder(self) -> float: ...
+ def set_zorder(self, level: float) -> None: ...
+ @property
+ def sticky_edges(self) -> _XYPair: ...
+ def update_from(self, other: Artist) -> None: ...
+ def properties(self) -> dict[str, Any]: ...
+ def update(self, props: dict[str, Any]) -> list[Any]: ...
+ def _internal_update(self, kwargs: Any) -> list[Any]: ...
+ def set(self, **kwargs: Any) -> list[Any]: ...
+ def findobj(
+ self,
+ match: None | Callable[[Artist], bool] | type[Artist] = ...,
+ include_self: bool = ...,
+ ) -> list[Artist]: ...
+ def get_cursor_data(self, event: MouseEvent) -> Any: ...
+ def format_cursor_data(self, data: Any) -> str: ...
+ def get_mouseover(self) -> bool: ...
+ def set_mouseover(self, mouseover: bool) -> None: ...
+ @property
+ def mouseover(self) -> bool: ...
+ @mouseover.setter
+ def mouseover(self, mouseover: bool) -> None: ...
+
+class ArtistInspector:
+ oorig: Artist | type[Artist]
+ o: type[Artist]
+ aliasd: dict[str, set[str]]
+ def __init__(
+ self, o: Artist | type[Artist] | Iterable[Artist | type[Artist]]
+ ) -> None: ...
+ def get_aliases(self) -> dict[str, set[str]]: ...
+ def get_valid_values(self, attr: str) -> str | None: ...
+ def get_setters(self) -> list[str]: ...
+ @staticmethod
+ def number_of_parameters(func: Callable) -> int: ...
+ @staticmethod
+ def is_alias(method: Callable) -> bool: ...
+ def aliased_name(self, s: str) -> str: ...
+ def aliased_name_rest(self, s: str, target: str) -> str: ...
+ @overload
+ def pprint_setters(
+ self, prop: None = ..., leadingspace: int = ...
+ ) -> list[str]: ...
+ @overload
+ def pprint_setters(self, prop: str, leadingspace: int = ...) -> str: ...
+ @overload
+ def pprint_setters_rest(
+ self, prop: None = ..., leadingspace: int = ...
+ ) -> list[str]: ...
+ @overload
+ def pprint_setters_rest(self, prop: str, leadingspace: int = ...) -> str: ...
+ def properties(self) -> dict[str, Any]: ...
+ def pprint_getters(self) -> list[str]: ...
+
+def getp(obj: Artist, property: str | None = ...) -> Any: ...
+
+get = getp
+
+def setp(obj: Artist, *args, file: TextIO | None = ..., **kwargs) -> list[Any] | None: ...
+def kwdoc(artist: Artist | type[Artist] | Iterable[Artist | type[Artist]]) -> str: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi
new file mode 100644
index 0000000000..7df38b8bde
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi
@@ -0,0 +1,16 @@
+from typing import TypeVar
+
+from ._axes import Axes as Axes
+
+
+_T = TypeVar("_T")
+
+# Backcompat.
+Subplot = Axes
+
+class _SubplotBaseMeta(type):
+ def __instancecheck__(self, obj) -> bool: ...
+
+class SubplotBase(metaclass=_SubplotBaseMeta): ...
+
+def subplot_class_factory(cls: type[_T]) -> type[_T]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi
new file mode 100644
index 0000000000..9602db3b95
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi
@@ -0,0 +1,767 @@
+from matplotlib.axes._base import _AxesBase
+from matplotlib.axes._secondary_axes import SecondaryAxis
+
+from matplotlib.artist import Artist
+from matplotlib.backend_bases import RendererBase
+from matplotlib.collections import (
+ Collection,
+ LineCollection,
+ BrokenBarHCollection,
+ PathCollection,
+ PolyCollection,
+ EventCollection,
+ QuadMesh,
+)
+from matplotlib.colors import Colormap, Normalize
+from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
+from matplotlib.contour import ContourSet, QuadContourSet
+from matplotlib.image import AxesImage, PcolorImage
+from matplotlib.legend import Legend
+from matplotlib.legend_handler import HandlerBase
+from matplotlib.lines import Line2D
+from matplotlib.mlab import GaussianKDE
+from matplotlib.patches import Rectangle, FancyArrow, Polygon, StepPatch, Wedge
+from matplotlib.quiver import Quiver, QuiverKey, Barbs
+from matplotlib.text import Annotation, Text
+from matplotlib.transforms import Transform, Bbox
+import matplotlib.tri as mtri
+import matplotlib.table as mtable
+import matplotlib.stackplot as mstack
+import matplotlib.streamplot as mstream
+
+import datetime
+import PIL.Image
+from collections.abc import Callable, Sequence
+from typing import Any, Literal, overload
+import numpy as np
+from numpy.typing import ArrayLike
+from matplotlib.typing import ColorType, MarkerType, LineStyleType
+
+class Axes(_AxesBase):
+ def get_title(self, loc: Literal["left", "center", "right"] = ...) -> str: ...
+ def set_title(
+ self,
+ label: str,
+ fontdict: dict[str, Any] | None = ...,
+ loc: Literal["left", "center", "right"] | None = ...,
+ pad: float | None = ...,
+ *,
+ y: float | None = ...,
+ **kwargs
+ ) -> Text: ...
+ def get_legend_handles_labels(
+ self, legend_handler_map: dict[type, HandlerBase] | None = ...
+ ) -> tuple[list[Artist], list[Any]]: ...
+ legend_: Legend | None
+
+ @overload
+ def legend(self) -> Legend: ...
+ @overload
+ def legend(self, handles: Sequence[Artist | tuple[Artist, ...]], labels: Sequence[str], **kwargs) -> Legend: ...
+ @overload
+ def legend(self, *, handles: Sequence[Artist | tuple[Artist, ...]], **kwargs) -> Legend: ...
+ @overload
+ def legend(self, labels: Sequence[str], **kwargs) -> Legend: ...
+ @overload
+ def legend(self, **kwargs) -> Legend: ...
+
+ def inset_axes(
+ self,
+ bounds: tuple[float, float, float, float],
+ *,
+ transform: Transform | None = ...,
+ zorder: float = ...,
+ **kwargs
+ ) -> Axes: ...
+ def indicate_inset(
+ self,
+ bounds: tuple[float, float, float, float],
+ inset_ax: Axes | None = ...,
+ *,
+ transform: Transform | None = ...,
+ facecolor: ColorType = ...,
+ edgecolor: ColorType = ...,
+ alpha: float = ...,
+ zorder: float = ...,
+ **kwargs
+ ) -> Rectangle: ...
+ def indicate_inset_zoom(self, inset_ax: Axes, **kwargs) -> Rectangle: ...
+ def secondary_xaxis(
+ self,
+ location: Literal["top", "bottom"] | float,
+ *,
+ functions: tuple[
+ Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
+ ]
+ | Transform
+ | None = ...,
+ **kwargs
+ ) -> SecondaryAxis: ...
+ def secondary_yaxis(
+ self,
+ location: Literal["left", "right"] | float,
+ *,
+ functions: tuple[
+ Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
+ ]
+ | Transform
+ | None = ...,
+ **kwargs
+ ) -> SecondaryAxis: ...
+ def text(
+ self,
+ x: float,
+ y: float,
+ s: str,
+ fontdict: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> Text: ...
+ def annotate(
+ self,
+ text: str,
+ xy: tuple[float, float],
+ xytext: tuple[float, float] | None = ...,
+ xycoords: str
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform]
+ | tuple[float, float] = ...,
+ textcoords: str
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform]
+ | tuple[float, float]
+ | None = ...,
+ arrowprops: dict[str, Any] | None = ...,
+ annotation_clip: bool | None = ...,
+ **kwargs
+ ) -> Annotation: ...
+ def axhline(
+ self, y: float = ..., xmin: float = ..., xmax: float = ..., **kwargs
+ ) -> Line2D: ...
+ def axvline(
+ self, x: float = ..., ymin: float = ..., ymax: float = ..., **kwargs
+ ) -> Line2D: ...
+
+ # TODO: Could separate the xy2 and slope signatures
+ def axline(
+ self,
+ xy1: tuple[float, float],
+ xy2: tuple[float, float] | None = ...,
+ *,
+ slope: float | None = ...,
+ **kwargs
+ ) -> Line2D: ...
+ def axhspan(
+ self, ymin: float, ymax: float, xmin: float = ..., xmax: float = ..., **kwargs
+ ) -> Polygon: ...
+ def axvspan(
+ self, xmin: float, xmax: float, ymin: float = ..., ymax: float = ..., **kwargs
+ ) -> Polygon: ...
+ def hlines(
+ self,
+ y: float | ArrayLike,
+ xmin: float | ArrayLike,
+ xmax: float | ArrayLike,
+ colors: ColorType | Sequence[ColorType] | None = ...,
+ linestyles: LineStyleType = ...,
+ label: str = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> LineCollection: ...
+ def vlines(
+ self,
+ x: float | ArrayLike,
+ ymin: float | ArrayLike,
+ ymax: float | ArrayLike,
+ colors: ColorType | Sequence[ColorType] | None = ...,
+ linestyles: LineStyleType = ...,
+ label: str = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> LineCollection: ...
+ def eventplot(
+ self,
+ positions: ArrayLike | Sequence[ArrayLike],
+ orientation: Literal["horizontal", "vertical"] = ...,
+ lineoffsets: float | Sequence[float] = ...,
+ linelengths: float | Sequence[float] = ...,
+ linewidths: float | Sequence[float] | None = ...,
+ colors: ColorType | Sequence[ColorType] | None = ...,
+ alpha: float | Sequence[float] | None = ...,
+ linestyles: LineStyleType | Sequence[LineStyleType] = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> EventCollection: ...
+ def plot(
+ self,
+ *args: float | ArrayLike | str,
+ scalex: bool = ...,
+ scaley: bool = ...,
+ data = ...,
+ **kwargs
+ ) -> list[Line2D]: ...
+ def plot_date(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ fmt: str = ...,
+ tz: str | datetime.tzinfo | None = ...,
+ xdate: bool = ...,
+ ydate: bool = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> list[Line2D]: ...
+ def loglog(self, *args, **kwargs) -> list[Line2D]: ...
+ def semilogx(self, *args, **kwargs) -> list[Line2D]: ...
+ def semilogy(self, *args, **kwargs) -> list[Line2D]: ...
+ def acorr(
+ self, x: ArrayLike, *, data=..., **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ...
+ def xcorr(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ normed: bool = ...,
+ detrend: Callable[[ArrayLike], ArrayLike] = ...,
+ usevlines: bool = ...,
+ maxlags: int = ...,
+ *,
+ data = ...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ...
+ def step(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ *args,
+ where: Literal["pre", "post", "mid"] = ...,
+ data = ...,
+ **kwargs
+ ) -> list[Line2D]: ...
+ def bar(
+ self,
+ x: float | ArrayLike,
+ height: float | ArrayLike,
+ width: float | ArrayLike = ...,
+ bottom: float | ArrayLike | None = ...,
+ *,
+ align: Literal["center", "edge"] = ...,
+ data = ...,
+ **kwargs
+ ) -> BarContainer: ...
+ def barh(
+ self,
+ y: float | ArrayLike,
+ width: float | ArrayLike,
+ height: float | ArrayLike = ...,
+ left: float | ArrayLike | None = ...,
+ *,
+ align: Literal["center", "edge"] = ...,
+ data = ...,
+ **kwargs
+ ) -> BarContainer: ...
+ def bar_label(
+ self,
+ container: BarContainer,
+ labels: ArrayLike | None = ...,
+ *,
+ fmt: str | Callable[[float], str] = ...,
+ label_type: Literal["center", "edge"] = ...,
+ padding: float = ...,
+ **kwargs
+ ) -> list[Annotation]: ...
+ def broken_barh(
+ self,
+ xranges: Sequence[tuple[float, float]],
+ yrange: tuple[float, float],
+ *,
+ data=...,
+ **kwargs
+ ) -> BrokenBarHCollection: ...
+ def stem(
+ self,
+ *args: ArrayLike | str,
+ linefmt: str | None = ...,
+ markerfmt: str | None = ...,
+ basefmt: str | None = ...,
+ bottom: float = ...,
+ label: str | None = ...,
+ orientation: Literal["vertical", "horizontal"] = ...,
+ data=...,
+ ) -> StemContainer: ...
+
+ # TODO: data kwarg preprocessor?
+ def pie(
+ self,
+ x: ArrayLike,
+ explode: ArrayLike | None = ...,
+ labels: Sequence[str] | None = ...,
+ colors: ColorType | Sequence[ColorType] | None = ...,
+ autopct: str | Callable[[float], str] | None = ...,
+ pctdistance: float = ...,
+ shadow: bool = ...,
+ labeldistance: float | None = ...,
+ startangle: float = ...,
+ radius: float = ...,
+ counterclock: bool = ...,
+ wedgeprops: dict[str, Any] | None = ...,
+ textprops: dict[str, Any] | None = ...,
+ center: tuple[float, float] = ...,
+ frame: bool = ...,
+ rotatelabels: bool = ...,
+ *,
+ normalize: bool = ...,
+ hatch: str | Sequence[str] | None = ...,
+ data=...,
+ ) -> tuple[list[Wedge], list[Text]] | tuple[
+ list[Wedge], list[Text], list[Text]
+ ]: ...
+ def errorbar(
+ self,
+ x: float | ArrayLike,
+ y: float | ArrayLike,
+ yerr: float | ArrayLike | None = ...,
+ xerr: float | ArrayLike | None = ...,
+ fmt: str = ...,
+ ecolor: ColorType | None = ...,
+ elinewidth: float | None = ...,
+ capsize: float | None = ...,
+ barsabove: bool = ...,
+ lolims: bool | ArrayLike = ...,
+ uplims: bool | ArrayLike = ...,
+ xlolims: bool | ArrayLike = ...,
+ xuplims: bool | ArrayLike = ...,
+ errorevery: int | tuple[int, int] = ...,
+ capthick: float | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> ErrorbarContainer: ...
+ def boxplot(
+ self,
+ x: ArrayLike | Sequence[ArrayLike],
+ notch: bool | None = ...,
+ sym: str | None = ...,
+ vert: bool | None = ...,
+ whis: float | tuple[float, float] | None = ...,
+ positions: ArrayLike | None = ...,
+ widths: float | ArrayLike | None = ...,
+ patch_artist: bool | None = ...,
+ bootstrap: int | None = ...,
+ usermedians: ArrayLike | None = ...,
+ conf_intervals: ArrayLike | None = ...,
+ meanline: bool | None = ...,
+ showmeans: bool | None = ...,
+ showcaps: bool | None = ...,
+ showbox: bool | None = ...,
+ showfliers: bool | None = ...,
+ boxprops: dict[str, Any] | None = ...,
+ labels: Sequence[str] | None = ...,
+ flierprops: dict[str, Any] | None = ...,
+ medianprops: dict[str, Any] | None = ...,
+ meanprops: dict[str, Any] | None = ...,
+ capprops: dict[str, Any] | None = ...,
+ whiskerprops: dict[str, Any] | None = ...,
+ manage_ticks: bool = ...,
+ autorange: bool = ...,
+ zorder: float | None = ...,
+ capwidths: float | ArrayLike | None = ...,
+ *,
+ data=...,
+ ) -> dict[str, Any]: ...
+ def bxp(
+ self,
+ bxpstats: Sequence[dict[str, Any]],
+ positions: ArrayLike | None = ...,
+ widths: float | ArrayLike | None = ...,
+ vert: bool = ...,
+ patch_artist: bool = ...,
+ shownotches: bool = ...,
+ showmeans: bool = ...,
+ showcaps: bool = ...,
+ showbox: bool = ...,
+ showfliers: bool = ...,
+ boxprops: dict[str, Any] | None = ...,
+ whiskerprops: dict[str, Any] | None = ...,
+ flierprops: dict[str, Any] | None = ...,
+ medianprops: dict[str, Any] | None = ...,
+ capprops: dict[str, Any] | None = ...,
+ meanprops: dict[str, Any] | None = ...,
+ meanline: bool = ...,
+ manage_ticks: bool = ...,
+ zorder: float | None = ...,
+ capwidths: float | ArrayLike | None = ...,
+ ) -> dict[str, Any]: ...
+ def scatter(
+ self,
+ x: float | ArrayLike,
+ y: float | ArrayLike,
+ s: float | ArrayLike | None = ...,
+ c: ArrayLike | Sequence[ColorType] | ColorType | None = ...,
+ marker: MarkerType | None = ...,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ alpha: float | None = ...,
+ linewidths: float | Sequence[float] | None = ...,
+ *,
+ edgecolors: Literal["face", "none"] | ColorType | Sequence[ColorType] | None = ...,
+ plotnonfinite: bool = ...,
+ data=...,
+ **kwargs
+ ) -> PathCollection: ...
+ def hexbin(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ C: ArrayLike | None = ...,
+ gridsize: int | tuple[int, int] = ...,
+ bins: Literal["log"] | int | Sequence[float] | None = ...,
+ xscale: Literal["linear", "log"] = ...,
+ yscale: Literal["linear", "log"] = ...,
+ extent: tuple[float, float, float, float] | None = ...,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ alpha: float | None = ...,
+ linewidths: float | None = ...,
+ edgecolors: Literal["face", "none"] | ColorType = ...,
+ reduce_C_function: Callable[[np.ndarray | list[float]], float] = ...,
+ mincnt: int | None = ...,
+ marginals: bool = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> PolyCollection: ...
+ def arrow(
+ self, x: float, y: float, dx: float, dy: float, **kwargs
+ ) -> FancyArrow: ...
+ def quiverkey(
+ self, Q: Quiver, X: float, Y: float, U: float, label: str, **kwargs
+ ) -> QuiverKey: ...
+ def quiver(self, *args, data=..., **kwargs) -> Quiver: ...
+ def barbs(self, *args, data=..., **kwargs) -> Barbs: ...
+ def fill(self, *args, data=..., **kwargs) -> list[Polygon]: ...
+ def fill_between(
+ self,
+ x: ArrayLike,
+ y1: ArrayLike | float,
+ y2: ArrayLike | float = ...,
+ where: Sequence[bool] | None = ...,
+ interpolate: bool = ...,
+ step: Literal["pre", "post", "mid"] | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> PolyCollection: ...
+ def fill_betweenx(
+ self,
+ y: ArrayLike,
+ x1: ArrayLike | float,
+ x2: ArrayLike | float = ...,
+ where: Sequence[bool] | None = ...,
+ step: Literal["pre", "post", "mid"] | None = ...,
+ interpolate: bool = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> PolyCollection: ...
+ def imshow(
+ self,
+ X: ArrayLike | PIL.Image.Image,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ *,
+ aspect: Literal["equal", "auto"] | float | None = ...,
+ interpolation: str | None = ...,
+ alpha: float | ArrayLike | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ extent: tuple[float, float, float, float] | None = ...,
+ interpolation_stage: Literal["data", "rgba"] | None = ...,
+ filternorm: bool = ...,
+ filterrad: float = ...,
+ resample: bool | None = ...,
+ url: str | None = ...,
+ data=...,
+ **kwargs
+ ) -> AxesImage: ...
+ def pcolor(
+ self,
+ *args: ArrayLike,
+ shading: Literal["flat", "nearest", "auto"] | None = ...,
+ alpha: float | None = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ data=...,
+ **kwargs
+ ) -> Collection: ...
+ def pcolormesh(
+ self,
+ *args: ArrayLike,
+ alpha: float | None = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ shading: Literal["flat", "nearest", "gouraud", "auto"] | None = ...,
+ antialiased: bool = ...,
+ data=...,
+ **kwargs
+ ) -> QuadMesh: ...
+ def pcolorfast(
+ self,
+ *args: ArrayLike | tuple[float, float],
+ alpha: float | None = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ data=...,
+ **kwargs
+ ) -> AxesImage | PcolorImage | QuadMesh: ...
+ def contour(self, *args, data=..., **kwargs) -> QuadContourSet: ...
+ def contourf(self, *args, data=..., **kwargs) -> QuadContourSet: ...
+ def clabel(
+ self, CS: ContourSet, levels: ArrayLike | None = ..., **kwargs
+ ) -> list[Text]: ...
+ def hist(
+ self,
+ x: ArrayLike | Sequence[ArrayLike],
+ bins: int | Sequence[float] | str | None = ...,
+ range: tuple[float, float] | None = ...,
+ density: bool = ...,
+ weights: ArrayLike | None = ...,
+ cumulative: bool | float = ...,
+ bottom: ArrayLike | float | None = ...,
+ histtype: Literal["bar", "barstacked", "step", "stepfilled"] = ...,
+ align: Literal["left", "mid", "right"] = ...,
+ orientation: Literal["vertical", "horizontal"] = ...,
+ rwidth: float | None = ...,
+ log: bool = ...,
+ color: ColorType | Sequence[ColorType] | None = ...,
+ label: str | Sequence[str] | None = ...,
+ stacked: bool = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[
+ np.ndarray | list[np.ndarray],
+ np.ndarray,
+ BarContainer | Polygon | list[BarContainer | Polygon],
+ ]: ...
+ def stairs(
+ self,
+ values: ArrayLike,
+ edges: ArrayLike | None = ...,
+ *,
+ orientation: Literal["vertical", "horizontal"] = ...,
+ baseline: float | ArrayLike | None = ...,
+ fill: bool = ...,
+ data=...,
+ **kwargs
+ ) -> StepPatch: ...
+ def hist2d(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ bins: None
+ | int
+ | tuple[int, int]
+ | ArrayLike
+ | tuple[ArrayLike, ArrayLike] = ...,
+ range: ArrayLike | None = ...,
+ density: bool = ...,
+ weights: ArrayLike | None = ...,
+ cmin: float | None = ...,
+ cmax: float | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray, QuadMesh]: ...
+ def ecdf(
+ self,
+ x: ArrayLike,
+ weights: ArrayLike | None = ...,
+ *,
+ complementary: bool=...,
+ orientation: Literal["vertical", "horizonatal"]=...,
+ compress: bool=...,
+ data=...,
+ **kwargs
+ ) -> Line2D: ...
+ def psd(
+ self,
+ x: ArrayLike,
+ NFFT: int | None = ...,
+ Fs: float | None = ...,
+ Fc: int | None = ...,
+ detrend: Literal["none", "mean", "linear"]
+ | Callable[[ArrayLike], ArrayLike]
+ | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ noverlap: int | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale_by_freq: bool | None = ...,
+ return_line: bool | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, Line2D]: ...
+ def csd(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ NFFT: int | None = ...,
+ Fs: float | None = ...,
+ Fc: int | None = ...,
+ detrend: Literal["none", "mean", "linear"]
+ | Callable[[ArrayLike], ArrayLike]
+ | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ noverlap: int | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale_by_freq: bool | None = ...,
+ return_line: bool | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, Line2D]: ...
+ def magnitude_spectrum(
+ self,
+ x: ArrayLike,
+ Fs: float | None = ...,
+ Fc: int | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale: Literal["default", "linear", "dB"] | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, Line2D]: ...
+ def angle_spectrum(
+ self,
+ x: ArrayLike,
+ Fs: float | None = ...,
+ Fc: int | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, Line2D]: ...
+ def phase_spectrum(
+ self,
+ x: ArrayLike,
+ Fs: float | None = ...,
+ Fc: int | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, Line2D]: ...
+ def cohere(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ NFFT: int = ...,
+ Fs: float = ...,
+ Fc: int = ...,
+ detrend: Literal["none", "mean", "linear"]
+ | Callable[[ArrayLike], ArrayLike] = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike = ...,
+ noverlap: int = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] = ...,
+ scale_by_freq: bool | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray]: ...
+ def specgram(
+ self,
+ x: ArrayLike,
+ NFFT: int | None = ...,
+ Fs: float | None = ...,
+ Fc: int | None = ...,
+ detrend: Literal["none", "mean", "linear"]
+ | Callable[[ArrayLike], ArrayLike]
+ | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ noverlap: int | None = ...,
+ cmap: str | Colormap | None = ...,
+ xextent: tuple[float, float] | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale_by_freq: bool | None = ...,
+ mode: Literal["default", "psd", "magnitude", "angle", "phase"] | None = ...,
+ scale: Literal["default", "linear", "dB"] | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ *,
+ data=...,
+ **kwargs
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray, AxesImage]: ...
+ def spy(
+ self,
+ Z: ArrayLike,
+ precision: float | Literal["present"] = ...,
+ marker: str | None = ...,
+ markersize: float | None = ...,
+ aspect: Literal["equal", "auto"] | float | None = ...,
+ origin: Literal["upper", "lower"] = ...,
+ **kwargs
+ ) -> AxesImage: ...
+ def matshow(self, Z: ArrayLike, **kwargs) -> AxesImage: ...
+ def violinplot(
+ self,
+ dataset: ArrayLike | Sequence[ArrayLike],
+ positions: ArrayLike | None = ...,
+ vert: bool = ...,
+ widths: float | ArrayLike = ...,
+ showmeans: bool = ...,
+ showextrema: bool = ...,
+ showmedians: bool = ...,
+ quantiles: Sequence[float | Sequence[float]] | None = ...,
+ points: int = ...,
+ bw_method: Literal["scott", "silverman"]
+ | float
+ | Callable[[GaussianKDE], float]
+ | None = ...,
+ *,
+ data=...,
+ ) -> dict[str, Collection]: ...
+ def violin(
+ self,
+ vpstats: Sequence[dict[str, Any]],
+ positions: ArrayLike | None = ...,
+ vert: bool = ...,
+ widths: float | ArrayLike = ...,
+ showmeans: bool = ...,
+ showextrema: bool = ...,
+ showmedians: bool = ...,
+ ) -> dict[str, Collection]: ...
+
+ table = mtable.table
+ stackplot = mstack.stackplot
+ streamplot = mstream.streamplot
+ tricontour = mtri.tricontour
+ tricontourf = mtri.tricontourf
+ tripcolor = mtri.tripcolor
+ triplot = mtri.triplot
diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi
new file mode 100644
index 0000000000..6adbb3e6f0
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi
@@ -0,0 +1,453 @@
+import matplotlib.artist as martist
+
+import datetime
+from collections.abc import Callable, Iterable, Iterator, Sequence
+from matplotlib import cbook
+from matplotlib.artist import Artist
+from matplotlib.axis import XAxis, YAxis, Tick
+from matplotlib.backend_bases import RendererBase, MouseButton, MouseEvent
+from matplotlib.cbook import CallbackRegistry
+from matplotlib.container import Container
+from matplotlib.collections import Collection
+from matplotlib.cm import ScalarMappable
+from matplotlib.legend import Legend
+from matplotlib.lines import Line2D
+from matplotlib.gridspec import SubplotSpec, GridSpec
+from matplotlib.figure import Figure
+from matplotlib.image import AxesImage
+from matplotlib.patches import Patch
+from matplotlib.scale import ScaleBase
+from matplotlib.spines import Spines
+from matplotlib.table import Table
+from matplotlib.text import Text
+from matplotlib.transforms import Transform, Bbox
+
+from cycler import Cycler
+
+import numpy as np
+from numpy.typing import ArrayLike
+from typing import Any, Literal, TypeVar, overload
+from matplotlib.typing import ColorType
+
+_T = TypeVar("_T", bound=Artist)
+
+class _axis_method_wrapper:
+ attr_name: str
+ method_name: str
+ __doc__: str
+ def __init__(
+ self, attr_name: str, method_name: str, *, doc_sub: dict[str, str] | None = ...
+ ) -> None: ...
+ def __set_name__(self, owner: Any, name: str) -> None: ...
+
+class _AxesBase(martist.Artist):
+ name: str
+ patch: Patch
+ spines: Spines
+ fmt_xdata: Callable[[float], str] | None
+ fmt_ydata: Callable[[float], str] | None
+ xaxis: XAxis
+ yaxis: YAxis
+ bbox: Bbox
+ dataLim: Bbox
+ transAxes: Transform
+ transScale: Transform
+ transLimits: Transform
+ transData: Transform
+ ignore_existing_data_limits: bool
+ axison: bool
+ containers: list[Container]
+ callbacks: CallbackRegistry
+ child_axes: list[_AxesBase]
+ legend_: Legend | None
+ title: Text
+ _projection_init: Any
+
+ def __init__(
+ self,
+ fig: Figure,
+ *args: tuple[float, float, float, float] | Bbox | int,
+ facecolor: ColorType | None = ...,
+ frameon: bool = ...,
+ sharex: _AxesBase | None = ...,
+ sharey: _AxesBase | None = ...,
+ label: Any = ...,
+ xscale: str | ScaleBase | None = ...,
+ yscale: str | ScaleBase | None = ...,
+ box_aspect: float | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_subplotspec(self) -> SubplotSpec | None: ...
+ def set_subplotspec(self, subplotspec: SubplotSpec) -> None: ...
+ def get_gridspec(self) -> GridSpec | None: ...
+ def set_figure(self, fig: Figure) -> None: ...
+ @property
+ def viewLim(self) -> Bbox: ...
+ def get_xaxis_transform(
+ self, which: Literal["grid", "tick1", "tick2"] = ...
+ ) -> Transform: ...
+ def get_xaxis_text1_transform(
+ self, pad_points: float
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_xaxis_text2_transform(
+ self, pad_points
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_yaxis_transform(
+ self, which: Literal["grid", "tick1", "tick2"] = ...
+ ) -> Transform: ...
+ def get_yaxis_text1_transform(
+ self, pad_points
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_yaxis_text2_transform(
+ self, pad_points
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_position(self, original: bool = ...) -> Bbox: ...
+ def set_position(
+ self,
+ pos: Bbox | tuple[float, float, float, float],
+ which: Literal["both", "active", "original"] = ...,
+ ) -> None: ...
+ def reset_position(self) -> None: ...
+ def set_axes_locator(
+ self, locator: Callable[[_AxesBase, RendererBase], Bbox]
+ ) -> None: ...
+ def get_axes_locator(self) -> Callable[[_AxesBase, RendererBase], Bbox]: ...
+ def sharex(self, other: _AxesBase) -> None: ...
+ def sharey(self, other: _AxesBase) -> None: ...
+ def clear(self) -> None: ...
+ def cla(self) -> None: ...
+
+ class ArtistList(Sequence[_T]):
+ def __init__(
+ self,
+ axes: _AxesBase,
+ prop_name: str,
+ valid_types: type | Iterable[type] | None = ...,
+ invalid_types: type | Iterable[type] | None = ...,
+ ) -> None: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[_T]: ...
+ @overload
+ def __getitem__(self, key: int) -> _T: ...
+ @overload
+ def __getitem__(self, key: slice) -> list[_T]: ...
+
+ @overload
+ def __add__(self, other: _AxesBase.ArtistList[_T]) -> list[_T]: ...
+ @overload
+ def __add__(self, other: list[Any]) -> list[Any]: ...
+ @overload
+ def __add__(self, other: tuple[Any]) -> tuple[Any]: ...
+
+ @overload
+ def __radd__(self, other: _AxesBase.ArtistList[_T]) -> list[_T]: ...
+ @overload
+ def __radd__(self, other: list[Any]) -> list[Any]: ...
+ @overload
+ def __radd__(self, other: tuple[Any]) -> tuple[Any]: ...
+
+ @property
+ def artists(self) -> _AxesBase.ArtistList[Artist]: ...
+ @property
+ def collections(self) -> _AxesBase.ArtistList[Collection]: ...
+ @property
+ def images(self) -> _AxesBase.ArtistList[AxesImage]: ...
+ @property
+ def lines(self) -> _AxesBase.ArtistList[Line2D]: ...
+ @property
+ def patches(self) -> _AxesBase.ArtistList[Patch]: ...
+ @property
+ def tables(self) -> _AxesBase.ArtistList[Table]: ...
+ @property
+ def texts(self) -> _AxesBase.ArtistList[Text]: ...
+ def get_facecolor(self) -> ColorType: ...
+ def set_facecolor(self, color: ColorType | None) -> None: ...
+ @overload
+ def set_prop_cycle(self, cycler: Cycler) -> None: ...
+ @overload
+ def set_prop_cycle(self, label: str, values: Iterable[Any]) -> None: ...
+ @overload
+ def set_prop_cycle(self, **kwargs: Iterable[Any]) -> None: ...
+ def get_aspect(self) -> float | Literal["auto"]: ...
+ def set_aspect(
+ self,
+ aspect: float | Literal["auto", "equal"],
+ adjustable: Literal["box", "datalim"] | None = ...,
+ anchor: str | tuple[float, float] | None = ...,
+ share: bool = ...,
+ ) -> None: ...
+ def get_adjustable(self) -> Literal["box", "datalim"]: ...
+ def set_adjustable(
+ self, adjustable: Literal["box", "datalim"], share: bool = ...
+ ) -> None: ...
+ def get_box_aspect(self) -> float | None: ...
+ def set_box_aspect(self, aspect: float | None = ...) -> None: ...
+ def get_anchor(self) -> str | tuple[float, float]: ...
+ def set_anchor(
+ self, anchor: str | tuple[float, float], share: bool = ...
+ ) -> None: ...
+ def get_data_ratio(self) -> float: ...
+ def apply_aspect(self, position: Bbox | None = ...) -> None: ...
+ @overload
+ def axis(
+ self,
+ arg: tuple[float, float, float, float] | bool | str | None = ...,
+ /,
+ *,
+ emit: bool = ...
+ ) -> tuple[float, float, float, float]: ...
+ @overload
+ def axis(
+ self,
+ *,
+ emit: bool = ...,
+ xmin: float | None = ...,
+ xmax: float | None = ...,
+ ymin: float | None = ...,
+ ymax: float | None = ...
+ ) -> tuple[float, float, float, float]: ...
+ def get_legend(self) -> Legend: ...
+ def get_images(self) -> list[AxesImage]: ...
+ def get_lines(self) -> list[Line2D]: ...
+ def get_xaxis(self) -> XAxis: ...
+ def get_yaxis(self) -> YAxis: ...
+ def has_data(self) -> bool: ...
+ def add_artist(self, a: Artist) -> Artist: ...
+ def add_child_axes(self, ax: _AxesBase) -> _AxesBase: ...
+ def add_collection(
+ self, collection: Collection, autolim: bool = ...
+ ) -> Collection: ...
+ def add_image(self, image: AxesImage) -> AxesImage: ...
+ def add_line(self, line: Line2D) -> Line2D: ...
+ def add_patch(self, p: Patch) -> Patch: ...
+ def add_table(self, tab: Table) -> Table: ...
+ def add_container(self, container: Container) -> Container: ...
+ def relim(self, visible_only: bool = ...) -> None: ...
+ def update_datalim(
+ self, xys: ArrayLike, updatex: bool = ..., updatey: bool = ...
+ ) -> None: ...
+ def in_axes(self, mouseevent: MouseEvent) -> bool: ...
+ def get_autoscale_on(self) -> bool: ...
+ def set_autoscale_on(self, b: bool) -> None: ...
+ @property
+ def use_sticky_edges(self) -> bool: ...
+ @use_sticky_edges.setter
+ def use_sticky_edges(self, b: bool) -> None: ...
+ def set_xmargin(self, m: float) -> None: ...
+ def set_ymargin(self, m: float) -> None: ...
+
+ # Probably could be made better with overloads
+ def margins(
+ self,
+ *margins: float,
+ x: float | None = ...,
+ y: float | None = ...,
+ tight: bool | None = ...
+ ) -> tuple[float, float] | None: ...
+ def set_rasterization_zorder(self, z: float | None) -> None: ...
+ def get_rasterization_zorder(self) -> float | None: ...
+ def autoscale(
+ self,
+ enable: bool = ...,
+ axis: Literal["both", "x", "y"] = ...,
+ tight: bool | None = ...,
+ ) -> None: ...
+ def autoscale_view(
+ self, tight: bool | None = ..., scalex: bool = ..., scaley: bool = ...
+ ) -> None: ...
+ def draw_artist(self, a: Artist) -> None: ...
+ def redraw_in_frame(self) -> None: ...
+ def get_frame_on(self) -> bool: ...
+ def set_frame_on(self, b: bool) -> None: ...
+ def get_axisbelow(self) -> bool | Literal["line"]: ...
+ def set_axisbelow(self, b: bool | Literal["line"]) -> None: ...
+ def grid(
+ self,
+ visible: bool | None = ...,
+ which: Literal["major", "minor", "both"] = ...,
+ axis: Literal["both", "x", "y"] = ...,
+ **kwargs
+ ) -> None: ...
+ def ticklabel_format(
+ self,
+ *,
+ axis: Literal["both", "x", "y"] = ...,
+ style: Literal["", "sci", "scientific", "plain"] = ...,
+ scilimits: tuple[int, int] | None = ...,
+ useOffset: bool | float | None = ...,
+ useLocale: bool | None = ...,
+ useMathText: bool | None = ...
+ ) -> None: ...
+ def locator_params(
+ self, axis: Literal["both", "x", "y"] = ..., tight: bool | None = ..., **kwargs
+ ) -> None: ...
+ def tick_params(self, axis: Literal["both", "x", "y"] = ..., **kwargs) -> None: ...
+ def set_axis_off(self) -> None: ...
+ def set_axis_on(self) -> None: ...
+ def get_xlabel(self) -> str: ...
+ def set_xlabel(
+ self,
+ xlabel: str,
+ fontdict: dict[str, Any] | None = ...,
+ labelpad: float | None = ...,
+ *,
+ loc: Literal["left", "center", "right"] | None = ...,
+ **kwargs
+ ) -> Text: ...
+ def invert_xaxis(self) -> None: ...
+ def get_xbound(self) -> tuple[float, float]: ...
+ def set_xbound(
+ self, lower: float | None = ..., upper: float | None = ...
+ ) -> None: ...
+ def get_xlim(self) -> tuple[float, float]: ...
+ def set_xlim(
+ self,
+ left: float | tuple[float, float] | None = ...,
+ right: float | None = ...,
+ *,
+ emit: bool = ...,
+ auto: bool | None = ...,
+ xmin: float | None = ...,
+ xmax: float | None = ...
+ ) -> tuple[float, float]: ...
+ def get_ylabel(self) -> str: ...
+ def set_ylabel(
+ self,
+ ylabel: str,
+ fontdict: dict[str, Any] | None = ...,
+ labelpad: float | None = ...,
+ *,
+ loc: Literal["bottom", "center", "top"] | None = ...,
+ **kwargs
+ ) -> Text: ...
+ def invert_yaxis(self) -> None: ...
+ def get_ybound(self) -> tuple[float, float]: ...
+ def set_ybound(
+ self, lower: float | None = ..., upper: float | None = ...
+ ) -> None: ...
+ def get_ylim(self) -> tuple[float, float]: ...
+ def set_ylim(
+ self,
+ bottom: float | tuple[float, float] | None = ...,
+ top: float | None = ...,
+ *,
+ emit: bool = ...,
+ auto: bool | None = ...,
+ ymin: float | None = ...,
+ ymax: float | None = ...
+ ) -> tuple[float, float]: ...
+ def format_xdata(self, x: float) -> str: ...
+ def format_ydata(self, y: float) -> str: ...
+ def format_coord(self, x: float, y: float) -> str: ...
+ def minorticks_on(self) -> None: ...
+ def minorticks_off(self) -> None: ...
+ def can_zoom(self) -> bool: ...
+ def can_pan(self) -> bool: ...
+ def get_navigate(self) -> bool: ...
+ def set_navigate(self, b: bool) -> None: ...
+ def get_navigate_mode(self) -> Literal["PAN", "ZOOM"] | None: ...
+ def set_navigate_mode(self, b: Literal["PAN", "ZOOM"] | None) -> None: ...
+ def start_pan(self, x: float, y: float, button: MouseButton) -> None: ...
+ def end_pan(self) -> None: ...
+ def drag_pan(
+ self, button: MouseButton, key: str | None, x: float, y: float
+ ) -> None: ...
+ def get_children(self) -> list[Artist]: ...
+ def contains_point(self, point: tuple[int, int]) -> bool: ...
+ def get_default_bbox_extra_artists(self) -> list[Artist]: ...
+ def get_tightbbox(
+ self,
+ renderer: RendererBase | None = ...,
+ *,
+ call_axes_locator: bool = ...,
+ bbox_extra_artists: Sequence[Artist] | None = ...,
+ for_layout_only: bool = ...
+ ) -> Bbox | None: ...
+ def twinx(self) -> _AxesBase: ...
+ def twiny(self) -> _AxesBase: ...
+ def get_shared_x_axes(self) -> cbook.GrouperView: ...
+ def get_shared_y_axes(self) -> cbook.GrouperView: ...
+ def label_outer(self, remove_inner_ticks: bool = ...) -> None: ...
+
+ # The methods underneath this line are added via the `_axis_method_wrapper` class
+ # Initially they are set to an object, but that object uses `__set_name__` to override
+ # itself with a method modified from the Axis methods for the x or y Axis.
+ # As such, they are typed according to the resultant method rather than as that object.
+
+ def get_xgridlines(self) -> list[Line2D]: ...
+ def get_xticklines(self, minor: bool = ...) -> list[Line2D]: ...
+ def get_ygridlines(self) -> list[Line2D]: ...
+ def get_yticklines(self, minor: bool = ...) -> list[Line2D]: ...
+ def _sci(self, im: ScalarMappable) -> None: ...
+ def get_autoscalex_on(self) -> bool: ...
+ def get_autoscaley_on(self) -> bool: ...
+ def set_autoscalex_on(self, b: bool) -> None: ...
+ def set_autoscaley_on(self, b: bool) -> None: ...
+ def xaxis_inverted(self) -> bool: ...
+ def get_xscale(self) -> str: ...
+ def set_xscale(self, value: str | ScaleBase, **kwargs) -> None: ...
+ def get_xticks(self, *, minor: bool = ...) -> np.ndarray: ...
+ def set_xticks(
+ self,
+ ticks: ArrayLike,
+ labels: Iterable[str] | None = ...,
+ *,
+ minor: bool = ...,
+ **kwargs
+ ) -> list[Tick]: ...
+ def get_xmajorticklabels(self) -> list[Text]: ...
+ def get_xminorticklabels(self) -> list[Text]: ...
+ def get_xticklabels(
+ self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ...
+ ) -> list[Text]: ...
+ def set_xticklabels(
+ self,
+ labels: Iterable[str | Text],
+ *,
+ minor: bool = ...,
+ fontdict: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> list[Text]: ...
+ def yaxis_inverted(self) -> bool: ...
+ def get_yscale(self) -> str: ...
+ def set_yscale(self, value: str | ScaleBase, **kwargs) -> None: ...
+ def get_yticks(self, *, minor: bool = ...) -> np.ndarray: ...
+ def set_yticks(
+ self,
+ ticks: ArrayLike,
+ labels: Iterable[str] | None = ...,
+ *,
+ minor: bool = ...,
+ **kwargs
+ ) -> list[Tick]: ...
+ def get_ymajorticklabels(self) -> list[Text]: ...
+ def get_yminorticklabels(self) -> list[Text]: ...
+ def get_yticklabels(
+ self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ...
+ ) -> list[Text]: ...
+ def set_yticklabels(
+ self,
+ labels: Iterable[str | Text],
+ *,
+ minor: bool = ...,
+ fontdict: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> list[Text]: ...
+ def xaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ...
+ def yaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi
new file mode 100644
index 0000000000..dcf1d2eb77
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi
@@ -0,0 +1,42 @@
+from matplotlib.axes._base import _AxesBase
+from matplotlib.axis import Tick
+
+from matplotlib.transforms import Transform
+
+from collections.abc import Callable, Iterable
+from typing import Literal
+from numpy.typing import ArrayLike
+from matplotlib.typing import ColorType
+
+class SecondaryAxis(_AxesBase):
+ def __init__(
+ self,
+ parent: _AxesBase,
+ orientation: Literal["x", "y"],
+ location: Literal["top", "bottom", "right", "left"] | float,
+ functions: tuple[
+ Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
+ ]
+ | Transform,
+ **kwargs
+ ) -> None: ...
+ def set_alignment(
+ self, align: Literal["top", "bottom", "right", "left"]
+ ) -> None: ...
+ def set_location(
+ self, location: Literal["top", "bottom", "right", "left"] | float
+ ) -> None: ...
+ def set_ticks(
+ self,
+ ticks: ArrayLike,
+ labels: Iterable[str] | None = ...,
+ *,
+ minor: bool = ...,
+ **kwargs
+ ) -> list[Tick]: ...
+ def set_functions(
+ self,
+ functions: tuple[Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]] | Transform,
+ ) -> None: ...
+ def set_aspect(self, *args, **kwargs) -> None: ...
+ def set_color(self, color: ColorType) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/axis.pyi b/contrib/python/matplotlib/py3/matplotlib/axis.pyi
new file mode 100644
index 0000000000..5ca8fcb6fd
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/axis.pyi
@@ -0,0 +1,278 @@
+from collections.abc import Callable, Iterable, Sequence
+import datetime
+from typing import Any, Literal, overload
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+import matplotlib.artist as martist
+from matplotlib import cbook
+from matplotlib.axes import Axes
+from matplotlib.backend_bases import RendererBase
+from matplotlib.lines import Line2D
+from matplotlib.text import Text
+from matplotlib.ticker import Locator, Formatter
+from matplotlib.transforms import Transform, Bbox
+from matplotlib.typing import ColorType
+
+
+GRIDLINE_INTERPOLATION_STEPS: int
+
+class Tick(martist.Artist):
+ axes: Axes
+ tick1line: Line2D
+ tick2line: Line2D
+ gridline: Line2D
+ label1: Text
+ label2: Text
+ def __init__(
+ self,
+ axes: Axes,
+ loc: float,
+ *,
+ size: float | None = ...,
+ width: float | None = ...,
+ color: ColorType | None = ...,
+ tickdir: Literal["in", "inout", "out"] | None = ...,
+ pad: float | None = ...,
+ labelsize: float | None = ...,
+ labelcolor: ColorType | None = ...,
+ labelfontfamily: str | Sequence[str] | None = ...,
+ zorder: float | None = ...,
+ gridOn: bool | None = ...,
+ tick1On: bool = ...,
+ tick2On: bool = ...,
+ label1On: bool = ...,
+ label2On: bool = ...,
+ major: bool = ...,
+ labelrotation: float = ...,
+ grid_color: ColorType | None = ...,
+ grid_linestyle: str | None = ...,
+ grid_linewidth: float | None = ...,
+ grid_alpha: float | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_tickdir(self) -> Literal["in", "inout", "out"]: ...
+ def get_tick_padding(self) -> float: ...
+ def get_children(self) -> list[martist.Artist]: ...
+ stale: bool
+ def set_pad(self, val: float) -> None: ...
+ def get_pad(self) -> None: ...
+ def get_loc(self) -> float: ...
+ def set_label1(self, s: object) -> None: ...
+ def set_label(self, s: object) -> None: ...
+ def set_label2(self, s: object) -> None: ...
+ def set_url(self, url: str | None) -> None: ...
+ def get_view_interval(self) -> ArrayLike: ...
+ def update_position(self, loc: float) -> None: ...
+
+class XTick(Tick):
+ __name__: str
+ def __init__(self, *args, **kwargs) -> None: ...
+ stale: bool
+ def update_position(self, loc: float) -> None: ...
+ def get_view_interval(self) -> np.ndarray: ...
+
+class YTick(Tick):
+ __name__: str
+ def __init__(self, *args, **kwargs) -> None: ...
+ stale: bool
+ def update_position(self, loc: float) -> None: ...
+ def get_view_interval(self) -> np.ndarray: ...
+
+class Ticker:
+ def __init__(self) -> None: ...
+ @property
+ def locator(self) -> Locator | None: ...
+ @locator.setter
+ def locator(self, locator: Locator) -> None: ...
+ @property
+ def formatter(self) -> Formatter | None: ...
+ @formatter.setter
+ def formatter(self, formatter: Formatter) -> None: ...
+
+class _LazyTickList:
+ def __init__(self, major: bool) -> None: ...
+ # Replace return with Self when py3.9 is dropped
+ @overload
+ def __get__(self, instance: None, owner: None) -> _LazyTickList: ...
+ @overload
+ def __get__(self, instance: Axis, owner: type[Axis]) -> list[Tick]: ...
+
+class Axis(martist.Artist):
+ OFFSETTEXTPAD: int
+ isDefault_label: bool
+ axes: Axes
+ major: Ticker
+ minor: Ticker
+ callbacks: cbook.CallbackRegistry
+ label: Text
+ offsetText: Text
+ labelpad: float
+ pickradius: float
+ def __init__(self, axes, *, pickradius: float = ...,
+ clear: bool = ...) -> None: ...
+ @property
+ def isDefault_majloc(self) -> bool: ...
+ @isDefault_majloc.setter
+ def isDefault_majloc(self, value: bool) -> None: ...
+ @property
+ def isDefault_majfmt(self) -> bool: ...
+ @isDefault_majfmt.setter
+ def isDefault_majfmt(self, value: bool) -> None: ...
+ @property
+ def isDefault_minloc(self) -> bool: ...
+ @isDefault_minloc.setter
+ def isDefault_minloc(self, value: bool) -> None: ...
+ @property
+ def isDefault_minfmt(self) -> bool: ...
+ @isDefault_minfmt.setter
+ def isDefault_minfmt(self, value: bool) -> None: ...
+ majorTicks: _LazyTickList
+ minorTicks: _LazyTickList
+ def get_remove_overlapping_locs(self) -> bool: ...
+ def set_remove_overlapping_locs(self, val: bool) -> None: ...
+ @property
+ def remove_overlapping_locs(self) -> bool: ...
+ @remove_overlapping_locs.setter
+ def remove_overlapping_locs(self, val: bool) -> None: ...
+ stale: bool
+ def set_label_coords(
+ self, x: float, y: float, transform: Transform | None = ...
+ ) -> None: ...
+ def get_transform(self) -> Transform: ...
+ def get_scale(self) -> str: ...
+ def limit_range_for_scale(
+ self, vmin: float, vmax: float
+ ) -> tuple[float, float]: ...
+ def get_children(self) -> list[martist.Artist]: ...
+ # TODO units
+ converter: Any
+ units: Any
+ def clear(self) -> None: ...
+ def reset_ticks(self) -> None: ...
+ def set_tick_params(
+ self,
+ which: Literal["major", "minor", "both"] = ...,
+ reset: bool = ...,
+ **kwargs
+ ) -> None: ...
+ def get_tick_params(
+ self, which: Literal["major", "minor"] = ...
+ ) -> dict[str, Any]: ...
+ def get_view_interval(self) -> tuple[float, float]: ...
+ def set_view_interval(
+ self, vmin: float, vmax: float, ignore: bool = ...
+ ) -> None: ...
+ def get_data_interval(self) -> tuple[float, float]: ...
+ def set_data_interval(
+ self, vmin: float, vmax: float, ignore: bool = ...
+ ) -> None: ...
+ def get_inverted(self) -> bool: ...
+ def set_inverted(self, inverted: bool) -> None: ...
+ def set_default_intervals(self) -> None: ...
+ def get_tightbbox(
+ self, renderer: RendererBase | None = ..., *, for_layout_only: bool = ...
+ ) -> Bbox | None: ...
+ def get_tick_padding(self) -> float: ...
+ def get_gridlines(self) -> list[Line2D]: ...
+ def get_label(self) -> Text: ...
+ def get_offset_text(self) -> Text: ...
+ def get_pickradius(self) -> float: ...
+ def get_majorticklabels(self) -> list[Text]: ...
+ def get_minorticklabels(self) -> list[Text]: ...
+ def get_ticklabels(
+ self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ...
+ ) -> list[Text]: ...
+ def get_majorticklines(self) -> list[Line2D]: ...
+ def get_minorticklines(self) -> list[Line2D]: ...
+ def get_ticklines(self, minor: bool = ...) -> list[Line2D]: ...
+ def get_majorticklocs(self) -> np.ndarray: ...
+ def get_minorticklocs(self) -> np.ndarray: ...
+ def get_ticklocs(self, *, minor: bool = ...) -> np.ndarray: ...
+ def get_ticks_direction(self, minor: bool = ...) -> np.ndarray: ...
+ def get_label_text(self) -> str: ...
+ def get_major_locator(self) -> Locator: ...
+ def get_minor_locator(self) -> Locator: ...
+ def get_major_formatter(self) -> Formatter: ...
+ def get_minor_formatter(self) -> Formatter: ...
+ def get_major_ticks(self, numticks: int | None = ...) -> list[Tick]: ...
+ def get_minor_ticks(self, numticks: int | None = ...) -> list[Tick]: ...
+ def grid(
+ self,
+ visible: bool | None = ...,
+ which: Literal["major", "minor", "both"] = ...,
+ **kwargs
+ ) -> None: ...
+ # TODO units
+ def update_units(self, data): ...
+ def have_units(self) -> bool: ...
+ def convert_units(self, x): ...
+ def set_units(self, u) -> None: ...
+ def get_units(self): ...
+ def set_label_text(
+ self, label: str, fontdict: dict[str, Any] | None = ..., **kwargs
+ ) -> Text: ...
+ def set_major_formatter(
+ self, formatter: Formatter | str | Callable[[float, float], str]
+ ) -> None: ...
+ def set_minor_formatter(
+ self, formatter: Formatter | str | Callable[[float, float], str]
+ ) -> None: ...
+ def set_major_locator(self, locator: Locator) -> None: ...
+ def set_minor_locator(self, locator: Locator) -> None: ...
+ def set_pickradius(self, pickradius: float) -> None: ...
+ def set_ticklabels(
+ self,
+ labels: Iterable[str | Text],
+ *,
+ minor: bool = ...,
+ fontdict: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> list[Text]: ...
+ def set_ticks(
+ self,
+ ticks: ArrayLike,
+ labels: Iterable[str] | None = ...,
+ *,
+ minor: bool = ...,
+ **kwargs
+ ) -> list[Tick]: ...
+ def axis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ...
+ def get_tick_space(self) -> int: ...
+ def get_label_position(self) -> Literal["top", "bottom"]: ...
+ def set_label_position(
+ self, position: Literal["top", "bottom", "left", "right"]
+ ) -> None: ...
+ def get_minpos(self) -> float: ...
+
+class XAxis(Axis):
+ __name__: str
+ axis_name: str
+ def __init__(self, *args, **kwargs) -> None: ...
+ label_position: Literal["bottom", "top"]
+ stale: bool
+ def set_label_position(self, position: Literal["bottom", "top"]) -> None: ... # type: ignore[override]
+ def set_ticks_position(
+ self, position: Literal["top", "bottom", "both", "default", "none"]
+ ) -> None: ...
+ def tick_top(self) -> None: ...
+ def tick_bottom(self) -> None: ...
+ def get_ticks_position(self) -> Literal["top", "bottom", "default", "unknown"]: ...
+ def get_tick_space(self) -> int: ...
+
+class YAxis(Axis):
+ __name__: str
+ axis_name: str
+ def __init__(self, *args, **kwargs) -> None: ...
+ label_position: Literal["left", "right"]
+ stale: bool
+ def set_label_position(self, position: Literal["left", "right"]) -> None: ... # type: ignore[override]
+ def set_offset_position(self, position: Literal["left", "right"]) -> None: ...
+ def set_ticks_position(
+ self, position: Literal["left", "right", "both", "default", "none"]
+ ) -> None: ...
+ def tick_right(self) -> None: ...
+ def tick_left(self) -> None: ...
+ def get_ticks_position(self) -> Literal["left", "right", "default", "unknown"]: ...
+ def get_tick_space(self) -> int: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi b/contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi
new file mode 100644
index 0000000000..0ae88cf18a
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi
@@ -0,0 +1,490 @@
+from enum import Enum, IntEnum
+import os
+from matplotlib import (
+ cbook,
+ transforms,
+ widgets,
+ _api,
+)
+from matplotlib.artist import Artist
+from matplotlib.axes import Axes
+from matplotlib.backend_managers import ToolManager
+from matplotlib.backend_tools import Cursors, ToolBase
+from matplotlib.colorbar import Colorbar
+from matplotlib.figure import Figure
+from matplotlib.font_manager import FontProperties
+from matplotlib.path import Path
+from matplotlib.texmanager import TexManager
+from matplotlib.text import Text
+from matplotlib.transforms import Bbox, BboxBase, Transform, TransformedPath
+
+from collections.abc import Callable, Iterable, Sequence
+from typing import Any, IO, Literal, NamedTuple, TypeVar
+from numpy.typing import ArrayLike
+from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType
+
+def register_backend(
+ format: str, backend: str | type[FigureCanvasBase], description: str | None = ...
+) -> None: ...
+def get_registered_canvas_class(format: str) -> type[FigureCanvasBase]: ...
+
+class RendererBase:
+ def __init__(self) -> None: ...
+ def open_group(self, s: str, gid: str | None = ...) -> None: ...
+ def close_group(self, s: str) -> None: ...
+ def draw_path(
+ self,
+ gc: GraphicsContextBase,
+ path: Path,
+ transform: Transform,
+ rgbFace: ColorType | None = ...,
+ ) -> None: ...
+ def draw_markers(
+ self,
+ gc: GraphicsContextBase,
+ marker_path: Path,
+ marker_trans: Transform,
+ path: Path,
+ trans: Transform,
+ rgbFace: ColorType | None = ...,
+ ) -> None: ...
+ def draw_path_collection(
+ self,
+ gc: GraphicsContextBase,
+ master_transform: Transform,
+ paths: Sequence[Path],
+ all_transforms: Sequence[ArrayLike],
+ offsets: ArrayLike | Sequence[ArrayLike],
+ offset_trans: Transform,
+ facecolors: ColorType | Sequence[ColorType],
+ edgecolors: ColorType | Sequence[ColorType],
+ linewidths: float | Sequence[float],
+ linestyles: LineStyleType | Sequence[LineStyleType],
+ antialiaseds: bool | Sequence[bool],
+ urls: str | Sequence[str],
+ offset_position: Any,
+ ) -> None: ...
+ def draw_quad_mesh(
+ self,
+ gc: GraphicsContextBase,
+ master_transform: Transform,
+ meshWidth,
+ meshHeight,
+ coordinates: ArrayLike,
+ offsets: ArrayLike | Sequence[ArrayLike],
+ offsetTrans: Transform,
+ facecolors: Sequence[ColorType],
+ antialiased: bool,
+ edgecolors: Sequence[ColorType] | ColorType | None,
+ ) -> None: ...
+ def draw_gouraud_triangle(
+ self,
+ gc: GraphicsContextBase,
+ points: ArrayLike,
+ colors: ArrayLike,
+ transform: Transform,
+ ) -> None: ...
+ def draw_gouraud_triangles(
+ self,
+ gc: GraphicsContextBase,
+ triangles_array: ArrayLike,
+ colors_array: ArrayLike,
+ transform: Transform,
+ ) -> None: ...
+ def get_image_magnification(self) -> float: ...
+ def draw_image(
+ self,
+ gc: GraphicsContextBase,
+ x: float,
+ y: float,
+ im: ArrayLike,
+ transform: transforms.Affine2DBase | None = ...,
+ ) -> None: ...
+ def option_image_nocomposite(self) -> bool: ...
+ def option_scale_image(self) -> bool: ...
+ def draw_tex(
+ self,
+ gc: GraphicsContextBase,
+ x: float,
+ y: float,
+ s: str,
+ prop: FontProperties,
+ angle: float,
+ *,
+ mtext: Text | None = ...
+ ) -> None: ...
+ def draw_text(
+ self,
+ gc: GraphicsContextBase,
+ x: float,
+ y: float,
+ s: str,
+ prop: FontProperties,
+ angle: float,
+ ismath: bool | Literal["TeX"] = ...,
+ mtext: Text | None = ...,
+ ) -> None: ...
+ def get_text_width_height_descent(
+ self, s: str, prop: FontProperties, ismath: bool | Literal["TeX"]
+ ) -> tuple[float, float, float]: ...
+ def flipy(self) -> bool: ...
+ def get_canvas_width_height(self) -> tuple[float, float]: ...
+ def get_texmanager(self) -> TexManager: ...
+ def new_gc(self) -> GraphicsContextBase: ...
+ def points_to_pixels(self, points: ArrayLike) -> ArrayLike: ...
+ def start_rasterizing(self) -> None: ...
+ def stop_rasterizing(self) -> None: ...
+ def start_filter(self) -> None: ...
+ def stop_filter(self, filter_func) -> None: ...
+
+class GraphicsContextBase:
+ def __init__(self) -> None: ...
+ def copy_properties(self, gc: GraphicsContextBase) -> None: ...
+ def restore(self) -> None: ...
+ def get_alpha(self) -> float: ...
+ def get_antialiased(self) -> int: ...
+ def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ...
+ def get_clip_rectangle(self) -> Bbox | None: ...
+ def get_clip_path(
+ self,
+ ) -> tuple[TransformedPath, Transform] | tuple[None, None]: ...
+ def get_dashes(self) -> tuple[float, ArrayLike | None]: ...
+ def get_forced_alpha(self) -> bool: ...
+ def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ...
+ def get_linewidth(self) -> float: ...
+ def get_rgb(self) -> tuple[float, float, float, float]: ...
+ def get_url(self) -> str | None: ...
+ def get_gid(self) -> int | None: ...
+ def get_snap(self) -> bool | None: ...
+ def set_alpha(self, alpha: float) -> None: ...
+ def set_antialiased(self, b: bool) -> None: ...
+ def set_capstyle(self, cs: CapStyleType) -> None: ...
+ def set_clip_rectangle(self, rectangle: Bbox | None) -> None: ...
+ def set_clip_path(self, path: TransformedPath | None) -> None: ...
+ def set_dashes(self, dash_offset: float, dash_list: ArrayLike | None) -> None: ...
+ def set_foreground(self, fg: ColorType, isRGBA: bool = ...) -> None: ...
+ def set_joinstyle(self, js: JoinStyleType) -> None: ...
+ def set_linewidth(self, w: float) -> None: ...
+ def set_url(self, url: str | None) -> None: ...
+ def set_gid(self, id: int | None) -> None: ...
+ def set_snap(self, snap: bool | None) -> None: ...
+ def set_hatch(self, hatch: str | None) -> None: ...
+ def get_hatch(self) -> str | None: ...
+ def get_hatch_path(self, density: float = ...) -> Path: ...
+ def get_hatch_color(self) -> ColorType: ...
+ def set_hatch_color(self, hatch_color: ColorType) -> None: ...
+ def get_hatch_linewidth(self) -> float: ...
+ def get_sketch_params(self) -> tuple[float, float, float] | None: ...
+ def set_sketch_params(
+ self,
+ scale: float | None = ...,
+ length: float | None = ...,
+ randomness: float | None = ...,
+ ) -> None: ...
+
+class TimerBase:
+ callbacks: list[tuple[Callable, tuple, dict[str, Any]]]
+ def __init__(
+ self,
+ interval: int | None = ...,
+ callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ...,
+ ) -> None: ...
+ def __del__(self) -> None: ...
+ def start(self, interval: int | None = ...) -> None: ...
+ def stop(self) -> None: ...
+ @property
+ def interval(self) -> int: ...
+ @interval.setter
+ def interval(self, interval: int) -> None: ...
+ @property
+ def single_shot(self) -> bool: ...
+ @single_shot.setter
+ def single_shot(self, ss: bool) -> None: ...
+ def add_callback(self, func: Callable, *args, **kwargs) -> Callable: ...
+ def remove_callback(self, func: Callable, *args, **kwargs) -> None: ...
+
+class Event:
+ name: str
+ canvas: FigureCanvasBase
+ def __init__(
+ self, name: str, canvas: FigureCanvasBase, guiEvent: Any | None = ...
+ ) -> None: ...
+
+ @property
+ def guiEvent(self) -> Any: ...
+
+class DrawEvent(Event):
+ renderer: RendererBase
+ def __init__(
+ self, name: str, canvas: FigureCanvasBase, renderer: RendererBase
+ ) -> None: ...
+
+class ResizeEvent(Event):
+ width: int
+ height: int
+ def __init__(self, name: str, canvas: FigureCanvasBase) -> None: ...
+
+class CloseEvent(Event): ...
+
+class LocationEvent(Event):
+ lastevent: Event | None
+ x: int
+ y: int
+ inaxes: Axes | None
+ xdata: float | None
+ ydata: float | None
+ def __init__(
+ self,
+ name: str,
+ canvas: FigureCanvasBase,
+ x: int,
+ y: int,
+ guiEvent: Any | None = ...,
+ *,
+ modifiers: Iterable[str] | None = ...,
+ ) -> None: ...
+
+class MouseButton(IntEnum):
+ LEFT: int
+ MIDDLE: int
+ RIGHT: int
+ BACK: int
+ FORWARD: int
+
+class MouseEvent(LocationEvent):
+ button: MouseButton | Literal["up", "down"] | None
+ key: str | None
+ step: float
+ dblclick: bool
+ def __init__(
+ self,
+ name: str,
+ canvas: FigureCanvasBase,
+ x: int,
+ y: int,
+ button: MouseButton | Literal["up", "down"] | None = ...,
+ key: str | None = ...,
+ step: float = ...,
+ dblclick: bool = ...,
+ guiEvent: Any | None = ...,
+ *,
+ modifiers: Iterable[str] | None = ...,
+ ) -> None: ...
+
+class PickEvent(Event):
+ mouseevent: MouseEvent
+ artist: Artist
+ def __init__(
+ self,
+ name: str,
+ canvas: FigureCanvasBase,
+ mouseevent: MouseEvent,
+ artist: Artist,
+ guiEvent: Any | None = ...,
+ **kwargs
+ ) -> None: ...
+
+class KeyEvent(LocationEvent):
+ key: str | None
+ def __init__(
+ self,
+ name: str,
+ canvas: FigureCanvasBase,
+ key: str | None,
+ x: int = ...,
+ y: int = ...,
+ guiEvent: Any | None = ...,
+ ) -> None: ...
+
+class FigureCanvasBase:
+ required_interactive_framework: str | None
+
+ @_api.classproperty
+ def manager_class(cls) -> type[FigureManagerBase]: ...
+ events: list[str]
+ fixed_dpi: None | float
+ filetypes: dict[str, str]
+
+ @_api.classproperty
+ def supports_blit(cls) -> bool: ...
+
+ figure: Figure
+ manager: None | FigureManagerBase
+ widgetlock: widgets.LockDraw
+ mouse_grabber: None | Axes
+ toolbar: None | NavigationToolbar2
+ def __init__(self, figure: Figure | None = ...) -> None: ...
+ @property
+ def callbacks(self) -> cbook.CallbackRegistry: ...
+ @property
+ def button_pick_id(self) -> int: ...
+ @property
+ def scroll_pick_id(self) -> int: ...
+ @classmethod
+ def new_manager(cls, figure: Figure, num: int | str) -> FigureManagerBase: ...
+ def is_saving(self) -> bool: ...
+ def blit(self, bbox: BboxBase | None = ...) -> None: ...
+ def inaxes(self, xy: tuple[float, float]) -> Axes | None: ...
+ def grab_mouse(self, ax: Axes) -> None: ...
+ def release_mouse(self, ax: Axes) -> None: ...
+ def set_cursor(self, cursor: Cursors) -> None: ...
+ def draw(self, *args, **kwargs) -> None: ...
+ def draw_idle(self, *args, **kwargs) -> None: ...
+ @property
+ def device_pixel_ratio(self) -> float: ...
+ def get_width_height(self, *, physical: bool = ...) -> tuple[int, int]: ...
+ @classmethod
+ def get_supported_filetypes(cls) -> dict[str, str]: ...
+ @classmethod
+ def get_supported_filetypes_grouped(cls) -> dict[str, list[str]]: ...
+ def print_figure(
+ self,
+ filename: str | os.PathLike | IO,
+ dpi: float | None = ...,
+ facecolor: ColorType | Literal["auto"] | None = ...,
+ edgecolor: ColorType | Literal["auto"] | None = ...,
+ orientation: str = ...,
+ format: str | None = ...,
+ *,
+ bbox_inches: Literal["tight"] | Bbox | None = ...,
+ pad_inches: float | None = ...,
+ bbox_extra_artists: list[Artist] | None = ...,
+ backend: str | None = ...,
+ **kwargs
+ ) -> Any: ...
+ @classmethod
+ def get_default_filetype(cls) -> str: ...
+ def get_default_filename(self) -> str: ...
+ _T = TypeVar("_T", bound=FigureCanvasBase)
+ def switch_backends(self, FigureCanvasClass: type[_T]) -> _T: ...
+ def mpl_connect(self, s: str, func: Callable[[Event], Any]) -> int: ...
+ def mpl_disconnect(self, cid: int) -> None: ...
+ def new_timer(
+ self,
+ interval: int | None = ...,
+ callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ...,
+ ) -> TimerBase: ...
+ def flush_events(self) -> None: ...
+ def start_event_loop(self, timeout: float = ...) -> None: ...
+ def stop_event_loop(self) -> None: ...
+
+def key_press_handler(
+ event: KeyEvent,
+ canvas: FigureCanvasBase | None = ...,
+ toolbar: NavigationToolbar2 | None = ...,
+) -> None: ...
+def button_press_handler(
+ event: MouseEvent,
+ canvas: FigureCanvasBase | None = ...,
+ toolbar: NavigationToolbar2 | None = ...,
+) -> None: ...
+
+class NonGuiException(Exception): ...
+
+class FigureManagerBase:
+ canvas: FigureCanvasBase
+ num: int | str
+ key_press_handler_id: int | None
+ button_press_handler_id: int | None
+ toolmanager: ToolManager | None
+ toolbar: NavigationToolbar2 | ToolContainerBase | None
+ def __init__(self, canvas: FigureCanvasBase, num: int | str) -> None: ...
+ @classmethod
+ def create_with_canvas(
+ cls, canvas_class: type[FigureCanvasBase], figure: Figure, num: int | str
+ ) -> FigureManagerBase: ...
+ @classmethod
+ def start_main_loop(cls) -> None: ...
+ @classmethod
+ def pyplot_show(cls, *, block: bool | None = ...) -> None: ...
+ def show(self) -> None: ...
+ def destroy(self) -> None: ...
+ def full_screen_toggle(self) -> None: ...
+ def resize(self, w: int, h: int) -> None: ...
+ def get_window_title(self) -> str: ...
+ def set_window_title(self, title: str) -> None: ...
+
+cursors = Cursors
+
+class _Mode(str, Enum):
+ NONE: str
+ PAN: str
+ ZOOM: str
+
+class NavigationToolbar2:
+ toolitems: tuple[tuple[str, ...] | tuple[None, ...], ...]
+ canvas: FigureCanvasBase
+ mode: _Mode
+ def __init__(self, canvas: FigureCanvasBase) -> None: ...
+ def set_message(self, s: str) -> None: ...
+ def draw_rubberband(
+ self, event: Event, x0: float, y0: float, x1: float, y1: float
+ ) -> None: ...
+ def remove_rubberband(self) -> None: ...
+ def home(self, *args) -> None: ...
+ def back(self, *args) -> None: ...
+ def forward(self, *args) -> None: ...
+ def mouse_move(self, event: MouseEvent) -> None: ...
+ def pan(self, *args) -> None: ...
+
+ class _PanInfo(NamedTuple):
+ button: MouseButton
+ axes: list[Axes]
+ cid: int
+ def press_pan(self, event: Event) -> None: ...
+ def drag_pan(self, event: Event) -> None: ...
+ def release_pan(self, event: Event) -> None: ...
+ def zoom(self, *args) -> None: ...
+
+ class _ZoomInfo(NamedTuple):
+ direction: Literal["in", "out"]
+ start_xy: tuple[float, float]
+ axes: list[Axes]
+ cid: int
+ cbar: Colorbar
+ def press_zoom(self, event: Event) -> None: ...
+ def drag_zoom(self, event: Event) -> None: ...
+ def release_zoom(self, event: Event) -> None: ...
+ def push_current(self) -> None: ...
+ subplot_tool: widgets.SubplotTool
+ def configure_subplots(self, *args): ...
+ def save_figure(self, *args) -> None: ...
+ def update(self) -> None: ...
+ def set_history_buttons(self) -> None: ...
+
+class ToolContainerBase:
+ toolmanager: ToolManager
+ def __init__(self, toolmanager: ToolManager) -> None: ...
+ def add_tool(self, tool: ToolBase, group: str, position: int = ...) -> None: ...
+ def trigger_tool(self, name: str) -> None: ...
+ def add_toolitem(
+ self,
+ name: str,
+ group: str,
+ position: int,
+ image: str,
+ description: str,
+ toggle: bool,
+ ) -> None: ...
+ def toggle_toolitem(self, name: str, toggled: bool) -> None: ...
+ def remove_toolitem(self, name: str) -> None: ...
+ def set_message(self, s: str) -> None: ...
+
+class _Backend:
+ backend_version: str
+ FigureCanvas: type[FigureCanvasBase] | None
+ FigureManager: type[FigureManagerBase]
+ mainloop: None | Callable[[], Any]
+ @classmethod
+ def new_figure_manager(cls, num: int | str, *args, **kwargs) -> FigureManagerBase: ...
+ @classmethod
+ def new_figure_manager_given_figure(cls, num: int | str, figure: Figure) -> FigureManagerBase: ...
+ @classmethod
+ def draw_if_interactive(cls) -> None: ...
+ @classmethod
+ def show(cls, *, block: bool | None = ...) -> None: ...
+ @staticmethod
+ def export(cls) -> type[_Backend]: ...
+
+class ShowBase(_Backend):
+ def __call__(self, block: bool | None = ...) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi b/contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi
new file mode 100644
index 0000000000..9e59acb14e
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi
@@ -0,0 +1,64 @@
+from matplotlib import backend_tools, widgets
+from matplotlib.backend_bases import FigureCanvasBase
+from matplotlib.figure import Figure
+
+from collections.abc import Callable, Iterable
+from typing import Any, TypeVar
+
+class ToolEvent:
+ name: str
+ sender: Any
+ tool: backend_tools.ToolBase
+ data: Any
+ def __init__(self, name, sender, tool, data: Any | None = ...) -> None: ...
+
+class ToolTriggerEvent(ToolEvent):
+ canvasevent: ToolEvent
+ def __init__(
+ self,
+ name,
+ sender,
+ tool,
+ canvasevent: ToolEvent | None = ...,
+ data: Any | None = ...,
+ ) -> None: ...
+
+class ToolManagerMessageEvent:
+ name: str
+ sender: Any
+ message: str
+ def __init__(self, name: str, sender: Any, message: str) -> None: ...
+
+class ToolManager:
+ keypresslock: widgets.LockDraw
+ messagelock: widgets.LockDraw
+ def __init__(self, figure: Figure | None = ...) -> None: ...
+ @property
+ def canvas(self) -> FigureCanvasBase | None: ...
+ @property
+ def figure(self) -> Figure | None: ...
+ @figure.setter
+ def figure(self, figure: Figure) -> None: ...
+ def set_figure(self, figure: Figure, update_tools: bool = ...) -> None: ...
+ def toolmanager_connect(self, s: str, func: Callable[[ToolEvent], Any]) -> int: ...
+ def toolmanager_disconnect(self, cid: int) -> None: ...
+ def message_event(self, message: str, sender: Any | None = ...) -> None: ...
+ @property
+ def active_toggle(self) -> dict[str | None, list[str] | str]: ...
+ def get_tool_keymap(self, name: str) -> list[str]: ...
+ def update_keymap(self, name: str, key: str | Iterable[str]) -> None: ...
+ def remove_tool(self, name: str) -> None: ...
+ _T = TypeVar("_T", bound=backend_tools.ToolBase)
+ def add_tool(self, name: str, tool: type[_T], *args, **kwargs) -> _T: ...
+ def trigger_tool(
+ self,
+ name: str | backend_tools.ToolBase,
+ sender: Any | None = ...,
+ canvasevent: ToolEvent | None = ...,
+ data: Any | None = ...,
+ ) -> None: ...
+ @property
+ def tools(self) -> dict[str, backend_tools.ToolBase]: ...
+ def get_tool(
+ self, name: str | backend_tools.ToolBase, warn: bool = ...
+ ) -> backend_tools.ToolBase | None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi b/contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi
new file mode 100644
index 0000000000..446f713292
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi
@@ -0,0 +1,121 @@
+import enum
+from matplotlib import cbook
+from matplotlib.axes import Axes
+from matplotlib.backend_bases import ToolContainerBase, FigureCanvasBase
+from matplotlib.backend_managers import ToolManager, ToolEvent
+from matplotlib.figure import Figure
+from matplotlib.scale import ScaleBase
+
+from typing import Any
+
+class Cursors(enum.IntEnum):
+ POINTER: int
+ HAND: int
+ SELECT_REGION: int
+ MOVE: int
+ WAIT: int
+ RESIZE_HORIZONTAL: int
+ RESIZE_VERTICAL: int
+
+cursors = Cursors
+
+class ToolBase:
+ @property
+ def default_keymap(self) -> list[str] | None: ...
+ description: str | None
+ image: str | None
+ def __init__(self, toolmanager: ToolManager, name: str) -> None: ...
+ @property
+ def name(self) -> str: ...
+ @property
+ def toolmanager(self) -> ToolManager: ...
+ @property
+ def canvas(self) -> FigureCanvasBase | None: ...
+ @property
+ def figure(self) -> Figure | None: ...
+ @figure.setter
+ def figure(self, figure: Figure | None) -> None: ...
+ def set_figure(self, figure: Figure | None) -> None: ...
+ def trigger(self, sender: Any, event: ToolEvent, data: Any = ...) -> None: ...
+
+class ToolToggleBase(ToolBase):
+ radio_group: str | None
+ cursor: Cursors | None
+ default_toggled: bool
+ def __init__(self, *args, **kwargs) -> None: ...
+ def enable(self, event: ToolEvent | None = ...) -> None: ...
+ def disable(self, event: ToolEvent | None = ...) -> None: ...
+ @property
+ def toggled(self) -> bool: ...
+ def set_figure(self, figure: Figure | None) -> None: ...
+
+class ToolSetCursor(ToolBase): ...
+
+class ToolCursorPosition(ToolBase):
+ def send_message(self, event: ToolEvent) -> None: ...
+
+class RubberbandBase(ToolBase):
+ def draw_rubberband(self, *data) -> None: ...
+ def remove_rubberband(self) -> None: ...
+
+class ToolQuit(ToolBase): ...
+class ToolQuitAll(ToolBase): ...
+class ToolGrid(ToolBase): ...
+class ToolMinorGrid(ToolBase): ...
+class ToolFullScreen(ToolBase): ...
+
+class AxisScaleBase(ToolToggleBase):
+ def enable(self, event: ToolEvent | None = ...) -> None: ...
+ def disable(self, event: ToolEvent | None = ...) -> None: ...
+
+class ToolYScale(AxisScaleBase):
+ def set_scale(self, ax: Axes, scale: str | ScaleBase) -> None: ...
+
+class ToolXScale(AxisScaleBase):
+ def set_scale(self, ax, scale: str | ScaleBase) -> None: ...
+
+class ToolViewsPositions(ToolBase):
+ views: dict[Figure | Axes, cbook.Stack]
+ positions: dict[Figure | Axes, cbook.Stack]
+ home_views: dict[Figure, dict[Axes, tuple[float, float, float, float]]]
+ def add_figure(self, figure: Figure) -> None: ...
+ def clear(self, figure: Figure) -> None: ...
+ def update_view(self) -> None: ...
+ def push_current(self, figure: Figure | None = ...) -> None: ...
+ def update_home_views(self, figure: Figure | None = ...) -> None: ...
+ def home(self) -> None: ...
+ def back(self) -> None: ...
+ def forward(self) -> None: ...
+
+class ViewsPositionsBase(ToolBase): ...
+class ToolHome(ViewsPositionsBase): ...
+class ToolBack(ViewsPositionsBase): ...
+class ToolForward(ViewsPositionsBase): ...
+class ConfigureSubplotsBase(ToolBase): ...
+class SaveFigureBase(ToolBase): ...
+
+class ZoomPanBase(ToolToggleBase):
+ base_scale: float
+ scrollthresh: float
+ lastscroll: float
+ def __init__(self, *args) -> None: ...
+ def enable(self, event: ToolEvent | None = ...) -> None: ...
+ def disable(self, event: ToolEvent | None = ...) -> None: ...
+ def scroll_zoom(self, event: ToolEvent) -> None: ...
+
+class ToolZoom(ZoomPanBase): ...
+class ToolPan(ZoomPanBase): ...
+
+class ToolHelpBase(ToolBase):
+ @staticmethod
+ def format_shortcut(key_sequence: str) -> str: ...
+
+class ToolCopyToClipboardBase(ToolBase): ...
+
+default_tools: dict[str, ToolBase]
+default_toolbar_tools: list[list[str | list[str]]]
+
+def add_tools_to_manager(
+ toolmanager: ToolManager, tools: dict[str, type[ToolBase]] = ...
+) -> None: ...
+def add_tools_to_container(container: ToolContainerBase, tools: list[Any] = ...) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi b/contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi
diff --git a/contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi b/contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi
diff --git a/contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi b/contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi
diff --git a/contrib/python/matplotlib/py3/matplotlib/bezier.pyi b/contrib/python/matplotlib/py3/matplotlib/bezier.pyi
new file mode 100644
index 0000000000..ad82b873af
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/bezier.pyi
@@ -0,0 +1,74 @@
+from collections.abc import Callable
+from typing import Literal
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+from .path import Path
+
+class NonIntersectingPathException(ValueError): ...
+
+def get_intersection(
+ cx1: float,
+ cy1: float,
+ cos_t1: float,
+ sin_t1: float,
+ cx2: float,
+ cy2: float,
+ cos_t2: float,
+ sin_t2: float,
+) -> tuple[float, float]: ...
+def get_normal_points(
+ cx: float, cy: float, cos_t: float, sin_t: float, length: float
+) -> tuple[float, float, float, float]: ...
+def split_de_casteljau(beta: ArrayLike, t: float) -> tuple[np.ndarray, np.ndarray]: ...
+def find_bezier_t_intersecting_with_closedpath(
+ bezier_point_at_t: Callable[[float], tuple[float, float]],
+ inside_closedpath: Callable[[tuple[float, float]], bool],
+ t0: float = ...,
+ t1: float = ...,
+ tolerance: float = ...,
+) -> tuple[float, float]: ...
+
+# TODO make generic over d, the dimension? ndarraydim
+class BezierSegment:
+ def __init__(self, control_points: ArrayLike) -> None: ...
+ def __call__(self, t: ArrayLike) -> np.ndarray: ...
+ def point_at_t(self, t: float) -> tuple[float, ...]: ...
+ @property
+ def control_points(self) -> np.ndarray: ...
+ @property
+ def dimension(self) -> int: ...
+ @property
+ def degree(self) -> int: ...
+ @property
+ def polynomial_coefficients(self) -> np.ndarray: ...
+ def axis_aligned_extrema(self) -> tuple[np.ndarray, np.ndarray]: ...
+
+def split_bezier_intersecting_with_closedpath(
+ bezier: ArrayLike,
+ inside_closedpath: Callable[[tuple[float, float]], bool],
+ tolerance: float = ...,
+) -> tuple[np.ndarray, np.ndarray]: ...
+def split_path_inout(
+ path: Path,
+ inside: Callable[[tuple[float, float]], bool],
+ tolerance: float = ...,
+ reorder_inout: bool = ...,
+) -> tuple[Path, Path]: ...
+def inside_circle(
+ cx: float, cy: float, r: float
+) -> Callable[[tuple[float, float]], bool]: ...
+def get_cos_sin(x0: float, y0: float, x1: float, y1: float) -> tuple[float, float]: ...
+def check_if_parallel(
+ dx1: float, dy1: float, dx2: float, dy2: float, tolerance: float = ...
+) -> Literal[-1, False, 1]: ...
+def get_parallels(
+ bezier2: ArrayLike, width: float
+) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ...
+def find_control_points(
+ c1x: float, c1y: float, mmx: float, mmy: float, c2x: float, c2y: float
+) -> list[tuple[float, float]]: ...
+def make_wedged_bezier2(
+ bezier2: ArrayLike, width: float, w1: float = ..., wm: float = ..., w2: float = ...
+) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/cbook.pyi b/contrib/python/matplotlib/py3/matplotlib/cbook.pyi
new file mode 100644
index 0000000000..227a23df41
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/cbook.pyi
@@ -0,0 +1,175 @@
+import collections.abc
+from collections.abc import Callable, Collection, Generator, Iterable, Iterator
+import contextlib
+import os
+from pathlib import Path
+
+from matplotlib.artist import Artist
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+from typing import (
+ Any,
+ Generic,
+ IO,
+ Literal,
+ TypeVar,
+ overload,
+)
+
+_T = TypeVar("_T")
+
+def _get_running_interactive_framework() -> str | None: ...
+
+class CallbackRegistry:
+ exception_handler: Callable[[Exception], Any]
+ callbacks: dict[Any, dict[int, Any]]
+ def __init__(
+ self,
+ exception_handler: Callable[[Exception], Any] | None = ...,
+ *,
+ signals: Iterable[Any] | None = ...,
+ ) -> None: ...
+ def connect(self, signal: Any, func: Callable) -> int: ...
+ def disconnect(self, cid: int) -> None: ...
+ def process(self, s: Any, *args, **kwargs) -> None: ...
+ def blocked(
+ self, *, signal: Any | None = ...
+ ) -> contextlib.AbstractContextManager[None]: ...
+
+class silent_list(list[_T]):
+ type: str | None
+ def __init__(self, type: str | None, seq: Iterable[_T] | None = ...) -> None: ...
+
+def strip_math(s: str) -> str: ...
+def is_writable_file_like(obj: Any) -> bool: ...
+def file_requires_unicode(x: Any) -> bool: ...
+@overload
+def to_filehandle(
+ fname: str | os.PathLike | IO,
+ flag: str = ...,
+ return_opened: Literal[False] = ...,
+ encoding: str | None = ...,
+) -> IO: ...
+@overload
+def to_filehandle(
+ fname: str | os.PathLike | IO,
+ flag: str,
+ return_opened: Literal[True],
+ encoding: str | None = ...,
+) -> tuple[IO, bool]: ...
+@overload
+def to_filehandle(
+ fname: str | os.PathLike | IO,
+ *, # if flag given, will match previous sig
+ return_opened: Literal[True],
+ encoding: str | None = ...,
+) -> tuple[IO, bool]: ...
+def open_file_cm(
+ path_or_file: str | os.PathLike | IO,
+ mode: str = ...,
+ encoding: str | None = ...,
+) -> contextlib.AbstractContextManager[IO]: ...
+def is_scalar_or_string(val: Any) -> bool: ...
+@overload
+def get_sample_data(
+ fname: str | os.PathLike, asfileobj: Literal[True] = ..., *, np_load: Literal[True]
+) -> np.ndarray: ...
+@overload
+def get_sample_data(
+ fname: str | os.PathLike,
+ asfileobj: Literal[True] = ...,
+ *,
+ np_load: Literal[False] = ...,
+) -> IO: ...
+@overload
+def get_sample_data(
+ fname: str | os.PathLike, asfileobj: Literal[False], *, np_load: bool = ...
+) -> str: ...
+def _get_data_path(*args: Path | str) -> Path: ...
+def flatten(
+ seq: Iterable[Any], scalarp: Callable[[Any], bool] = ...
+) -> Generator[Any, None, None]: ...
+
+class Stack(Generic[_T]):
+ def __init__(self, default: _T | None = ...) -> None: ...
+ def __call__(self) -> _T: ...
+ def __len__(self) -> int: ...
+ def __getitem__(self, ind: int) -> _T: ...
+ def forward(self) -> _T: ...
+ def back(self) -> _T: ...
+ def push(self, o: _T) -> _T: ...
+ def home(self) -> _T: ...
+ def empty(self) -> bool: ...
+ def clear(self) -> None: ...
+ def bubble(self, o: _T) -> _T: ...
+ def remove(self, o: _T) -> None: ...
+
+def safe_masked_invalid(x: ArrayLike, copy: bool = ...) -> np.ndarray: ...
+def print_cycles(
+ objects: Iterable[Any], outstream: IO = ..., show_progress: bool = ...
+) -> None: ...
+
+class Grouper(Generic[_T]):
+ def __init__(self, init: Iterable[_T] = ...) -> None: ...
+ def __contains__(self, item: _T) -> bool: ...
+ def clean(self) -> None: ...
+ def join(self, a: _T, *args: _T) -> None: ...
+ def joined(self, a: _T, b: _T) -> bool: ...
+ def remove(self, a: _T) -> None: ...
+ def __iter__(self) -> Iterator[list[_T]]: ...
+ def get_siblings(self, a: _T) -> list[_T]: ...
+
+class GrouperView(Generic[_T]):
+ def __init__(self, grouper: Grouper[_T]) -> None: ...
+ def __contains__(self, item: _T) -> bool: ...
+ def __iter__(self) -> Iterator[list[_T]]: ...
+ def joined(self, a: _T, b: _T) -> bool: ...
+ def get_siblings(self, a: _T) -> list[_T]: ...
+
+def simple_linear_interpolation(a: ArrayLike, steps: int) -> np.ndarray: ...
+def delete_masked_points(*args): ...
+def boxplot_stats(
+ X: ArrayLike,
+ whis: float | tuple[float, float] = ...,
+ bootstrap: int | None = ...,
+ labels: ArrayLike | None = ...,
+ autorange: bool = ...,
+) -> list[dict[str, Any]]: ...
+
+ls_mapper: dict[str, str]
+ls_mapper_r: dict[str, str]
+
+def contiguous_regions(mask: ArrayLike) -> list[np.ndarray]: ...
+def is_math_text(s: str) -> bool: ...
+def violin_stats(
+ X: ArrayLike, method: Callable, points: int = ..., quantiles: ArrayLike | None = ...
+) -> list[dict[str, Any]]: ...
+def pts_to_prestep(x: ArrayLike, *args: ArrayLike) -> np.ndarray: ...
+def pts_to_poststep(x: ArrayLike, *args: ArrayLike) -> np.ndarray: ...
+def pts_to_midstep(x: np.ndarray, *args: np.ndarray) -> np.ndarray: ...
+
+STEP_LOOKUP_MAP: dict[str, Callable]
+
+def index_of(y: float | ArrayLike) -> tuple[np.ndarray, np.ndarray]: ...
+def safe_first_element(obj: Collection[_T]) -> _T: ...
+def sanitize_sequence(data): ...
+def normalize_kwargs(
+ kw: dict[str, Any],
+ alias_mapping: dict[str, list[str]] | type[Artist] | Artist | None = ...,
+) -> dict[str, Any]: ...
+def _lock_path(path: str | os.PathLike) -> contextlib.AbstractContextManager[None]: ...
+def _str_equal(obj: Any, s: str) -> bool: ...
+def _setattr_cm(obj: Any, **kwargs) -> contextlib.AbstractContextManager[None]: ...
+
+class _OrderedSet(collections.abc.MutableSet):
+ def __init__(self) -> None: ...
+ def __contains__(self, key) -> bool: ...
+ def __iter__(self): ...
+ def __len__(self) -> int: ...
+ def add(self, key) -> None: ...
+ def discard(self, key) -> None: ...
+
+def _backend_module_name(name: str) -> str: ...
+def _format_approx(number: float, precision: int) -> str: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/cm.pyi b/contrib/python/matplotlib/py3/matplotlib/cm.pyi
new file mode 100644
index 0000000000..be8f10b39c
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/cm.pyi
@@ -0,0 +1,54 @@
+from collections.abc import Iterator, Mapping
+from matplotlib import cbook, colors
+from matplotlib.colorbar import Colorbar
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+class ColormapRegistry(Mapping[str, colors.Colormap]):
+ def __init__(self, cmaps: Mapping[str, colors.Colormap]) -> None: ...
+ def __getitem__(self, item: str) -> colors.Colormap: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def __len__(self) -> int: ...
+ def __call__(self) -> list[str]: ...
+ def register(
+ self, cmap: colors.Colormap, *, name: str | None = ..., force: bool = ...
+ ) -> None: ...
+ def unregister(self, name: str) -> None: ...
+ def get_cmap(self, cmap: str | colors.Colormap) -> colors.Colormap: ...
+
+_colormaps: ColormapRegistry = ...
+
+def get_cmap(name: str | colors.Colormap | None = ..., lut: int | None = ...) -> colors.Colormap: ...
+
+class ScalarMappable:
+ cmap: colors.Colormap | None
+ colorbar: Colorbar | None
+ callbacks: cbook.CallbackRegistry
+ def __init__(
+ self,
+ norm: colors.Normalize | None = ...,
+ cmap: str | colors.Colormap | None = ...,
+ ) -> None: ...
+ def to_rgba(
+ self,
+ x: np.ndarray,
+ alpha: float | ArrayLike | None = ...,
+ bytes: bool = ...,
+ norm: bool = ...,
+ ) -> np.ndarray: ...
+ def set_array(self, A: ArrayLike | None) -> None: ...
+ def get_array(self) -> np.ndarray | None: ...
+ def get_cmap(self) -> colors.Colormap: ...
+ def get_clim(self) -> tuple[float, float]: ...
+ def set_clim(self, vmin: float | tuple[float, float] | None = ..., vmax: float | None = ...) -> None: ...
+ def get_alpha(self) -> float | None: ...
+ def set_cmap(self, cmap: str | colors.Colormap) -> None: ...
+ @property
+ def norm(self) -> colors.Normalize: ...
+ @norm.setter
+ def norm(self, norm: colors.Normalize | str | None) -> None: ...
+ def set_norm(self, norm: colors.Normalize | str | None) -> None: ...
+ def autoscale(self) -> None: ...
+ def autoscale_None(self) -> None: ...
+ def changed(self) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/collections.pyi b/contrib/python/matplotlib/py3/matplotlib/collections.pyi
new file mode 100644
index 0000000000..01682a55b3
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/collections.pyi
@@ -0,0 +1,242 @@
+from collections.abc import Callable, Iterable, Sequence
+from typing import Literal
+
+import numpy as np
+from numpy.typing import ArrayLike, NDArray
+
+from . import artist, cm, transforms
+from .backend_bases import MouseEvent
+from .artist import Artist
+from .colors import Normalize, Colormap
+from .lines import Line2D
+from .path import Path
+from .patches import Patch
+from .ticker import Locator, Formatter
+from .tri import Triangulation
+from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType
+
+class Collection(artist.Artist, cm.ScalarMappable):
+ def __init__(
+ self,
+ *,
+ edgecolors: ColorType | Sequence[ColorType] | None = ...,
+ facecolors: ColorType | Sequence[ColorType] | None = ...,
+ linewidths: float | Sequence[float] | None = ...,
+ linestyles: LineStyleType | Sequence[LineStyleType] = ...,
+ capstyle: CapStyleType | None = ...,
+ joinstyle: JoinStyleType | None = ...,
+ antialiaseds: bool | Sequence[bool] | None = ...,
+ offsets: tuple[float, float] | Sequence[tuple[float, float]] | None = ...,
+ offset_transform: transforms.Transform | None = ...,
+ norm: Normalize | None = ...,
+ cmap: Colormap | None = ...,
+ pickradius: float = ...,
+ hatch: str | None = ...,
+ urls: Sequence[str] | None = ...,
+ zorder: float = ...,
+ **kwargs
+ ) -> None: ...
+ def get_paths(self) -> Sequence[Path]: ...
+ def set_paths(self, paths: Sequence[Path]) -> None: ...
+ def get_transforms(self) -> Sequence[transforms.Transform]: ...
+ def get_offset_transform(self) -> transforms.Transform: ...
+ def set_offset_transform(self, offset_transform: transforms.Transform) -> None: ...
+ def get_datalim(self, transData: transforms.Transform) -> transforms.Bbox: ...
+ def set_pickradius(self, pickradius: float) -> None: ...
+ def get_pickradius(self) -> float: ...
+ def set_urls(self, urls: Sequence[str | None]) -> None: ...
+ def get_urls(self) -> Sequence[str | None]: ...
+ def set_hatch(self, hatch: str) -> None: ...
+ def get_hatch(self) -> str: ...
+ def set_offsets(self, offsets: ArrayLike) -> None: ...
+ def get_offsets(self) -> ArrayLike: ...
+ def set_linewidth(self, lw: float | Sequence[float]) -> None: ...
+ def set_linestyle(self, ls: LineStyleType | Sequence[LineStyleType]) -> None: ...
+ def set_capstyle(self, cs: CapStyleType) -> None: ...
+ def get_capstyle(self) -> Literal["butt", "projecting", "round"] | None: ...
+ def set_joinstyle(self, js: JoinStyleType) -> None: ...
+ def get_joinstyle(self) -> Literal["miter", "round", "bevel"] | None: ...
+ def set_antialiased(self, aa: bool | Sequence[bool]) -> None: ...
+ def get_antialiased(self) -> NDArray[np.bool_]: ...
+ def set_color(self, c: ColorType | Sequence[ColorType]) -> None: ...
+ def set_facecolor(self, c: ColorType | Sequence[ColorType]) -> None: ...
+ def get_facecolor(self) -> ColorType | Sequence[ColorType]: ...
+ def get_edgecolor(self) -> ColorType | Sequence[ColorType]: ...
+ def set_edgecolor(self, c: ColorType | Sequence[ColorType]) -> None: ...
+ def set_alpha(self, alpha: float | Sequence[float] | None) -> None: ...
+ def get_linewidth(self) -> float | Sequence[float]: ...
+ def get_linestyle(self) -> LineStyleType | Sequence[LineStyleType]: ...
+ def update_scalarmappable(self) -> None: ...
+ def get_fill(self) -> bool: ...
+ def update_from(self, other: Artist) -> None: ...
+
+class _CollectionWithSizes(Collection):
+ def get_sizes(self) -> np.ndarray: ...
+ def set_sizes(self, sizes: ArrayLike | None, dpi: float = ...) -> None: ...
+
+class PathCollection(_CollectionWithSizes):
+ def __init__(
+ self, paths: Sequence[Path], sizes: ArrayLike | None = ..., **kwargs
+ ) -> None: ...
+ def set_paths(self, paths: Sequence[Path]) -> None: ...
+ def get_paths(self) -> Sequence[Path]: ...
+ def legend_elements(
+ self,
+ prop: Literal["colors", "sizes"] = ...,
+ num: int | Literal["auto"] | ArrayLike | Locator = ...,
+ fmt: str | Formatter | None = ...,
+ func: Callable[[ArrayLike], ArrayLike] = ...,
+ **kwargs,
+ ) -> tuple[list[Line2D], list[str]]: ...
+
+class PolyCollection(_CollectionWithSizes):
+ def __init__(
+ self,
+ verts: Sequence[ArrayLike],
+ sizes: ArrayLike | None = ...,
+ *,
+ closed: bool = ...,
+ **kwargs
+ ) -> None: ...
+ def set_verts(
+ self, verts: Sequence[ArrayLike | Path], closed: bool = ...
+ ) -> None: ...
+ def set_paths(self, verts: Sequence[Path], closed: bool = ...) -> None: ...
+ def set_verts_and_codes(
+ self, verts: Sequence[ArrayLike | Path], codes: Sequence[int]
+ ) -> None: ...
+
+class BrokenBarHCollection(PolyCollection):
+ def __init__(
+ self,
+ xranges: Iterable[tuple[float, float]],
+ yrange: tuple[float, float],
+ **kwargs
+ ) -> None: ...
+ @classmethod
+ def span_where(
+ cls, x: ArrayLike, ymin: float, ymax: float, where: ArrayLike, **kwargs
+ ) -> BrokenBarHCollection: ...
+
+class RegularPolyCollection(_CollectionWithSizes):
+ def __init__(
+ self, numsides: int, *, rotation: float = ..., sizes: ArrayLike = ..., **kwargs
+ ) -> None: ...
+ def get_numsides(self) -> int: ...
+ def get_rotation(self) -> float: ...
+
+class StarPolygonCollection(RegularPolyCollection): ...
+class AsteriskPolygonCollection(RegularPolyCollection): ...
+
+class LineCollection(Collection):
+ def __init__(
+ self, segments: Sequence[ArrayLike], *, zorder: float = ..., **kwargs
+ ) -> None: ...
+ def set_segments(self, segments: Sequence[ArrayLike] | None) -> None: ...
+ def set_verts(self, segments: Sequence[ArrayLike] | None) -> None: ...
+ def set_paths(self, segments: Sequence[ArrayLike] | None) -> None: ... # type: ignore[override]
+ def get_segments(self) -> list[np.ndarray]: ...
+ def set_color(self, c: ColorType | Sequence[ColorType]) -> None: ...
+ def set_colors(self, c: ColorType | Sequence[ColorType]) -> None: ...
+ def set_gapcolor(self, gapcolor: ColorType | Sequence[ColorType] | None) -> None: ...
+ def get_color(self) -> ColorType | Sequence[ColorType]: ...
+ def get_colors(self) -> ColorType | Sequence[ColorType]: ...
+ def get_gapcolor(self) -> ColorType | Sequence[ColorType] | None: ...
+
+
+class EventCollection(LineCollection):
+ def __init__(
+ self,
+ positions: ArrayLike,
+ orientation: Literal["horizontal", "vertical"] = ...,
+ *,
+ lineoffset: float = ...,
+ linelength: float = ...,
+ linewidth: float | Sequence[float] | None = ...,
+ color: ColorType | Sequence[ColorType] | None = ...,
+ linestyle: LineStyleType | Sequence[LineStyleType] = ...,
+ antialiased: bool | Sequence[bool] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_positions(self) -> list[float]: ...
+ def set_positions(self, positions: Sequence[float] | None) -> None: ...
+ def add_positions(self, position: Sequence[float] | None) -> None: ...
+ def extend_positions(self, position: Sequence[float] | None) -> None: ...
+ def append_positions(self, position: Sequence[float] | None) -> None: ...
+ def is_horizontal(self) -> bool: ...
+ def get_orientation(self) -> Literal["horizontal", "vertical"]: ...
+ def switch_orientation(self) -> None: ...
+ def set_orientation(
+ self, orientation: Literal["horizontal", "vertical"]
+ ) -> None: ...
+ def get_linelength(self) -> float | Sequence[float]: ...
+ def set_linelength(self, linelength: float | Sequence[float]) -> None: ...
+ def get_lineoffset(self) -> float: ...
+ def set_lineoffset(self, lineoffset: float) -> None: ...
+ def get_linewidth(self) -> float: ...
+ def get_linewidths(self) -> Sequence[float]: ...
+ def get_color(self) -> ColorType: ...
+
+class CircleCollection(_CollectionWithSizes):
+ def __init__(self, sizes: float | ArrayLike, **kwargs) -> None: ...
+
+class EllipseCollection(Collection):
+ def __init__(
+ self,
+ widths: ArrayLike,
+ heights: ArrayLike,
+ angles: ArrayLike,
+ *,
+ units: Literal[
+ "points", "inches", "dots", "width", "height", "x", "y", "xy"
+ ] = ...,
+ **kwargs
+ ) -> None: ...
+
+class PatchCollection(Collection):
+ def __init__(
+ self, patches: Iterable[Patch], *, match_original: bool = ..., **kwargs
+ ) -> None: ...
+ def set_paths(self, patches: Iterable[Patch]) -> None: ... # type: ignore[override]
+
+class TriMesh(Collection):
+ def __init__(self, triangulation: Triangulation, **kwargs) -> None: ...
+ def get_paths(self) -> list[Path]: ...
+ # Parent class has an argument, perhaps add a noop arg?
+ def set_paths(self) -> None: ... # type: ignore[override]
+ @staticmethod
+ def convert_mesh_to_paths(tri: Triangulation) -> list[Path]: ...
+
+class _MeshData:
+ def __init__(
+ self,
+ coordinates: ArrayLike,
+ *,
+ shading: Literal["flat", "gouraud"] = ...,
+ ) -> None: ...
+ def set_array(self, A: ArrayLike | None) -> None: ...
+ def get_coordinates(self) -> ArrayLike: ...
+ def get_facecolor(self) -> ColorType | Sequence[ColorType]: ...
+ def get_edgecolor(self) -> ColorType | Sequence[ColorType]: ...
+
+class QuadMesh(_MeshData, Collection):
+ def __init__(
+ self,
+ coordinates: ArrayLike,
+ *,
+ antialiased: bool = ...,
+ shading: Literal["flat", "gouraud"] = ...,
+ **kwargs
+ ) -> None: ...
+ def get_paths(self) -> list[Path]: ...
+ # Parent class has an argument, perhaps add a noop arg?
+ def set_paths(self) -> None: ... # type: ignore[override]
+ def get_datalim(self, transData: transforms.Transform) -> transforms.Bbox: ...
+ def get_cursor_data(self, event: MouseEvent) -> float: ...
+
+class PolyQuadMesh(_MeshData, PolyCollection):
+ def __init__(
+ self,
+ coordinates: ArrayLike,
+ **kwargs
+ ) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/colorbar.pyi b/contrib/python/matplotlib/py3/matplotlib/colorbar.pyi
new file mode 100644
index 0000000000..f71c5759fc
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/colorbar.pyi
@@ -0,0 +1,136 @@
+import matplotlib.spines as mspines
+from matplotlib import cm, collections, colors, contour
+from matplotlib.axes import Axes
+from matplotlib.backend_bases import RendererBase
+from matplotlib.patches import Patch
+from matplotlib.ticker import Locator, Formatter
+from matplotlib.transforms import Bbox
+
+import numpy as np
+from numpy.typing import ArrayLike
+from collections.abc import Sequence
+from typing import Any, Literal, overload
+from .typing import ColorType
+
+class _ColorbarSpine(mspines.Spines):
+ def __init__(self, axes: Axes): ...
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox:...
+ def set_xy(self, xy: ArrayLike) -> None: ...
+ def draw(self, renderer: RendererBase | None) -> None:...
+
+
+class Colorbar:
+ n_rasterize: int
+ mappable: cm.ScalarMappable
+ ax: Axes
+ alpha: float | None
+ cmap: colors.Colormap
+ norm: colors.Normalize
+ values: Sequence[float] | None
+ boundaries: Sequence[float] | None
+ extend: Literal["neither", "both", "min", "max"]
+ spacing: Literal["uniform", "proportional"]
+ orientation: Literal["vertical", "horizontal"]
+ drawedges: bool
+ extendfrac: Literal["auto"] | float | Sequence[float] | None
+ extendrect: bool
+ solids: None | collections.QuadMesh
+ solids_patches: list[Patch]
+ lines: list[collections.LineCollection]
+ outline: _ColorbarSpine
+ dividers: collections.LineCollection
+ ticklocation: Literal["left", "right", "top", "bottom"]
+ def __init__(
+ self,
+ ax: Axes,
+ mappable: cm.ScalarMappable | None = ...,
+ *,
+ cmap: str | colors.Colormap | None = ...,
+ norm: colors.Normalize | None = ...,
+ alpha: float | None = ...,
+ values: Sequence[float] | None = ...,
+ boundaries: Sequence[float] | None = ...,
+ orientation: Literal["vertical", "horizontal"] | None = ...,
+ ticklocation: Literal["auto", "left", "right", "top", "bottom"] = ...,
+ extend: Literal["neither", "both", "min", "max"] | None = ...,
+ spacing: Literal["uniform", "proportional"] = ...,
+ ticks: Sequence[float] | Locator | None = ...,
+ format: str | Formatter | None = ...,
+ drawedges: bool = ...,
+ extendfrac: Literal["auto"] | float | Sequence[float] | None = ...,
+ extendrect: bool = ...,
+ label: str = ...,
+ location: Literal["left", "right", "top", "bottom"] | None = ...
+ ) -> None: ...
+ @property
+ def locator(self) -> Locator: ...
+ @locator.setter
+ def locator(self, loc: Locator) -> None: ...
+ @property
+ def minorlocator(self) -> Locator: ...
+ @minorlocator.setter
+ def minorlocator(self, loc: Locator) -> None: ...
+ @property
+ def formatter(self) -> Formatter: ...
+ @formatter.setter
+ def formatter(self, fmt: Formatter) -> None: ...
+ @property
+ def minorformatter(self) -> Formatter: ...
+ @minorformatter.setter
+ def minorformatter(self, fmt: Formatter) -> None: ...
+ def update_normal(self, mappable: cm.ScalarMappable) -> None: ...
+ @overload
+ def add_lines(self, CS: contour.ContourSet, erase: bool = ...) -> None: ...
+ @overload
+ def add_lines(
+ self,
+ levels: ArrayLike,
+ colors: ColorType | Sequence[ColorType],
+ linewidths: float | ArrayLike,
+ erase: bool = ...,
+ ) -> None: ...
+ def update_ticks(self) -> None: ...
+ def set_ticks(
+ self,
+ ticks: Sequence[float] | Locator,
+ *,
+ labels: Sequence[str] | None = ...,
+ minor: bool = ...,
+ **kwargs
+ ) -> None: ...
+ def get_ticks(self, minor: bool = ...) -> np.ndarray: ...
+ def set_ticklabels(
+ self,
+ ticklabels: Sequence[str],
+ *,
+ minor: bool = ...,
+ **kwargs
+ ) -> None: ...
+ def minorticks_on(self) -> None: ...
+ def minorticks_off(self) -> None: ...
+ def set_label(self, label: str, *, loc: str | None = ..., **kwargs) -> None: ...
+ def set_alpha(self, alpha: float | np.ndarray) -> None: ...
+ def remove(self) -> None: ...
+ def drag_pan(self, button: Any, key: Any, x: float, y: float) -> None: ...
+
+ColorbarBase = Colorbar
+
+def make_axes(
+ parents: Axes | list[Axes] | np.ndarray,
+ location: Literal["left", "right", "top", "bottom"] | None = ...,
+ orientation: Literal["vertical", "horizontal"] | None = ...,
+ fraction: float = ...,
+ shrink: float = ...,
+ aspect: float = ...,
+ **kwargs
+) -> tuple[Axes, dict[str, Any]]: ...
+def make_axes_gridspec(
+ parent: Axes,
+ *,
+ location: Literal["left", "right", "top", "bottom"] | None = ...,
+ orientation: Literal["vertical", "horizontal"] | None = ...,
+ fraction: float = ...,
+ shrink: float = ...,
+ aspect: float = ...,
+ **kwargs
+) -> tuple[Axes, dict[str, Any]]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/colors.pyi b/contrib/python/matplotlib/py3/matplotlib/colors.pyi
new file mode 100644
index 0000000000..9bb1725f4f
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/colors.pyi
@@ -0,0 +1,354 @@
+from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
+from matplotlib import cbook, scale
+import re
+
+from typing import Any, Literal, overload
+from .typing import ColorType
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+# Explicitly export colors dictionaries which are imported in the impl
+BASE_COLORS: dict[str, ColorType]
+CSS4_COLORS: dict[str, ColorType]
+TABLEAU_COLORS: dict[str, ColorType]
+XKCD_COLORS: dict[str, ColorType]
+
+class _ColorMapping(dict[str, ColorType]):
+ cache: dict[tuple[ColorType, float | None], tuple[float, float, float, float]]
+ def __init__(self, mapping) -> None: ...
+ def __setitem__(self, key, value) -> None: ...
+ def __delitem__(self, key) -> None: ...
+
+def get_named_colors_mapping() -> _ColorMapping: ...
+
+class ColorSequenceRegistry(Mapping):
+ def __init__(self) -> None: ...
+ def __getitem__(self, item: str) -> list[ColorType]: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def __len__(self) -> int: ...
+ def register(self, name: str, color_list: Iterable[ColorType]) -> None: ...
+ def unregister(self, name: str) -> None: ...
+
+_color_sequences: ColorSequenceRegistry = ...
+
+def is_color_like(c: Any) -> bool: ...
+def same_color(c1: ColorType, c2: ColorType) -> bool: ...
+def to_rgba(
+ c: ColorType, alpha: float | None = ...
+) -> tuple[float, float, float, float]: ...
+def to_rgba_array(
+ c: ColorType | ArrayLike, alpha: float | ArrayLike | None = ...
+) -> np.ndarray: ...
+def to_rgb(c: ColorType) -> tuple[float, float, float]: ...
+def to_hex(c: ColorType, keep_alpha: bool = ...) -> str: ...
+
+cnames: dict[str, ColorType]
+hexColorPattern: re.Pattern
+rgb2hex = to_hex
+hex2color = to_rgb
+
+class ColorConverter:
+ colors: _ColorMapping
+ cache: dict[tuple[ColorType, float | None], tuple[float, float, float, float]]
+ @staticmethod
+ def to_rgb(c: ColorType) -> tuple[float, float, float]: ...
+ @staticmethod
+ def to_rgba(
+ c: ColorType, alpha: float | None = ...
+ ) -> tuple[float, float, float, float]: ...
+ @staticmethod
+ def to_rgba_array(
+ c: ColorType | ArrayLike, alpha: float | ArrayLike | None = ...
+ ) -> np.ndarray: ...
+
+colorConverter: ColorConverter
+
+class Colormap:
+ name: str
+ N: int
+ colorbar_extend: bool
+ def __init__(self, name: str, N: int = ...) -> None: ...
+ @overload
+ def __call__(
+ self, X: Sequence[float] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ...
+ ) -> np.ndarray: ...
+ @overload
+ def __call__(
+ self, X: float, alpha: float | None = ..., bytes: bool = ...
+ ) -> tuple[float, float, float, float]: ...
+ @overload
+ def __call__(
+ self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ...
+ ) -> tuple[float, float, float, float] | np.ndarray: ...
+ def __copy__(self) -> Colormap: ...
+ def __eq__(self, other: object) -> bool: ...
+ def get_bad(self) -> np.ndarray: ...
+ def set_bad(self, color: ColorType = ..., alpha: float | None = ...) -> None: ...
+ def get_under(self) -> np.ndarray: ...
+ def set_under(self, color: ColorType = ..., alpha: float | None = ...) -> None: ...
+ def get_over(self) -> np.ndarray: ...
+ def set_over(self, color: ColorType = ..., alpha: float | None = ...) -> None: ...
+ def set_extremes(
+ self,
+ *,
+ bad: ColorType | None = ...,
+ under: ColorType | None = ...,
+ over: ColorType | None = ...
+ ) -> None: ...
+ def with_extremes(
+ self,
+ *,
+ bad: ColorType | None = ...,
+ under: ColorType | None = ...,
+ over: ColorType | None = ...
+ ) -> Colormap: ...
+ def is_gray(self) -> bool: ...
+ def resampled(self, lutsize: int) -> Colormap: ...
+ def reversed(self, name: str | None = ...) -> Colormap: ...
+ def _repr_html_(self) -> str: ...
+ def _repr_png_(self) -> bytes: ...
+ def copy(self) -> Colormap: ...
+
+class LinearSegmentedColormap(Colormap):
+ monochrome: bool
+ def __init__(
+ self,
+ name: str,
+ segmentdata: dict[
+ Literal["red", "green", "blue", "alpha"], Sequence[tuple[float, ...]]
+ ],
+ N: int = ...,
+ gamma: float = ...,
+ ) -> None: ...
+ def set_gamma(self, gamma: float) -> None: ...
+ @staticmethod
+ def from_list(
+ name: str, colors: ArrayLike, N: int = ..., gamma: float = ...
+ ) -> LinearSegmentedColormap: ...
+ def resampled(self, lutsize: int) -> LinearSegmentedColormap: ...
+ def reversed(self, name: str | None = ...) -> LinearSegmentedColormap: ...
+
+class ListedColormap(Colormap):
+ monochrome: bool
+ colors: ArrayLike | ColorType
+ def __init__(
+ self, colors: ArrayLike | ColorType, name: str = ..., N: int | None = ...
+ ) -> None: ...
+ def resampled(self, lutsize: int) -> ListedColormap: ...
+ def reversed(self, name: str | None = ...) -> ListedColormap: ...
+
+class Normalize:
+ callbacks: cbook.CallbackRegistry
+ def __init__(
+ self, vmin: float | None = ..., vmax: float | None = ..., clip: bool = ...
+ ) -> None: ...
+ @property
+ def vmin(self) -> float | None: ...
+ @vmin.setter
+ def vmin(self, value: float | None) -> None: ...
+ @property
+ def vmax(self) -> float | None: ...
+ @vmax.setter
+ def vmax(self, value: float | None) -> None: ...
+ @property
+ def clip(self) -> bool: ...
+ @clip.setter
+ def clip(self, value: bool) -> None: ...
+ @staticmethod
+ def process_value(value: ArrayLike) -> tuple[np.ma.MaskedArray, bool]: ...
+ @overload
+ def __call__(self, value: float, clip: bool | None = ...) -> float: ...
+ @overload
+ def __call__(self, value: np.ndarray, clip: bool | None = ...) -> np.ma.MaskedArray: ...
+ @overload
+ def __call__(self, value: ArrayLike, clip: bool | None = ...) -> ArrayLike: ...
+ @overload
+ def inverse(self, value: float) -> float: ...
+ @overload
+ def inverse(self, value: np.ndarray) -> np.ma.MaskedArray: ...
+ @overload
+ def inverse(self, value: ArrayLike) -> ArrayLike: ...
+ def autoscale(self, A: ArrayLike) -> None: ...
+ def autoscale_None(self, A: ArrayLike) -> None: ...
+ def scaled(self) -> bool: ...
+
+class TwoSlopeNorm(Normalize):
+ def __init__(
+ self, vcenter: float, vmin: float | None = ..., vmax: float | None = ...
+ ) -> None: ...
+ @property
+ def vcenter(self) -> float: ...
+ @vcenter.setter
+ def vcenter(self, value: float) -> None: ...
+ def autoscale_None(self, A: ArrayLike) -> None: ...
+
+class CenteredNorm(Normalize):
+ def __init__(
+ self, vcenter: float = ..., halfrange: float | None = ..., clip: bool = ...
+ ) -> None: ...
+ @property
+ def vcenter(self) -> float: ...
+ @vcenter.setter
+ def vcenter(self, vcenter: float) -> None: ...
+ @property
+ def halfrange(self) -> float: ...
+ @halfrange.setter
+ def halfrange(self, halfrange: float) -> None: ...
+
+@overload
+def make_norm_from_scale(
+ scale_cls: type[scale.ScaleBase],
+ base_norm_cls: type[Normalize],
+ *,
+ init: Callable | None = ...
+) -> type[Normalize]: ...
+@overload
+def make_norm_from_scale(
+ scale_cls: type[scale.ScaleBase],
+ base_norm_cls: None = ...,
+ *,
+ init: Callable | None = ...
+) -> Callable[[type[Normalize]], type[Normalize]]: ...
+
+class FuncNorm(Normalize):
+ def __init__(
+ self,
+ functions: tuple[Callable, Callable],
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ clip: bool = ...,
+ ) -> None: ...
+class LogNorm(Normalize): ...
+
+class SymLogNorm(Normalize):
+ def __init__(
+ self,
+ linthresh: float,
+ linscale: float = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ clip: bool = ...,
+ *,
+ base: float = ...,
+ ) -> None: ...
+ @property
+ def linthresh(self) -> float: ...
+ @linthresh.setter
+ def linthresh(self, value: float) -> None: ...
+
+class AsinhNorm(Normalize):
+ def __init__(
+ self,
+ linear_width: float = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ clip: bool = ...,
+ ) -> None: ...
+ @property
+ def linear_width(self) -> float: ...
+ @linear_width.setter
+ def linear_width(self, value: float) -> None: ...
+
+class PowerNorm(Normalize):
+ gamma: float
+ def __init__(
+ self,
+ gamma: float,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ clip: bool = ...,
+ ) -> None: ...
+
+class BoundaryNorm(Normalize):
+ boundaries: np.ndarray
+ N: int
+ Ncmap: int
+ extend: Literal["neither", "both", "min", "max"]
+ def __init__(
+ self,
+ boundaries: ArrayLike,
+ ncolors: int,
+ clip: bool = ...,
+ *,
+ extend: Literal["neither", "both", "min", "max"] = ...
+ ) -> None: ...
+
+class NoNorm(Normalize): ...
+
+def rgb_to_hsv(arr: ArrayLike) -> np.ndarray: ...
+def hsv_to_rgb(hsv: ArrayLike) -> np.ndarray: ...
+
+class LightSource:
+ azdeg: float
+ altdeg: float
+ hsv_min_val: float
+ hsv_max_val: float
+ hsv_min_sat: float
+ hsv_max_sat: float
+ def __init__(
+ self,
+ azdeg: float = ...,
+ altdeg: float = ...,
+ hsv_min_val: float = ...,
+ hsv_max_val: float = ...,
+ hsv_min_sat: float = ...,
+ hsv_max_sat: float = ...,
+ ) -> None: ...
+ @property
+ def direction(self) -> np.ndarray: ...
+ def hillshade(
+ self,
+ elevation: ArrayLike,
+ vert_exag: float = ...,
+ dx: float = ...,
+ dy: float = ...,
+ fraction: float = ...,
+ ) -> np.ndarray: ...
+ def shade_normals(
+ self, normals: np.ndarray, fraction: float = ...
+ ) -> np.ndarray: ...
+ def shade(
+ self,
+ data: ArrayLike,
+ cmap: Colormap,
+ norm: Normalize | None = ...,
+ blend_mode: Literal["hsv", "overlay", "soft"] | Callable = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ vert_exag: float = ...,
+ dx: float = ...,
+ dy: float = ...,
+ fraction: float = ...,
+ **kwargs
+ ) -> np.ndarray: ...
+ def shade_rgb(
+ self,
+ rgb: ArrayLike,
+ elevation: ArrayLike,
+ fraction: float = ...,
+ blend_mode: Literal["hsv", "overlay", "soft"] | Callable = ...,
+ vert_exag: float = ...,
+ dx: float = ...,
+ dy: float = ...,
+ **kwargs
+ ) -> np.ndarray: ...
+ def blend_hsv(
+ self,
+ rgb: ArrayLike,
+ intensity: ArrayLike,
+ hsv_max_sat: float | None = ...,
+ hsv_max_val: float | None = ...,
+ hsv_min_val: float | None = ...,
+ hsv_min_sat: float | None = ...,
+ ) -> ArrayLike: ...
+ def blend_soft_light(
+ self, rgb: np.ndarray, intensity: np.ndarray
+ ) -> np.ndarray: ...
+ def blend_overlay(self, rgb: np.ndarray, intensity: np.ndarray) -> np.ndarray: ...
+
+def from_levels_and_colors(
+ levels: Sequence[float],
+ colors: Sequence[ColorType],
+ extend: Literal["neither", "min", "max", "both"] = ...,
+) -> tuple[ListedColormap, BoundaryNorm]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/container.pyi b/contrib/python/matplotlib/py3/matplotlib/container.pyi
new file mode 100644
index 0000000000..9cc2e1ac2a
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/container.pyi
@@ -0,0 +1,56 @@
+from matplotlib.artist import Artist
+from matplotlib.lines import Line2D
+from matplotlib.collections import LineCollection
+from matplotlib.patches import Rectangle
+
+from collections.abc import Callable
+from typing import Any, Literal
+from numpy.typing import ArrayLike
+
+class Container(tuple):
+ def __new__(cls, *args, **kwargs): ...
+ def __init__(self, kl, label: Any | None = ...) -> None: ...
+ def remove(self) -> None: ...
+ def get_children(self) -> list[Artist]: ...
+ def get_label(self) -> str | None: ...
+ def set_label(self, s: Any) -> None: ...
+ def add_callback(self, func: Callable[[Artist], Any]) -> int: ...
+ def remove_callback(self, oid: int) -> None: ...
+ def pchanged(self) -> None: ...
+
+class BarContainer(Container):
+ patches: list[Rectangle]
+ errorbar: None | ErrorbarContainer
+ datavalues: None | ArrayLike
+ orientation: None | Literal["vertical", "horizontal"]
+ def __init__(
+ self,
+ patches: list[Rectangle],
+ errorbar: ErrorbarContainer | None = ...,
+ *,
+ datavalues: ArrayLike | None = ...,
+ orientation: Literal["vertical", "horizontal"] | None = ...,
+ **kwargs
+ ) -> None: ...
+
+class ErrorbarContainer(Container):
+ lines: tuple[Line2D, Line2D, LineCollection]
+ has_xerr: bool
+ has_yerr: bool
+ def __init__(
+ self,
+ lines: tuple[Line2D, Line2D, LineCollection],
+ has_xerr: bool = ...,
+ has_yerr: bool = ...,
+ **kwargs
+ ) -> None: ...
+
+class StemContainer(Container):
+ markerline: Line2D
+ stemlines: LineCollection
+ baseline: Line2D
+ def __init__(
+ self,
+ markerline_stemlines_baseline: tuple[Line2D, LineCollection, Line2D],
+ **kwargs
+ ) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/contour.pyi b/contrib/python/matplotlib/py3/matplotlib/contour.pyi
new file mode 100644
index 0000000000..d7bddfe8f1
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/contour.pyi
@@ -0,0 +1,169 @@
+import matplotlib.cm as cm
+from matplotlib.artist import Artist
+from matplotlib.axes import Axes
+from matplotlib.collections import Collection, PathCollection
+from matplotlib.colors import Colormap, Normalize
+from matplotlib.font_manager import FontProperties
+from matplotlib.path import Path
+from matplotlib.patches import Patch
+from matplotlib.text import Text
+from matplotlib.transforms import Transform, TransformedPatchPath, TransformedPath
+from matplotlib.ticker import Locator, Formatter
+
+from numpy.typing import ArrayLike
+import numpy as np
+from collections.abc import Callable, Iterable, Sequence
+from typing import Literal
+from .typing import ColorType
+
+class ClabelText(Text): ...
+
+class ContourLabeler:
+ labelFmt: str | Formatter | Callable[[float], str] | dict[float, str]
+ labelManual: bool | Iterable[tuple[float, float]]
+ rightside_up: bool
+ labelLevelList: list[float]
+ labelIndiceList: list[int]
+ labelMappable: cm.ScalarMappable
+ labelCValueList: list[ColorType]
+ labelXYs: list[tuple[float, float]]
+ def clabel(
+ self,
+ levels: ArrayLike | None = ...,
+ *,
+ fontsize: str | float | None = ...,
+ inline: bool = ...,
+ inline_spacing: float = ...,
+ fmt: str | Formatter | Callable[[float], str] | dict[float, str] | None = ...,
+ colors: ColorType | Sequence[ColorType] | None = ...,
+ use_clabeltext: bool = ...,
+ manual: bool | Iterable[tuple[float, float]] = ...,
+ rightside_up: bool = ...,
+ zorder: float | None = ...
+ ) -> list[Text]: ...
+ @property
+ def labelFontProps(self) -> FontProperties: ...
+ @property
+ def labelFontSizeList(self) -> list[float]: ...
+ @property
+ def labelTextsList(self) -> list[Text]: ...
+ def print_label(self, linecontour: ArrayLike, labelwidth: float) -> bool: ...
+ def too_close(self, x: float, y: float, lw: float) -> bool: ...
+ def set_label_props(self, label: Text, text: str, color: ColorType) -> None: ...
+ def get_text(
+ self,
+ lev: float,
+ fmt: str | Formatter | Callable[[float], str] | dict[float, str],
+ ) -> str: ...
+ def locate_label(
+ self, linecontour: ArrayLike, labelwidth: float
+ ) -> tuple[float, float, float]: ...
+ def calc_label_rot_and_inline(
+ self,
+ slc: ArrayLike,
+ ind: int,
+ lw: float,
+ lc: ArrayLike | None = ...,
+ spacing: int = ...,
+ ) -> tuple[float, list[ArrayLike]]: ...
+ def add_label(
+ self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType
+ ) -> None: ...
+ def add_label_clabeltext(
+ self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType
+ ) -> None: ...
+ def add_label_near(
+ self,
+ x: float,
+ y: float,
+ inline: bool = ...,
+ inline_spacing: int = ...,
+ transform: Transform | Literal[False] | None = ...,
+ ) -> None: ...
+ def pop_label(self, index: int = ...) -> None: ...
+ def labels(self, inline: bool, inline_spacing: int) -> None: ...
+ def remove(self) -> None: ...
+
+class ContourSet(ContourLabeler, Collection):
+ axes: Axes
+ levels: Iterable[float]
+ filled: bool
+ linewidths: float | ArrayLike | None
+ hatches: Iterable[str | None]
+ origin: Literal["upper", "lower", "image"] | None
+ extent: tuple[float, float, float, float] | None
+ colors: ColorType | Sequence[ColorType]
+ extend: Literal["neither", "both", "min", "max"]
+ nchunk: int
+ locator: Locator | None
+ logscale: bool
+ negative_linestyles: None | Literal[
+ "solid", "dashed", "dashdot", "dotted"
+ ] | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
+ clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None
+ labelTexts: list[Text]
+ labelCValues: list[ColorType]
+ @property
+ def tcolors(self) -> list[tuple[tuple[float, float, float, float]]]: ...
+
+ # only for not filled
+ @property
+ def tlinewidths(self) -> list[tuple[float]]: ...
+
+ @property
+ def allkinds(self) -> list[list[np.ndarray | None]]: ...
+ @property
+ def allsegs(self) -> list[list[np.ndarray]]: ...
+ @property
+ def alpha(self) -> float | None: ...
+ @property
+ def antialiased(self) -> bool: ...
+ @antialiased.setter
+ def antialiased(self, aa: bool | Sequence[bool]) -> None: ...
+ @property
+ def collections(self) -> list[PathCollection]: ...
+ @property
+ def linestyles(self) -> (
+ None |
+ Literal["solid", "dashed", "dashdot", "dotted"] |
+ Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
+ ): ...
+
+ def __init__(
+ self,
+ ax: Axes,
+ *args,
+ levels: Iterable[float] | None = ...,
+ filled: bool = ...,
+ linewidths: float | ArrayLike | None = ...,
+ linestyles: Literal["solid", "dashed", "dashdot", "dotted"]
+ | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
+ | None = ...,
+ hatches: Iterable[str | None] = ...,
+ alpha: float | None = ...,
+ origin: Literal["upper", "lower", "image"] | None = ...,
+ extent: tuple[float, float, float, float] | None = ...,
+ cmap: str | Colormap | None = ...,
+ colors: ColorType | Sequence[ColorType] | None = ...,
+ norm: str | Normalize | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ extend: Literal["neither", "both", "min", "max"] = ...,
+ antialiased: bool | None = ...,
+ nchunk: int = ...,
+ locator: Locator | None = ...,
+ transform: Transform | None = ...,
+ negative_linestyles: Literal["solid", "dashed", "dashdot", "dotted"]
+ | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
+ | None = ...,
+ clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None = ...,
+ **kwargs
+ ) -> None: ...
+ def legend_elements(
+ self, variable_name: str = ..., str_format: Callable[[float], str] = ...
+ ) -> tuple[list[Artist], list[str]]: ...
+ def find_nearest_contour(
+ self, x: float, y: float, indices: Iterable[int] | None = ..., pixel: bool = ...
+ ) -> tuple[int, int, int, float, float, float]: ...
+
+class QuadContourSet(ContourSet): ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/dviread.pyi b/contrib/python/matplotlib/py3/matplotlib/dviread.pyi
new file mode 100644
index 0000000000..bf5cfcbe31
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/dviread.pyi
@@ -0,0 +1,90 @@
+from pathlib import Path
+import io
+import os
+from enum import Enum
+from collections.abc import Generator
+
+from typing import NamedTuple
+
+class _dvistate(Enum):
+ pre: int
+ outer: int
+ inpage: int
+ post_post: int
+ finale: int
+
+class Page(NamedTuple):
+ text: list[Text]
+ boxes: list[Box]
+ height: int
+ width: int
+ descent: int
+
+class Box(NamedTuple):
+ x: int
+ y: int
+ height: int
+ width: int
+
+class Text(NamedTuple):
+ x: int
+ y: int
+ font: DviFont
+ glyph: int
+ width: int
+ @property
+ def font_path(self) -> Path: ...
+ @property
+ def font_size(self) -> float: ...
+ @property
+ def font_effects(self) -> dict[str, float]: ...
+ @property
+ def glyph_name_or_index(self) -> int | str: ...
+
+class Dvi:
+ file: io.BufferedReader
+ dpi: float | None
+ fonts: dict[int, DviFont]
+ state: _dvistate
+ def __init__(self, filename: str | os.PathLike, dpi: float | None) -> None: ...
+ # Replace return with Self when py3.9 is dropped
+ def __enter__(self) -> Dvi: ...
+ def __exit__(self, etype, evalue, etrace) -> None: ...
+ def __iter__(self) -> Generator[Page, None, None]: ...
+ def close(self) -> None: ...
+
+class DviFont:
+ texname: bytes
+ size: float
+ widths: list[int]
+ def __init__(
+ self, scale: float, tfm: Tfm, texname: bytes, vf: Vf | None
+ ) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __ne__(self, other: object) -> bool: ...
+
+class Vf(Dvi):
+ def __init__(self, filename: str | os.PathLike) -> None: ...
+ def __getitem__(self, code: int) -> Page: ...
+
+class Tfm:
+ checksum: int
+ design_size: int
+ width: dict[int, int]
+ height: dict[int, int]
+ depth: dict[int, int]
+ def __init__(self, filename: str | os.PathLike) -> None: ...
+
+class PsFont(NamedTuple):
+ texname: bytes
+ psname: bytes
+ effects: dict[str, float]
+ encoding: None | bytes
+ filename: str
+
+class PsfontsMap:
+ # Replace return with Self when py3.9 is dropped
+ def __new__(cls, filename: str | os.PathLike) -> PsfontsMap: ...
+ def __getitem__(self, texname: bytes) -> PsFont: ...
+
+def find_tex_file(filename: str | os.PathLike) -> str: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/figure.pyi b/contrib/python/matplotlib/py3/matplotlib/figure.pyi
new file mode 100644
index 0000000000..887b6ed5d8
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/figure.pyi
@@ -0,0 +1,416 @@
+from collections.abc import Callable, Hashable, Iterable
+import os
+from typing import Any, IO, Literal, TypeVar, overload
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+from matplotlib.artist import Artist
+from matplotlib.axes import Axes, SubplotBase
+from matplotlib.backend_bases import (
+ FigureCanvasBase,
+ MouseButton,
+ MouseEvent,
+ RendererBase,
+)
+from matplotlib.colors import Colormap, Normalize
+from matplotlib.colorbar import Colorbar
+from matplotlib.cm import ScalarMappable
+from matplotlib.gridspec import GridSpec, SubplotSpec
+from matplotlib.image import _ImageBase, FigureImage
+from matplotlib.layout_engine import LayoutEngine
+from matplotlib.legend import Legend
+from matplotlib.lines import Line2D
+from matplotlib.patches import Rectangle, Patch
+from matplotlib.text import Text
+from matplotlib.transforms import Affine2D, Bbox, BboxBase, Transform
+from .typing import ColorType, HashableList
+
+_T = TypeVar("_T")
+
+class SubplotParams:
+ def __init__(
+ self,
+ left: float | None = ...,
+ bottom: float | None = ...,
+ right: float | None = ...,
+ top: float | None = ...,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ ) -> None: ...
+ left: float
+ right: float
+ bottom: float
+ top: float
+ wspace: float
+ hspace: float
+ def update(
+ self,
+ left: float | None = ...,
+ bottom: float | None = ...,
+ right: float | None = ...,
+ top: float | None = ...,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ ) -> None: ...
+
+class FigureBase(Artist):
+ artists: list[Artist]
+ lines: list[Line2D]
+ patches: list[Patch]
+ texts: list[Text]
+ images: list[_ImageBase]
+ legends: list[Legend]
+ subfigs: list[SubFigure]
+ stale: bool
+ suppressComposite: bool | None
+ def __init__(self, **kwargs) -> None: ...
+ def autofmt_xdate(
+ self,
+ bottom: float = ...,
+ rotation: int = ...,
+ ha: Literal["left", "center", "right"] = ...,
+ which: Literal["major", "minor", "both"] = ...,
+ ) -> None: ...
+ def get_children(self) -> list[Artist]: ...
+ def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ...
+ def suptitle(self, t: str, **kwargs) -> Text: ...
+ def get_suptitle(self) -> str: ...
+ def supxlabel(self, t: str, **kwargs) -> Text: ...
+ def get_supxlabel(self) -> str: ...
+ def supylabel(self, t: str, **kwargs) -> Text: ...
+ def get_supylabel(self) -> str: ...
+ def get_edgecolor(self) -> ColorType: ...
+ def get_facecolor(self) -> ColorType: ...
+ def get_frameon(self) -> bool: ...
+ def set_linewidth(self, linewidth: float) -> None: ...
+ def get_linewidth(self) -> float: ...
+ def set_edgecolor(self, color: ColorType) -> None: ...
+ def set_facecolor(self, color: ColorType) -> None: ...
+ def set_frameon(self, b: bool) -> None: ...
+ @property
+ def frameon(self) -> bool: ...
+ @frameon.setter
+ def frameon(self, b: bool) -> None: ...
+ def add_artist(self, artist: Artist, clip: bool = ...) -> Artist: ...
+ @overload
+ def add_axes(self, ax: Axes) -> Axes: ...
+ @overload
+ def add_axes(
+ self,
+ rect: tuple[float, float, float, float],
+ projection: None | str = ...,
+ polar: bool = ...,
+ **kwargs
+ ) -> Axes: ...
+
+ # TODO: docstring indicates SubplotSpec a valid arg, but none of the listed signatures appear to be that
+ @overload
+ def add_subplot(
+ self, nrows: int, ncols: int, index: int | tuple[int, int], **kwargs
+ ) -> Axes: ...
+ @overload
+ def add_subplot(self, pos: int, **kwargs) -> Axes: ...
+ @overload
+ def add_subplot(self, ax: Axes, **kwargs) -> Axes: ...
+ @overload
+ def add_subplot(self, ax: SubplotSpec, **kwargs) -> Axes: ...
+ @overload
+ def add_subplot(self, **kwargs) -> Axes: ...
+ @overload
+ def subplots(
+ self,
+ nrows: int = ...,
+ ncols: int = ...,
+ *,
+ sharex: bool | Literal["none", "all", "row", "col"] = ...,
+ sharey: bool | Literal["none", "all", "row", "col"] = ...,
+ squeeze: Literal[False],
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ subplot_kw: dict[str, Any] | None = ...,
+ gridspec_kw: dict[str, Any] | None = ...
+ ) -> np.ndarray: ...
+ @overload
+ def subplots(
+ self,
+ nrows: int = ...,
+ ncols: int = ...,
+ *,
+ sharex: bool | Literal["none", "all", "row", "col"] = ...,
+ sharey: bool | Literal["none", "all", "row", "col"] = ...,
+ squeeze: bool = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ subplot_kw: dict[str, Any] | None = ...,
+ gridspec_kw: dict[str, Any] | None = ...
+ ) -> np.ndarray | SubplotBase | Axes: ...
+ def delaxes(self, ax: Axes) -> None: ...
+ def clear(self, keep_observers: bool = ...) -> None: ...
+ def clf(self, keep_observers: bool = ...) -> None: ...
+
+ @overload
+ def legend(self) -> Legend: ...
+ @overload
+ def legend(self, handles: Iterable[Artist], labels: Iterable[str], **kwargs) -> Legend: ...
+ @overload
+ def legend(self, *, handles: Iterable[Artist], **kwargs) -> Legend: ...
+ @overload
+ def legend(self, labels: Iterable[str], **kwargs) -> Legend: ...
+ @overload
+ def legend(self, **kwargs) -> Legend: ...
+
+ def text(
+ self,
+ x: float,
+ y: float,
+ s: str,
+ fontdict: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> Text: ...
+ def colorbar(
+ self,
+ mappable: ScalarMappable,
+ cax: Axes | None = ...,
+ ax: Axes | Iterable[Axes] | None = ...,
+ use_gridspec: bool = ...,
+ **kwargs
+ ) -> Colorbar: ...
+ def subplots_adjust(
+ self,
+ left: float | None = ...,
+ bottom: float | None = ...,
+ right: float | None = ...,
+ top: float | None = ...,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ ) -> None: ...
+ def align_xlabels(self, axs: Iterable[Axes] | None = ...) -> None: ...
+ def align_ylabels(self, axs: Iterable[Axes] | None = ...) -> None: ...
+ def align_labels(self, axs: Iterable[Axes] | None = ...) -> None: ...
+ def add_gridspec(self, nrows: int = ..., ncols: int = ..., **kwargs) -> GridSpec: ...
+ @overload
+ def subfigures(
+ self,
+ nrows: int = ...,
+ ncols: int = ...,
+ squeeze: Literal[False] = ...,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ **kwargs
+ ) -> np.ndarray: ...
+ @overload
+ def subfigures(
+ self,
+ nrows: int = ...,
+ ncols: int = ...,
+ squeeze: Literal[True] = ...,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ **kwargs
+ ) -> np.ndarray | SubFigure: ...
+ def add_subfigure(self, subplotspec: SubplotSpec, **kwargs) -> SubFigure: ...
+ def sca(self, a: Axes) -> Axes: ...
+ def gca(self) -> Axes: ...
+ def _gci(self) -> ScalarMappable | None: ...
+ def _process_projection_requirements(
+ self, *, axes_class=None, polar=False, projection=None, **kwargs
+ ) -> tuple[type[Axes], dict[str, Any]]: ...
+ def get_default_bbox_extra_artists(self) -> list[Artist]: ...
+ def get_tightbbox(
+ self,
+ renderer: RendererBase | None = ...,
+ *,
+ bbox_extra_artists: Iterable[Artist] | None = ...,
+ ) -> Bbox: ...
+ @overload
+ def subplot_mosaic(
+ self,
+ mosaic: str,
+ *,
+ sharex: bool = ...,
+ sharey: bool = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ empty_sentinel: str = ...,
+ subplot_kw: dict[str, Any] | None = ...,
+ per_subplot_kw: dict[str | tuple[str, ...], dict[str, Any]] | None = ...,
+ gridspec_kw: dict[str, Any] | None = ...,
+ ) -> dict[str, Axes]: ...
+ @overload
+ def subplot_mosaic(
+ self,
+ mosaic: list[HashableList[_T]],
+ *,
+ sharex: bool = ...,
+ sharey: bool = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ empty_sentinel: _T = ...,
+ subplot_kw: dict[str, Any] | None = ...,
+ per_subplot_kw: dict[_T | tuple[_T, ...], dict[str, Any]] | None = ...,
+ gridspec_kw: dict[str, Any] | None = ...,
+ ) -> dict[_T, Axes]: ...
+ @overload
+ def subplot_mosaic(
+ self,
+ mosaic: list[HashableList[Hashable]],
+ *,
+ sharex: bool = ...,
+ sharey: bool = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ empty_sentinel: Any = ...,
+ subplot_kw: dict[str, Any] | None = ...,
+ per_subplot_kw: dict[Hashable | tuple[Hashable, ...], dict[str, Any]] | None = ...,
+ gridspec_kw: dict[str, Any] | None = ...,
+ ) -> dict[Hashable, Axes]: ...
+
+class SubFigure(FigureBase):
+ figure: Figure
+ subplotpars: SubplotParams
+ dpi_scale_trans: Affine2D
+ canvas: FigureCanvasBase
+ transFigure: Transform
+ bbox_relative: Bbox
+ figbbox: BboxBase
+ bbox: BboxBase
+ transSubfigure: Transform
+ patch: Rectangle
+ def __init__(
+ self,
+ parent: Figure | SubFigure,
+ subplotspec: SubplotSpec,
+ *,
+ facecolor: ColorType | None = ...,
+ edgecolor: ColorType | None = ...,
+ linewidth: float = ...,
+ frameon: bool | None = ...,
+ **kwargs
+ ) -> None: ...
+ @property
+ def dpi(self) -> float: ...
+ @dpi.setter
+ def dpi(self, value: float) -> None: ...
+ def get_dpi(self) -> float: ...
+ def set_dpi(self, val) -> None: ...
+ def get_constrained_layout(self) -> bool: ...
+ def get_constrained_layout_pads(
+ self, relative: bool = ...
+ ) -> tuple[float, float, float, float]: ...
+ def get_layout_engine(self) -> LayoutEngine: ...
+ @property # type: ignore[misc]
+ def axes(self) -> list[Axes]: ... # type: ignore[override]
+ def get_axes(self) -> list[Axes]: ...
+
+class Figure(FigureBase):
+ figure: Figure
+ bbox_inches: Bbox
+ dpi_scale_trans: Affine2D
+ bbox: BboxBase
+ figbbox: BboxBase
+ transFigure: Transform
+ transSubfigure: Transform
+ patch: Rectangle
+ subplotpars: SubplotParams
+ def __init__(
+ self,
+ figsize: tuple[float, float] | None = ...,
+ dpi: float | None = ...,
+ *,
+ facecolor: ColorType | None = ...,
+ edgecolor: ColorType | None = ...,
+ linewidth: float = ...,
+ frameon: bool | None = ...,
+ subplotpars: SubplotParams | None = ...,
+ tight_layout: bool | dict[str, Any] | None = ...,
+ constrained_layout: bool | dict[str, Any] | None = ...,
+ layout: Literal["constrained", "compressed", "tight"]
+ | LayoutEngine
+ | None = ...,
+ **kwargs
+ ) -> None: ...
+ def pick(self, mouseevent: MouseEvent) -> None: ...
+ def set_layout_engine(
+ self,
+ layout: Literal["constrained", "compressed", "tight", "none"]
+ | LayoutEngine
+ | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_layout_engine(self) -> LayoutEngine | None: ...
+ def _repr_html_(self) -> str | None: ...
+ def show(self, warn: bool = ...) -> None: ...
+ @property # type: ignore[misc]
+ def axes(self) -> list[Axes]: ... # type: ignore[override]
+ def get_axes(self) -> list[Axes]: ...
+ @property
+ def dpi(self) -> float: ...
+ @dpi.setter
+ def dpi(self, dpi: float) -> None: ...
+ def get_tight_layout(self) -> bool: ...
+ def get_constrained_layout_pads(
+ self, relative: bool = ...
+ ) -> tuple[float, float, float, float]: ...
+ def get_constrained_layout(self) -> bool: ...
+ canvas: FigureCanvasBase
+ def set_canvas(self, canvas: FigureCanvasBase) -> None: ...
+ def figimage(
+ self,
+ X: ArrayLike,
+ xo: int = ...,
+ yo: int = ...,
+ alpha: float | None = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ resize: bool = ...,
+ **kwargs
+ ) -> FigureImage: ...
+ def set_size_inches(
+ self, w: float | tuple[float, float], h: float | None = ..., forward: bool = ...
+ ) -> None: ...
+ def get_size_inches(self) -> np.ndarray: ...
+ def get_figwidth(self) -> float: ...
+ def get_figheight(self) -> float: ...
+ def get_dpi(self) -> float: ...
+ def set_dpi(self, val: float) -> None: ...
+ def set_figwidth(self, val: float, forward: bool = ...) -> None: ...
+ def set_figheight(self, val: float, forward: bool = ...) -> None: ...
+ def clear(self, keep_observers: bool = ...) -> None: ...
+ def draw_without_rendering(self) -> None: ...
+ def draw_artist(self, a: Artist) -> None: ...
+ def add_axobserver(self, func: Callable[[Figure], Any]) -> None: ...
+ def savefig(
+ self,
+ fname: str | os.PathLike | IO,
+ *,
+ transparent: bool | None = ...,
+ **kwargs
+ ) -> None: ...
+ def ginput(
+ self,
+ n: int = ...,
+ timeout: float = ...,
+ show_clicks: bool = ...,
+ mouse_add: MouseButton = ...,
+ mouse_pop: MouseButton = ...,
+ mouse_stop: MouseButton = ...,
+ ) -> list[tuple[int, int]]: ...
+ def waitforbuttonpress(self, timeout: float = ...) -> None | bool: ...
+ def tight_layout(
+ self,
+ *,
+ pad: float = ...,
+ h_pad: float | None = ...,
+ w_pad: float | None = ...,
+ rect: tuple[float, float, float, float] | None = ...
+ ) -> None: ...
+
+def figaspect(arg: float | ArrayLike) -> tuple[float, float]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/font_manager.pyi b/contrib/python/matplotlib/py3/matplotlib/font_manager.pyi
new file mode 100644
index 0000000000..48d0e362d5
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/font_manager.pyi
@@ -0,0 +1,136 @@
+from dataclasses import dataclass
+import os
+
+from matplotlib._afm import AFM
+from matplotlib import ft2font
+
+from pathlib import Path
+
+from collections.abc import Iterable
+from typing import Any, Literal
+
+font_scalings: dict[str | None, float]
+stretch_dict: dict[str, int]
+weight_dict: dict[str, int]
+font_family_aliases: set[str]
+MSFolders: str
+MSFontDirectories: list[str]
+MSUserFontDirectories: list[str]
+X11FontDirectories: list[str]
+OSXFontDirectories: list[str]
+
+def get_fontext_synonyms(fontext: str) -> list[str]: ...
+def list_fonts(directory: str, extensions: Iterable[str]) -> list[str]: ...
+def win32FontDirectory() -> str: ...
+def _get_fontconfig_fonts() -> list[Path]: ...
+def findSystemFonts(
+ fontpaths: Iterable[str | os.PathLike | Path] | None = ..., fontext: str = ...
+) -> list[str]: ...
+@dataclass
+class FontEntry:
+ fname: str = ...
+ name: str = ...
+ style: str = ...
+ variant: str = ...
+ weight: str | int = ...
+ stretch: str = ...
+ size: str = ...
+ def _repr_html_(self) -> str: ...
+ def _repr_png_(self) -> bytes: ...
+
+def ttfFontProperty(font: ft2font.FT2Font) -> FontEntry: ...
+def afmFontProperty(fontpath: str, font: AFM) -> FontEntry: ...
+
+class FontProperties:
+ def __init__(
+ self,
+ family: str | Iterable[str] | None = ...,
+ style: Literal["normal", "italic", "oblique"] | None = ...,
+ variant: Literal["normal", "small-caps"] | None = ...,
+ weight: int | str | None = ...,
+ stretch: int | str | None = ...,
+ size: float | str | None = ...,
+ fname: str | os.PathLike | Path | None = ...,
+ math_fontfamily: str | None = ...,
+ ) -> None: ...
+ def __hash__(self) -> int: ...
+ def __eq__(self, other: object) -> bool: ...
+ def get_family(self) -> list[str]: ...
+ def get_name(self) -> str: ...
+ def get_style(self) -> Literal["normal", "italic", "oblique"]: ...
+ def get_variant(self) -> Literal["normal", "small-caps"]: ...
+ def get_weight(self) -> int | str: ...
+ def get_stretch(self) -> int | str: ...
+ def get_size(self) -> float: ...
+ def get_file(self) -> str | bytes | None: ...
+ def get_fontconfig_pattern(self) -> dict[str, list[Any]]: ...
+ def set_family(self, family: str | Iterable[str] | None) -> None: ...
+ def set_style(
+ self, style: Literal["normal", "italic", "oblique"] | None
+ ) -> None: ...
+ def set_variant(self, variant: Literal["normal", "small-caps"] | None) -> None: ...
+ def set_weight(self, weight: int | str | None) -> None: ...
+ def set_stretch(self, stretch: int | str | None) -> None: ...
+ def set_size(self, size: float | str | None) -> None: ...
+ def set_file(self, file: str | os.PathLike | Path | None) -> None: ...
+ def set_fontconfig_pattern(self, pattern: str) -> None: ...
+ def get_math_fontfamily(self) -> str: ...
+ def set_math_fontfamily(self, fontfamily: str | None) -> None: ...
+ def copy(self) -> FontProperties: ...
+ # Aliases
+ set_name = set_family
+ get_slant = get_style
+ set_slant = set_style
+ get_size_in_points = get_size
+
+def json_dump(data: FontManager, filename: str | Path | os.PathLike) -> None: ...
+def json_load(filename: str | Path | os.PathLike) -> FontManager: ...
+
+class FontManager:
+ __version__: int
+ default_size: float | None
+ defaultFamily: dict[str, str]
+ afmlist: list[FontEntry]
+ ttflist: list[FontEntry]
+ def __init__(self, size: float | None = ..., weight: str = ...) -> None: ...
+ def addfont(self, path: str | Path | os.PathLike) -> None: ...
+ @property
+ def defaultFont(self) -> dict[str, str]: ...
+ def get_default_weight(self) -> str: ...
+ @staticmethod
+ def get_default_size() -> float: ...
+ def set_default_weight(self, weight: str) -> None: ...
+ def score_family(
+ self, families: str | list[str] | tuple[str], family2: str
+ ) -> float: ...
+ def score_style(self, style1: str, style2: str) -> float: ...
+ def score_variant(self, variant1: str, variant2: str) -> float: ...
+ def score_stretch(self, stretch1: str | int, stretch2: str | int) -> float: ...
+ def score_weight(self, weight1: str | float, weight2: str | float) -> float: ...
+ def score_size(self, size1: str | float, size2: str | float) -> float: ...
+ def findfont(
+ self,
+ prop: str | FontProperties,
+ fontext: Literal["ttf", "afm"] = ...,
+ directory: str | None = ...,
+ fallback_to_default: bool = ...,
+ rebuild_if_missing: bool = ...,
+ ) -> str: ...
+ def get_font_names(self) -> list[str]: ...
+
+def is_opentype_cff_font(filename: str) -> bool: ...
+def get_font(
+ font_filepaths: Iterable[str | Path | bytes] | str | Path | bytes,
+ hinting_factor: int | None = ...,
+) -> ft2font.FT2Font: ...
+
+fontManager: FontManager
+
+def findfont(
+ prop: str | FontProperties,
+ fontext: Literal["ttf", "afm"] = ...,
+ directory: str | None = ...,
+ fallback_to_default: bool = ...,
+ rebuild_if_missing: bool = ...,
+) -> str: ...
+def get_font_names() -> list[str]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/ft2font.pyi b/contrib/python/matplotlib/py3/matplotlib/ft2font.pyi
new file mode 100644
index 0000000000..6a0716e993
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/ft2font.pyi
@@ -0,0 +1,253 @@
+from typing import BinaryIO, Literal, TypedDict, overload
+
+import numpy as np
+from numpy.typing import NDArray
+
+__freetype_build_type__: str
+__freetype_version__: str
+BOLD: int
+EXTERNAL_STREAM: int
+FAST_GLYPHS: int
+FIXED_SIZES: int
+FIXED_WIDTH: int
+GLYPH_NAMES: int
+HORIZONTAL: int
+ITALIC: int
+KERNING: int
+KERNING_DEFAULT: int
+KERNING_UNFITTED: int
+KERNING_UNSCALED: int
+LOAD_CROP_BITMAP: int
+LOAD_DEFAULT: int
+LOAD_FORCE_AUTOHINT: int
+LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH: int
+LOAD_IGNORE_TRANSFORM: int
+LOAD_LINEAR_DESIGN: int
+LOAD_MONOCHROME: int
+LOAD_NO_AUTOHINT: int
+LOAD_NO_BITMAP: int
+LOAD_NO_HINTING: int
+LOAD_NO_RECURSE: int
+LOAD_NO_SCALE: int
+LOAD_PEDANTIC: int
+LOAD_RENDER: int
+LOAD_TARGET_LCD: int
+LOAD_TARGET_LCD_V: int
+LOAD_TARGET_LIGHT: int
+LOAD_TARGET_MONO: int
+LOAD_TARGET_NORMAL: int
+LOAD_VERTICAL_LAYOUT: int
+MULTIPLE_MASTERS: int
+SCALABLE: int
+SFNT: int
+VERTICAL: int
+
+class _SfntHeadDict(TypedDict):
+ version: tuple[int, int]
+ fontRevision: tuple[int, int]
+ checkSumAdjustment: int
+ magicNumber: int
+ flags: int
+ unitsPerEm: int
+ created: tuple[int, int]
+ modified: tuple[int, int]
+ xMin: int
+ yMin: int
+ xMax: int
+ yMax: int
+ macStyle: int
+ lowestRecPPEM: int
+ fontDirectionHint: int
+ indexToLocFormat: int
+ glyphDataFormat: int
+
+class _SfntMaxpDict(TypedDict):
+ version: tuple[int, int]
+ numGlyphs: int
+ maxPoints: int
+ maxContours: int
+ maxComponentPoints: int
+ maxComponentContours: int
+ maxZones: int
+ maxTwilightPoints: int
+ maxStorage: int
+ maxFunctionDefs: int
+ maxInstructionDefs: int
+ maxStackElements: int
+ maxSizeOfInstructions: int
+ maxComponentElements: int
+ maxComponentDepth: int
+
+class _SfntOs2Dict(TypedDict):
+ version: int
+ xAvgCharWidth: int
+ usWeightClass: int
+ usWidthClass: int
+ fsType: int
+ ySubscriptXSize: int
+ ySubscriptYSize: int
+ ySubscriptXOffset: int
+ ySubscriptYOffset: int
+ ySuperscriptXSize: int
+ ySuperscriptYSize: int
+ ySuperscriptXOffset: int
+ ySuperscriptYOffset: int
+ yStrikeoutSize: int
+ yStrikeoutPosition: int
+ sFamilyClass: int
+ panose: bytes
+ ulCharRange: tuple[int, int, int, int]
+ achVendID: bytes
+ fsSelection: int
+ fsFirstCharIndex: int
+ fsLastCharIndex: int
+
+class _SfntHheaDict(TypedDict):
+ version: tuple[int, int]
+ ascent: int
+ descent: int
+ lineGap: int
+ advanceWidthMax: int
+ minLeftBearing: int
+ minRightBearing: int
+ xMaxExtent: int
+ caretSlopeRise: int
+ caretSlopeRun: int
+ caretOffset: int
+ metricDataFormat: int
+ numOfLongHorMetrics: int
+
+class _SfntVheaDict(TypedDict):
+ version: tuple[int, int]
+ vertTypoAscender: int
+ vertTypoDescender: int
+ vertTypoLineGap: int
+ advanceHeightMax: int
+ minTopSideBearing: int
+ minBottomSizeBearing: int
+ yMaxExtent: int
+ caretSlopeRise: int
+ caretSlopeRun: int
+ caretOffset: int
+ metricDataFormat: int
+ numOfLongVerMetrics: int
+
+class _SfntPostDict(TypedDict):
+ format: tuple[int, int]
+ italicAngle: tuple[int, int]
+ underlinePosition: int
+ underlineThickness: int
+ isFixedPitch: int
+ minMemType42: int
+ maxMemType42: int
+ minMemType1: int
+ maxMemType1: int
+
+class _SfntPcltDict(TypedDict):
+ version: tuple[int, int]
+ fontNumber: int
+ pitch: int
+ xHeight: int
+ style: int
+ typeFamily: int
+ capHeight: int
+ symbolSet: int
+ typeFace: bytes
+ characterComplement: bytes
+ strokeWeight: int
+ widthType: int
+ serifStyle: int
+
+class FT2Font:
+ ascender: int
+ bbox: tuple[int, int, int, int]
+ descender: int
+ face_flags: int
+ family_name: str
+ fname: str
+ height: int
+ max_advance_height: int
+ max_advance_width: int
+ num_charmaps: int
+ num_faces: int
+ num_fixed_sizes: int
+ num_glyphs: int
+ postscript_name: str
+ scalable: bool
+ style_flags: int
+ style_name: str
+ underline_position: int
+ underline_thickness: int
+ units_per_EM: int
+
+ def __init__(
+ self,
+ filename: str | BinaryIO,
+ hinting_factor: int = ...,
+ *,
+ _fallback_list: list[FT2Font] | None = ...,
+ _kerning_factor: int = ...
+ ) -> None: ...
+ def _get_fontmap(self, string: str) -> dict[str, FT2Font]: ...
+ def clear(self) -> None: ...
+ def draw_glyph_to_bitmap(
+ self, image: FT2Image, x: float, y: float, glyph: Glyph, antialiased: bool = ...
+ ) -> None: ...
+ def draw_glyphs_to_bitmap(self, antialiased: bool = ...) -> None: ...
+ def get_bitmap_offset(self) -> tuple[int, int]: ...
+ def get_char_index(self, codepoint: int) -> int: ...
+ def get_charmap(self) -> dict[int, int]: ...
+ def get_descent(self) -> int: ...
+ def get_glyph_name(self, index: int) -> str: ...
+ def get_image(self) -> NDArray[np.uint8]: ...
+ def get_kerning(self, left: int, right: int, mode: int) -> int: ...
+ def get_name_index(self, name: str) -> int: ...
+ def get_num_glyphs(self) -> int: ...
+ def get_path(self) -> tuple[NDArray[np.float64], NDArray[np.int8]]: ...
+ def get_ps_font_info(
+ self,
+ ) -> tuple[str, str, str, str, str, int, int, int, int]: ...
+ def get_sfnt(self) -> dict[tuple[int, int, int, int], bytes]: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["head"]) -> _SfntHeadDict | None: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["maxp"]) -> _SfntMaxpDict | None: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["OS/2"]) -> _SfntOs2Dict | None: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["hhea"]) -> _SfntHheaDict | None: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["vhea"]) -> _SfntVheaDict | None: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["post"]) -> _SfntPostDict | None: ...
+ @overload
+ def get_sfnt_table(self, name: Literal["pclt"]) -> _SfntPcltDict | None: ...
+ def get_width_height(self) -> tuple[int, int]: ...
+ def get_xys(self, antialiased: bool = ...) -> NDArray[np.float64]: ...
+ def load_char(self, charcode: int, flags: int = ...) -> Glyph: ...
+ def load_glyph(self, glyphindex: int, flags: int = ...) -> Glyph: ...
+ def select_charmap(self, i: int) -> None: ...
+ def set_charmap(self, i: int) -> None: ...
+ def set_size(self, ptsize: float, dpi: float) -> None: ...
+ def set_text(
+ self, string: str, angle: float = ..., flags: int = ...
+ ) -> NDArray[np.float64]: ...
+
+class FT2Image: # TODO: When updating mypy>=1.4, subclass from Buffer.
+ def __init__(self, width: float, height: float) -> None: ...
+ def draw_rect(self, x0: float, y0: float, x1: float, y1: float) -> None: ...
+ def draw_rect_filled(self, x0: float, y0: float, x1: float, y1: float) -> None: ...
+
+class Glyph:
+ width: int
+ height: int
+ horiBearingX: int
+ horiBearingY: int
+ horiAdvance: int
+ linearHoriAdvance: int
+ vertBearingX: int
+ vertBearingY: int
+ vertAdvance: int
+
+ @property
+ def bbox(self) -> tuple[int, int, int, int]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/gridspec.pyi b/contrib/python/matplotlib/py3/matplotlib/gridspec.pyi
new file mode 100644
index 0000000000..6e2273080b
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/gridspec.pyi
@@ -0,0 +1,134 @@
+from typing import Any, Literal, overload
+
+from numpy.typing import ArrayLike
+import numpy as np
+
+from matplotlib.axes import Axes, SubplotBase
+from matplotlib.backend_bases import RendererBase
+from matplotlib.figure import Figure, SubplotParams
+from matplotlib.transforms import Bbox
+
+class GridSpecBase:
+ def __init__(
+ self,
+ nrows: int,
+ ncols: int,
+ height_ratios: ArrayLike | None = ...,
+ width_ratios: ArrayLike | None = ...,
+ ) -> None: ...
+ @property
+ def nrows(self) -> int: ...
+ @property
+ def ncols(self) -> int: ...
+ def get_geometry(self) -> tuple[int, int]: ...
+ def get_subplot_params(self, figure: Figure | None = ...) -> SubplotParams: ...
+ def new_subplotspec(
+ self, loc: tuple[int, int], rowspan: int = ..., colspan: int = ...
+ ) -> SubplotSpec: ...
+ def set_width_ratios(self, width_ratios: ArrayLike | None) -> None: ...
+ def get_width_ratios(self) -> ArrayLike: ...
+ def set_height_ratios(self, height_ratios: ArrayLike | None) -> None: ...
+ def get_height_ratios(self) -> ArrayLike: ...
+ def get_grid_positions(
+ self, fig: Figure, raw: bool = ...
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: ...
+ @staticmethod
+ def _check_gridspec_exists(figure: Figure, nrows: int, ncols: int) -> GridSpec: ...
+ def __getitem__(
+ self, key: tuple[int | slice, int | slice] | slice | int
+ ) -> SubplotSpec: ...
+ @overload
+ def subplots(
+ self,
+ *,
+ sharex: bool | Literal["all", "row", "col", "none"] = ...,
+ sharey: bool | Literal["all", "row", "col", "none"] = ...,
+ squeeze: Literal[False],
+ subplot_kw: dict[str, Any] | None = ...
+ ) -> np.ndarray: ...
+ @overload
+ def subplots(
+ self,
+ *,
+ sharex: bool | Literal["all", "row", "col", "none"] = ...,
+ sharey: bool | Literal["all", "row", "col", "none"] = ...,
+ squeeze: Literal[True] = ...,
+ subplot_kw: dict[str, Any] | None = ...
+ ) -> np.ndarray | SubplotBase | Axes: ...
+
+class GridSpec(GridSpecBase):
+ left: float | None
+ bottom: float | None
+ right: float | None
+ top: float | None
+ wspace: float | None
+ hspace: float | None
+ figure: Figure | None
+ def __init__(
+ self,
+ nrows: int,
+ ncols: int,
+ figure: Figure | None = ...,
+ left: float | None = ...,
+ bottom: float | None = ...,
+ right: float | None = ...,
+ top: float | None = ...,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ width_ratios: ArrayLike | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ ) -> None: ...
+ def update(self, **kwargs: float | None) -> None: ...
+ def locally_modified_subplot_params(self) -> list[str]: ...
+ def tight_layout(
+ self,
+ figure: Figure,
+ renderer: RendererBase | None = ...,
+ pad: float = ...,
+ h_pad: float | None = ...,
+ w_pad: float | None = ...,
+ rect: tuple[float, float, float, float] | None = ...,
+ ) -> None: ...
+
+class GridSpecFromSubplotSpec(GridSpecBase):
+ figure: Figure | None
+ def __init__(
+ self,
+ nrows: int,
+ ncols: int,
+ subplot_spec: SubplotSpec,
+ wspace: float | None = ...,
+ hspace: float | None = ...,
+ height_ratios: ArrayLike | None = ...,
+ width_ratios: ArrayLike | None = ...,
+ ) -> None: ...
+ def get_topmost_subplotspec(self) -> SubplotSpec: ...
+
+class SubplotSpec:
+ num1: int
+ def __init__(
+ self, gridspec: GridSpecBase, num1: int, num2: int | None = ...
+ ) -> None: ...
+ @staticmethod
+ def _from_subplot_args(figure, args): ...
+ @property
+ def num2(self) -> int: ...
+ @num2.setter
+ def num2(self, value: int) -> None: ...
+ def get_gridspec(self) -> GridSpec: ...
+ def get_geometry(self) -> tuple[int, int, int, int]: ...
+ @property
+ def rowspan(self) -> range: ...
+ @property
+ def colspan(self) -> range: ...
+ def is_first_row(self) -> bool: ...
+ def is_last_row(self) -> bool: ...
+ def is_first_col(self) -> bool: ...
+ def is_last_col(self) -> bool: ...
+ def get_position(self, figure: Figure) -> Bbox: ...
+ def get_topmost_subplotspec(self) -> SubplotSpec: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __hash__(self) -> int: ...
+ def subgridspec(
+ self, nrows: int, ncols: int, **kwargs
+ ) -> GridSpecFromSubplotSpec: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/hatch.pyi b/contrib/python/matplotlib/py3/matplotlib/hatch.pyi
new file mode 100644
index 0000000000..348cf52149
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/hatch.pyi
@@ -0,0 +1,68 @@
+from matplotlib.path import Path
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+class HatchPatternBase: ...
+
+class HorizontalHatch(HatchPatternBase):
+ num_lines: int
+ num_vertices: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+ def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ...
+
+class VerticalHatch(HatchPatternBase):
+ num_lines: int
+ num_vertices: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+ def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ...
+
+class NorthEastHatch(HatchPatternBase):
+ num_lines: int
+ num_vertices: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+ def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ...
+
+class SouthEastHatch(HatchPatternBase):
+ num_lines: int
+ num_vertices: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+ def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ...
+
+class Shapes(HatchPatternBase):
+ filled: bool
+ num_shapes: int
+ num_vertices: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+ def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ...
+
+class Circles(Shapes):
+ shape_vertices: np.ndarray
+ shape_codes: np.ndarray
+ def __init__(self, hatch: str, density: int) -> None: ...
+
+class SmallCircles(Circles):
+ size: float
+ num_rows: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+
+class LargeCircles(Circles):
+ size: float
+ num_rows: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+
+class SmallFilledCircles(Circles):
+ size: float
+ filled: bool
+ num_rows: int
+ def __init__(self, hatch: str, density: int) -> None: ...
+
+class Stars(Shapes):
+ size: float
+ filled: bool
+ num_rows: int
+ shape_vertices: np.ndarray
+ shape_codes: np.ndarray
+ def __init__(self, hatch: str, density: int) -> None: ...
+
+def get_path(hatchpattern: str, density: int = ...) -> Path: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/image.pyi b/contrib/python/matplotlib/py3/matplotlib/image.pyi
new file mode 100644
index 0000000000..426e34ec83
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/image.pyi
@@ -0,0 +1,209 @@
+from collections.abc import Callable, Sequence
+import os
+import pathlib
+from typing import Any, BinaryIO, Literal
+
+import numpy as np
+from numpy.typing import ArrayLike, NDArray
+import PIL.Image
+
+import matplotlib.artist as martist
+from matplotlib.axes import Axes
+from matplotlib import cm
+from matplotlib.backend_bases import RendererBase, MouseEvent
+from matplotlib.colors import Colormap, Normalize
+from matplotlib.figure import Figure
+from matplotlib.transforms import Affine2D, BboxBase, Bbox, Transform
+
+#
+# These names are re-exported from matplotlib._image.
+#
+
+BESSEL: int
+BICUBIC: int
+BILINEAR: int
+BLACKMAN: int
+CATROM: int
+GAUSSIAN: int
+HAMMING: int
+HANNING: int
+HERMITE: int
+KAISER: int
+LANCZOS: int
+MITCHELL: int
+NEAREST: int
+QUADRIC: int
+SINC: int
+SPLINE16: int
+SPLINE36: int
+
+def resample(
+ input_array: NDArray[np.float32] | NDArray[np.float64] | NDArray[np.int8],
+ output_array: NDArray[np.float32] | NDArray[np.float64] | NDArray[np.int8],
+ transform: Transform,
+ interpolation: int = ...,
+ resample: bool = ...,
+ alpha: float = ...,
+ norm: bool = ...,
+ radius: float = ...,
+) -> None: ...
+
+#
+# END names re-exported from matplotlib._image.
+#
+
+interpolations_names: set[str]
+
+def composite_images(
+ images: Sequence[_ImageBase], renderer: RendererBase, magnification: float = ...
+) -> tuple[np.ndarray, float, float]: ...
+
+class _ImageBase(martist.Artist, cm.ScalarMappable):
+ zorder: float
+ origin: Literal["upper", "lower"]
+ axes: Axes
+ def __init__(
+ self,
+ ax: Axes,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ interpolation: str | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ filternorm: bool = ...,
+ filterrad: float = ...,
+ resample: bool | None = ...,
+ *,
+ interpolation_stage: Literal["data", "rgba"] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_size(self) -> tuple[int, int]: ...
+ def set_alpha(self, alpha: float | ArrayLike | None) -> None: ...
+ def changed(self) -> None: ...
+ def make_image(
+ self, renderer: RendererBase, magnification: float = ..., unsampled: bool = ...
+ ) -> tuple[np.ndarray, float, float, Affine2D]: ...
+ def draw(self, renderer: RendererBase, *args, **kwargs) -> None: ...
+ def write_png(self, fname: str | pathlib.Path | BinaryIO) -> None: ...
+ def set_data(self, A: ArrayLike | None) -> None: ...
+ def set_array(self, A: ArrayLike | None) -> None: ...
+ def get_shape(self) -> tuple[int, int, int]: ...
+ def get_interpolation(self) -> str: ...
+ def set_interpolation(self, s: str | None) -> None: ...
+ def set_interpolation_stage(self, s: Literal["data", "rgba"]) -> None: ...
+ def can_composite(self) -> bool: ...
+ def set_resample(self, v: bool | None) -> None: ...
+ def get_resample(self) -> bool: ...
+ def set_filternorm(self, filternorm: bool) -> None: ...
+ def get_filternorm(self) -> bool: ...
+ def set_filterrad(self, filterrad: float) -> None: ...
+ def get_filterrad(self) -> float: ...
+
+class AxesImage(_ImageBase):
+ def __init__(
+ self,
+ ax: Axes,
+ *,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ interpolation: str | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ extent: tuple[float, float, float, float] | None = ...,
+ filternorm: bool = ...,
+ filterrad: float = ...,
+ resample: bool = ...,
+ interpolation_stage: Literal["data", "rgba"] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
+ def make_image(
+ self, renderer: RendererBase, magnification: float = ..., unsampled: bool = ...
+ ) -> tuple[np.ndarray, float, float, Affine2D]: ...
+ def set_extent(
+ self, extent: tuple[float, float, float, float], **kwargs
+ ) -> None: ...
+ def get_extent(self) -> tuple[float, float, float, float]: ...
+ def get_cursor_data(self, event: MouseEvent) -> None | float: ...
+
+class NonUniformImage(AxesImage):
+ mouseover: bool
+ def __init__(
+ self, ax: Axes, *, interpolation: Literal["nearest", "bilinear"] = ..., **kwargs
+ ) -> None: ...
+ def set_data(self, x: ArrayLike, y: ArrayLike, A: ArrayLike) -> None: ... # type: ignore[override]
+ # more limited interpolation available here than base class
+ def set_interpolation(self, s: Literal["nearest", "bilinear"]) -> None: ... # type: ignore[override]
+
+class PcolorImage(AxesImage):
+ def __init__(
+ self,
+ ax: Axes,
+ x: ArrayLike | None = ...,
+ y: ArrayLike | None = ...,
+ A: ArrayLike | None = ...,
+ *,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ **kwargs
+ ) -> None: ...
+ def set_data(self, x: ArrayLike, y: ArrayLike, A: ArrayLike) -> None: ... # type: ignore[override]
+
+class FigureImage(_ImageBase):
+ zorder: float
+ figure: Figure
+ ox: float
+ oy: float
+ magnification: float
+ def __init__(
+ self,
+ fig: Figure,
+ *,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ offsetx: int = ...,
+ offsety: int = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_extent(self) -> tuple[float, float, float, float]: ...
+
+class BboxImage(_ImageBase):
+ bbox: BboxBase
+ def __init__(
+ self,
+ bbox: BboxBase | Callable[[RendererBase | None], Bbox],
+ *,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ interpolation: str | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ filternorm: bool = ...,
+ filterrad: float = ...,
+ resample: bool = ...,
+ **kwargs
+ ) -> None: ...
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
+
+def imread(
+ fname: str | pathlib.Path | BinaryIO, format: str | None = ...
+) -> np.ndarray: ...
+def imsave(
+ fname: str | os.PathLike | BinaryIO,
+ arr: ArrayLike,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ cmap: str | Colormap | None = ...,
+ format: str | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ dpi: float = ...,
+ *,
+ metadata: dict[str, str] | None = ...,
+ pil_kwargs: dict[str, Any] | None = ...
+) -> None: ...
+def pil_to_array(pilImage: PIL.Image.Image) -> np.ndarray: ...
+def thumbnail(
+ infile: str | BinaryIO,
+ thumbfile: str | BinaryIO,
+ scale: float = ...,
+ interpolation: str = ...,
+ preview: bool = ...,
+) -> Figure: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi b/contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi
new file mode 100644
index 0000000000..5b8c812ff4
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi
@@ -0,0 +1,62 @@
+from matplotlib.figure import Figure
+
+from typing import Any
+
+class LayoutEngine:
+ def __init__(self, **kwargs: Any) -> None: ...
+ def set(self) -> None: ...
+ @property
+ def colorbar_gridspec(self) -> bool: ...
+ @property
+ def adjust_compatible(self) -> bool: ...
+ def get(self) -> dict[str, Any]: ...
+ def execute(self, fig: Figure) -> None: ...
+
+class PlaceHolderLayoutEngine(LayoutEngine):
+ def __init__(
+ self, adjust_compatible: bool, colorbar_gridspec: bool, **kwargs: Any
+ ) -> None: ...
+ def execute(self, fig: Figure) -> None: ...
+
+class TightLayoutEngine(LayoutEngine):
+ def __init__(
+ self,
+ *,
+ pad: float = ...,
+ h_pad: float | None = ...,
+ w_pad: float | None = ...,
+ rect: tuple[float, float, float, float] = ...,
+ **kwargs: Any
+ ) -> None: ...
+ def execute(self, fig: Figure) -> None: ...
+ def set(
+ self,
+ *,
+ pad: float | None = ...,
+ w_pad: float | None = ...,
+ h_pad: float | None = ...,
+ rect: tuple[float, float, float, float] | None = ...
+ ) -> None: ...
+
+class ConstrainedLayoutEngine(LayoutEngine):
+ def __init__(
+ self,
+ *,
+ h_pad: float | None = ...,
+ w_pad: float | None = ...,
+ hspace: float | None = ...,
+ wspace: float | None = ...,
+ rect: tuple[float, float, float, float] = ...,
+ compress: bool = ...,
+ **kwargs: Any
+ ) -> None: ...
+ def execute(self, fig: Figure) -> Any: ...
+ def set(
+ self,
+ *,
+ h_pad: float | None = ...,
+ w_pad: float | None = ...,
+ hspace: float | None = ...,
+ wspace: float | None = ...,
+ rect: tuple[float, float, float, float] | None = ...
+ ) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/legend.pyi b/contrib/python/matplotlib/py3/matplotlib/legend.pyi
new file mode 100644
index 0000000000..d559b06c5d
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/legend.pyi
@@ -0,0 +1,154 @@
+from matplotlib.axes import Axes
+from matplotlib.artist import Artist
+from matplotlib.backend_bases import MouseEvent
+from matplotlib.figure import Figure
+from matplotlib.font_manager import FontProperties
+from matplotlib.legend_handler import HandlerBase
+from matplotlib.lines import Line2D
+from matplotlib.offsetbox import (
+ DraggableOffsetBox,
+)
+from matplotlib.patches import FancyBboxPatch, Patch, Rectangle
+from matplotlib.text import Text
+from matplotlib.transforms import (
+ BboxBase,
+ Transform,
+)
+
+
+import pathlib
+from collections.abc import Iterable
+from typing import Any, Literal, overload
+from .typing import ColorType
+
+class DraggableLegend(DraggableOffsetBox):
+ legend: Legend
+ def __init__(
+ self, legend: Legend, use_blit: bool = ..., update: Literal["loc", "bbox"] = ...
+ ) -> None: ...
+ def finalize_offset(self) -> None: ...
+
+class Legend(Artist):
+ codes: dict[str, int]
+ zorder: float
+ prop: FontProperties
+ texts: list[Text]
+ legend_handles: list[Artist | None]
+ numpoints: int
+ markerscale: float
+ scatterpoints: int
+ borderpad: float
+ labelspacing: float
+ handlelength: float
+ handleheight: float
+ handletextpad: float
+ borderaxespad: float
+ columnspacing: float
+ shadow: bool
+ isaxes: bool
+ axes: Axes
+ parent: Axes | Figure
+ legendPatch: FancyBboxPatch
+ def __init__(
+ self,
+ parent: Axes | Figure,
+ handles: Iterable[Artist | tuple[Artist, ...]],
+ labels: Iterable[str],
+ *,
+ loc: str | tuple[float, float] | int | None = ...,
+ numpoints: int | None = ...,
+ markerscale: float | None = ...,
+ markerfirst: bool = ...,
+ reverse: bool = ...,
+ scatterpoints: int | None = ...,
+ scatteryoffsets: Iterable[float] | None = ...,
+ prop: FontProperties | dict[str, Any] | None = ...,
+ fontsize: float | str | None = ...,
+ labelcolor: ColorType
+ | Iterable[ColorType]
+ | Literal["linecolor", "markerfacecolor", "mfc", "markeredgecolor", "mec"]
+ | None = ...,
+ borderpad: float | None = ...,
+ labelspacing: float | None = ...,
+ handlelength: float | None = ...,
+ handleheight: float | None = ...,
+ handletextpad: float | None = ...,
+ borderaxespad: float | None = ...,
+ columnspacing: float | None = ...,
+ ncols: int = ...,
+ mode: Literal["expand"] | None = ...,
+ fancybox: bool | None = ...,
+ shadow: bool | dict[str, Any] | None = ...,
+ title: str | None = ...,
+ title_fontsize: float | None = ...,
+ framealpha: float | None = ...,
+ edgecolor: Literal["inherit"] | ColorType | None = ...,
+ facecolor: Literal["inherit"] | ColorType | None = ...,
+ bbox_to_anchor: BboxBase
+ | tuple[float, float]
+ | tuple[float, float, float, float]
+ | None = ...,
+ bbox_transform: Transform | None = ...,
+ frameon: bool | None = ...,
+ handler_map: dict[Artist | type, HandlerBase] | None = ...,
+ title_fontproperties: FontProperties | dict[str, Any] | None = ...,
+ alignment: Literal["center", "left", "right"] = ...,
+ ncol: int = ...,
+ draggable: bool = ...
+ ) -> None: ...
+ def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ...
+ def set_ncols(self, ncols: int) -> None: ...
+ @classmethod
+ def get_default_handler_map(cls) -> dict[type, HandlerBase]: ...
+ @classmethod
+ def set_default_handler_map(cls, handler_map: dict[type, HandlerBase]) -> None: ...
+ @classmethod
+ def update_default_handler_map(
+ cls, handler_map: dict[type, HandlerBase]
+ ) -> None: ...
+ def get_legend_handler_map(self) -> dict[type, HandlerBase]: ...
+ @staticmethod
+ def get_legend_handler(
+ legend_handler_map: dict[type, HandlerBase], orig_handle: Any
+ ) -> HandlerBase | None: ...
+ def get_children(self) -> list[Artist]: ...
+ def get_frame(self) -> Rectangle: ...
+ def get_lines(self) -> list[Line2D]: ...
+ def get_patches(self) -> list[Patch]: ...
+ def get_texts(self) -> list[Text]: ...
+ def set_alignment(self, alignment: Literal["center", "left", "right"]) -> None: ...
+ def get_alignment(self) -> Literal["center", "left", "right"]: ...
+ def set_loc(self, loc: str | tuple[float, float] | int | None = ...) -> None: ...
+ def set_title(
+ self, title: str, prop: FontProperties | str | pathlib.Path | None = ...
+ ) -> None: ...
+ def get_title(self) -> Text: ...
+ def get_frame_on(self) -> bool: ...
+ def set_frame_on(self, b: bool) -> None: ...
+ draw_frame = set_frame_on
+ def get_bbox_to_anchor(self) -> BboxBase: ...
+ def set_bbox_to_anchor(
+ self,
+ bbox: BboxBase
+ | tuple[float, float]
+ | tuple[float, float, float, float]
+ | None,
+ transform: Transform | None = ...
+ ) -> None: ...
+ @overload
+ def set_draggable(
+ self,
+ state: Literal[True],
+ use_blit: bool = ...,
+ update: Literal["loc", "bbox"] = ...,
+ ) -> DraggableLegend: ...
+ @overload
+ def set_draggable(
+ self,
+ state: Literal[False],
+ use_blit: bool = ...,
+ update: Literal["loc", "bbox"] = ...,
+ ) -> None: ...
+ def get_draggable(self) -> bool: ...
+ @property
+ def legendHandles(self) -> list[Artist | None]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi b/contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi
new file mode 100644
index 0000000000..db028a136a
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi
@@ -0,0 +1,294 @@
+from collections.abc import Callable, Sequence
+from matplotlib.artist import Artist
+from matplotlib.legend import Legend
+from matplotlib.offsetbox import OffsetBox
+from matplotlib.transforms import Transform
+
+from typing import TypeVar
+
+from numpy.typing import ArrayLike
+
+def update_from_first_child(tgt: Artist, src: Artist) -> None: ...
+
+class HandlerBase:
+ def __init__(
+ self,
+ xpad: float = ...,
+ ypad: float = ...,
+ update_func: Callable[[Artist, Artist], None] | None = ...,
+ ) -> None: ...
+ def update_prop(
+ self, legend_handle: Artist, orig_handle: Artist, legend: Legend
+ ) -> None: ...
+ def adjust_drawing_area(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ ) -> tuple[float, float, float, float]: ...
+ def legend_artist(
+ self, legend: Legend, orig_handle: Artist, fontsize: float, handlebox: OffsetBox
+ ) -> Artist: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerNpoints(HandlerBase):
+ def __init__(
+ self, marker_pad: float = ..., numpoints: int | None = ..., **kwargs
+ ) -> None: ...
+ def get_numpoints(self, legend: Legend) -> int | None: ...
+ def get_xdata(
+ self,
+ legend: Legend,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ ) -> tuple[ArrayLike, ArrayLike]: ...
+
+class HandlerNpointsYoffsets(HandlerNpoints):
+ def __init__(
+ self,
+ numpoints: int | None = ...,
+ yoffsets: Sequence[float] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_ydata(
+ self,
+ legend: Legend,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ ) -> ArrayLike: ...
+
+class HandlerLine2DCompound(HandlerNpoints):
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerLine2D(HandlerNpoints):
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerPatch(HandlerBase):
+ def __init__(self, patch_func: Callable | None = ..., **kwargs) -> None: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerStepPatch(HandlerBase):
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerLineCollection(HandlerLine2D):
+ def get_numpoints(self, legend: Legend) -> int: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+_T = TypeVar("_T", bound=Artist)
+
+class HandlerRegularPolyCollection(HandlerNpointsYoffsets):
+ def __init__(
+ self,
+ yoffsets: Sequence[float] | None = ...,
+ sizes: Sequence[float] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_numpoints(self, legend: Legend) -> int: ...
+ def get_sizes(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ ) -> Sequence[float]: ...
+ def update_prop(
+ self, legend_handle, orig_handle: Artist, legend: Legend
+ ) -> None: ...
+ def create_collection(
+ self,
+ orig_handle: _T,
+ sizes: Sequence[float] | None,
+ offsets: Sequence[float] | None,
+ offset_transform: Transform,
+ ) -> _T: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerPathCollection(HandlerRegularPolyCollection):
+ def create_collection(
+ self,
+ orig_handle: _T,
+ sizes: Sequence[float] | None,
+ offsets: Sequence[float] | None,
+ offset_transform: Transform,
+ ) -> _T: ...
+
+class HandlerCircleCollection(HandlerRegularPolyCollection):
+ def create_collection(
+ self,
+ orig_handle: _T,
+ sizes: Sequence[float] | None,
+ offsets: Sequence[float] | None,
+ offset_transform: Transform,
+ ) -> _T: ...
+
+class HandlerErrorbar(HandlerLine2D):
+ def __init__(
+ self,
+ xerr_size: float = ...,
+ yerr_size: float | None = ...,
+ marker_pad: float = ...,
+ numpoints: int | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_err_size(
+ self,
+ legend: Legend,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ ) -> tuple[float, float]: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerStem(HandlerNpointsYoffsets):
+ def __init__(
+ self,
+ marker_pad: float = ...,
+ numpoints: int | None = ...,
+ bottom: float | None = ...,
+ yoffsets: Sequence[float] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def get_ydata(
+ self,
+ legend: Legend,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ ) -> ArrayLike: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerTuple(HandlerBase):
+ def __init__(
+ self, ndivide: int | None = ..., pad: float | None = ..., **kwargs
+ ) -> None: ...
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
+
+class HandlerPolyCollection(HandlerBase):
+ def create_artists(
+ self,
+ legend: Legend,
+ orig_handle: Artist,
+ xdescent: float,
+ ydescent: float,
+ width: float,
+ height: float,
+ fontsize: float,
+ trans: Transform,
+ ) -> Sequence[Artist]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/lines.pyi b/contrib/python/matplotlib/py3/matplotlib/lines.pyi
new file mode 100644
index 0000000000..c91e457e33
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/lines.pyi
@@ -0,0 +1,153 @@
+from .artist import Artist
+from .axes import Axes
+from .backend_bases import MouseEvent, FigureCanvasBase
+from .path import Path
+from .transforms import Bbox, Transform
+
+from collections.abc import Callable, Sequence
+from typing import Any, Literal, overload
+from .typing import (
+ ColorType,
+ DrawStyleType,
+ FillStyleType,
+ LineStyleType,
+ CapStyleType,
+ JoinStyleType,
+ MarkEveryType,
+ MarkerType,
+)
+from numpy.typing import ArrayLike
+
+def segment_hits(
+ cx: ArrayLike, cy: ArrayLike, x: ArrayLike, y: ArrayLike, radius: ArrayLike
+) -> ArrayLike: ...
+
+class Line2D(Artist):
+ lineStyles: dict[str, str]
+ drawStyles: dict[str, str]
+ drawStyleKeys: list[str]
+ markers: dict[str | int, str]
+ filled_markers: tuple[str, ...]
+ fillStyles: tuple[str, ...]
+ zorder: float
+ ind_offset: float
+ def __init__(
+ self,
+ xdata: ArrayLike,
+ ydata: ArrayLike,
+ *,
+ linewidth: float | None = ...,
+ linestyle: LineStyleType | None = ...,
+ color: ColorType | None = ...,
+ gapcolor: ColorType | None = ...,
+ marker: MarkerType | None = ...,
+ markersize: float | None = ...,
+ markeredgewidth: float | None = ...,
+ markeredgecolor: ColorType | None = ...,
+ markerfacecolor: ColorType | None = ...,
+ markerfacecoloralt: ColorType = ...,
+ fillstyle: FillStyleType | None = ...,
+ antialiased: bool | None = ...,
+ dash_capstyle: CapStyleType | None = ...,
+ solid_capstyle: CapStyleType | None = ...,
+ dash_joinstyle: JoinStyleType | None = ...,
+ solid_joinstyle: JoinStyleType | None = ...,
+ pickradius: float = ...,
+ drawstyle: DrawStyleType | None = ...,
+ markevery: MarkEveryType | None = ...,
+ **kwargs
+ ) -> None: ...
+ def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict]: ...
+ def get_pickradius(self) -> float: ...
+ def set_pickradius(self, pickradius: float) -> None: ...
+ pickradius: float
+ def get_fillstyle(self) -> FillStyleType: ...
+ stale: bool
+ def set_fillstyle(self, fs: FillStyleType) -> None: ...
+ def set_markevery(self, every: MarkEveryType) -> None: ...
+ def get_markevery(self) -> MarkEveryType: ...
+ def set_picker(
+ self, p: None | bool | float | Callable[[Artist, MouseEvent], tuple[bool, dict]]
+ ) -> None: ...
+ def get_bbox(self) -> Bbox: ...
+ @overload
+ def set_data(self, args: ArrayLike) -> None: ...
+ @overload
+ def set_data(self, x: ArrayLike, y: ArrayLike) -> None: ...
+ def recache_always(self) -> None: ...
+ def recache(self, always: bool = ...) -> None: ...
+ def get_antialiased(self) -> bool: ...
+ def get_color(self) -> ColorType: ...
+ def get_drawstyle(self) -> DrawStyleType: ...
+ def get_gapcolor(self) -> ColorType: ...
+ def get_linestyle(self) -> LineStyleType: ...
+ def get_linewidth(self) -> float: ...
+ def get_marker(self) -> MarkerType: ...
+ def get_markeredgecolor(self) -> ColorType: ...
+ def get_markeredgewidth(self) -> float: ...
+ def get_markerfacecolor(self) -> ColorType: ...
+ def get_markerfacecoloralt(self) -> ColorType: ...
+ def get_markersize(self) -> float: ...
+ def get_data(self, orig: bool = ...) -> tuple[ArrayLike, ArrayLike]: ...
+ def get_xdata(self, orig: bool = ...) -> ArrayLike: ...
+ def get_ydata(self, orig: bool = ...) -> ArrayLike: ...
+ def get_path(self) -> Path: ...
+ def get_xydata(self) -> ArrayLike: ...
+ def set_antialiased(self, b: bool) -> None: ...
+ def set_color(self, color: ColorType) -> None: ...
+ def set_drawstyle(self, drawstyle: DrawStyleType | None) -> None: ...
+ def set_gapcolor(self, gapcolor: ColorType | None) -> None: ...
+ def set_linewidth(self, w: float) -> None: ...
+ def set_linestyle(self, ls: LineStyleType) -> None: ...
+ def set_marker(self, marker: MarkerType) -> None: ...
+ def set_markeredgecolor(self, ec: ColorType | None) -> None: ...
+ def set_markerfacecolor(self, fc: ColorType | None) -> None: ...
+ def set_markerfacecoloralt(self, fc: ColorType | None) -> None: ...
+ def set_markeredgewidth(self, ew: float | None) -> None: ...
+ def set_markersize(self, sz: float) -> None: ...
+ def set_xdata(self, x: ArrayLike) -> None: ...
+ def set_ydata(self, y: ArrayLike) -> None: ...
+ def set_dashes(self, seq: Sequence[float] | tuple[None, None]) -> None: ...
+ def update_from(self, other: Artist) -> None: ...
+ def set_dash_joinstyle(self, s: JoinStyleType) -> None: ...
+ def set_solid_joinstyle(self, s: JoinStyleType) -> None: ...
+ def get_dash_joinstyle(self) -> Literal["miter", "round", "bevel"]: ...
+ def get_solid_joinstyle(self) -> Literal["miter", "round", "bevel"]: ...
+ def set_dash_capstyle(self, s: CapStyleType) -> None: ...
+ def set_solid_capstyle(self, s: CapStyleType) -> None: ...
+ def get_dash_capstyle(self) -> Literal["butt", "projecting", "round"]: ...
+ def get_solid_capstyle(self) -> Literal["butt", "projecting", "round"]: ...
+ def is_dashed(self) -> bool: ...
+
+class AxLine(Line2D):
+ def __init__(
+ self,
+ xy1: tuple[float, float],
+ xy2: tuple[float, float] | None,
+ slope: float | None,
+ **kwargs
+ ) -> None: ...
+ def get_xy1(self) -> tuple[float, float] | None: ...
+ def get_xy2(self) -> tuple[float, float] | None: ...
+ def get_slope(self) -> float: ...
+ def set_xy1(self, x: float, y: float) -> None: ...
+ def set_xy2(self, x: float, y: float) -> None: ...
+ def set_slope(self, slope: float) -> None: ...
+
+class VertexSelector:
+ axes: Axes
+ line: Line2D
+ cid: int
+ ind: set[int]
+ def __init__(self, line: Line2D) -> None: ...
+ @property
+ def canvas(self) -> FigureCanvasBase: ...
+ def process_selected(
+ self, ind: Sequence[int], xs: ArrayLike, ys: ArrayLike
+ ) -> None: ...
+ def onpick(self, event: Any) -> None: ...
+
+lineStyles: dict[str, str]
+lineMarkers: dict[str | int, str]
+drawStyles: dict[str, str]
+fillStyles: tuple[FillStyleType, ...]
diff --git a/contrib/python/matplotlib/py3/matplotlib/markers.pyi b/contrib/python/matplotlib/py3/matplotlib/markers.pyi
new file mode 100644
index 0000000000..3ee5388385
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/markers.pyi
@@ -0,0 +1,51 @@
+from typing import Literal
+
+from .path import Path
+from .transforms import Affine2D, Transform
+
+from numpy.typing import ArrayLike
+from .typing import CapStyleType, FillStyleType, JoinStyleType
+
+TICKLEFT: int
+TICKRIGHT: int
+TICKUP: int
+TICKDOWN: int
+CARETLEFT: int
+CARETRIGHT: int
+CARETUP: int
+CARETDOWN: int
+CARETLEFTBASE: int
+CARETRIGHTBASE: int
+CARETUPBASE: int
+CARETDOWNBASE: int
+
+class MarkerStyle:
+ markers: dict[str | int, str]
+ filled_markers: tuple[str, ...]
+ fillstyles: tuple[FillStyleType, ...]
+
+ def __init__(
+ self,
+ marker: str | ArrayLike | Path | MarkerStyle | None,
+ fillstyle: FillStyleType | None = ...,
+ transform: Transform | None = ...,
+ capstyle: CapStyleType | None = ...,
+ joinstyle: JoinStyleType | None = ...,
+ ) -> None: ...
+ def __bool__(self) -> bool: ...
+ def is_filled(self) -> bool: ...
+ def get_fillstyle(self) -> FillStyleType: ...
+ def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ...
+ def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ...
+ def get_marker(self) -> str | ArrayLike | Path | None: ...
+ def get_path(self) -> Path: ...
+ def get_transform(self) -> Transform: ...
+ def get_alt_path(self) -> Path | None: ...
+ def get_alt_transform(self) -> Transform: ...
+ def get_snap_threshold(self) -> float | None: ...
+ def get_user_transform(self) -> Transform | None: ...
+ def transformed(self, transform: Affine2D) -> MarkerStyle: ...
+ def rotated(
+ self, *, deg: float | None = ..., rad: float | None = ...
+ ) -> MarkerStyle: ...
+ def scaled(self, sx: float, sy: float | None = ...) -> MarkerStyle: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/mathtext.pyi b/contrib/python/matplotlib/py3/matplotlib/mathtext.pyi
new file mode 100644
index 0000000000..607501a275
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/mathtext.pyi
@@ -0,0 +1,33 @@
+import os
+from typing import Generic, IO, Literal, TypeVar, overload
+
+from matplotlib.font_manager import FontProperties
+from matplotlib.typing import ColorType
+
+# Re-exported API from _mathtext.
+from ._mathtext import (
+ RasterParse as RasterParse,
+ VectorParse as VectorParse,
+ get_unicode_index as get_unicode_index,
+)
+
+_ParseType = TypeVar("_ParseType", RasterParse, VectorParse)
+
+class MathTextParser(Generic[_ParseType]):
+ @overload
+ def __init__(self: MathTextParser[VectorParse], output: Literal["path"]) -> None: ...
+ @overload
+ def __init__(self: MathTextParser[RasterParse], output: Literal["agg", "raster", "macosx"]) -> None: ...
+ def parse(
+ self, s: str, dpi: float = ..., prop: FontProperties | None = ..., *, antialiased: bool | None = ...
+ ) -> _ParseType: ...
+
+def math_to_image(
+ s: str,
+ filename_or_obj: str | os.PathLike | IO,
+ prop: FontProperties | None = ...,
+ dpi: float | None = ...,
+ format: str | None = ...,
+ *,
+ color: ColorType | None = ...
+) -> float: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/mlab.pyi b/contrib/python/matplotlib/py3/matplotlib/mlab.pyi
new file mode 100644
index 0000000000..1f23288dd1
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/mlab.pyi
@@ -0,0 +1,100 @@
+from collections.abc import Callable
+import functools
+from typing import Literal
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+def window_hanning(x: ArrayLike) -> ArrayLike: ...
+def window_none(x: ArrayLike) -> ArrayLike: ...
+def detrend(
+ x: ArrayLike,
+ key: Literal["default", "constant", "mean", "linear", "none"]
+ | Callable[[ArrayLike, int | None], ArrayLike]
+ | None = ...,
+ axis: int | None = ...,
+) -> ArrayLike: ...
+def detrend_mean(x: ArrayLike, axis: int | None = ...) -> ArrayLike: ...
+def detrend_none(x: ArrayLike, axis: int | None = ...) -> ArrayLike: ...
+def detrend_linear(y: ArrayLike) -> ArrayLike: ...
+def psd(
+ x: ArrayLike,
+ NFFT: int | None = ...,
+ Fs: float | None = ...,
+ detrend: Literal["none", "mean", "linear"]
+ | Callable[[ArrayLike, int | None], ArrayLike]
+ | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ noverlap: int | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale_by_freq: bool | None = ...,
+) -> tuple[ArrayLike, ArrayLike]: ...
+def csd(
+ x: ArrayLike,
+ y: ArrayLike | None,
+ NFFT: int | None = ...,
+ Fs: float | None = ...,
+ detrend: Literal["none", "mean", "linear"]
+ | Callable[[ArrayLike, int | None], ArrayLike]
+ | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ noverlap: int | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale_by_freq: bool | None = ...,
+) -> tuple[ArrayLike, ArrayLike]: ...
+
+complex_spectrum = functools.partial(tuple[ArrayLike, ArrayLike])
+magnitude_spectrum = functools.partial(tuple[ArrayLike, ArrayLike])
+angle_spectrum = functools.partial(tuple[ArrayLike, ArrayLike])
+phase_spectrum = functools.partial(tuple[ArrayLike, ArrayLike])
+
+def specgram(
+ x: ArrayLike,
+ NFFT: int | None = ...,
+ Fs: float | None = ...,
+ detrend: Literal["none", "mean", "linear"] | Callable[[ArrayLike, int | None], ArrayLike] | None = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
+ noverlap: int | None = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] | None = ...,
+ scale_by_freq: bool | None = ...,
+ mode: Literal["psd", "complex", "magnitude", "angle", "phase"] | None = ...,
+) -> tuple[ArrayLike, ArrayLike, ArrayLike]: ...
+def cohere(
+ x: ArrayLike,
+ y: ArrayLike,
+ NFFT: int = ...,
+ Fs: float = ...,
+ detrend: Literal["none", "mean", "linear"] | Callable[[ArrayLike, int | None], ArrayLike] = ...,
+ window: Callable[[ArrayLike], ArrayLike] | ArrayLike = ...,
+ noverlap: int = ...,
+ pad_to: int | None = ...,
+ sides: Literal["default", "onesided", "twosided"] = ...,
+ scale_by_freq: bool | None = ...,
+) -> tuple[ArrayLike, ArrayLike]: ...
+
+class GaussianKDE:
+ dataset: ArrayLike
+ dim: int
+ num_dp: int
+ factor: float
+ data_covariance: ArrayLike
+ data_inv_cov: ArrayLike
+ covariance: ArrayLike
+ inv_cov: ArrayLike
+ norm_factor: float
+ def __init__(
+ self,
+ dataset: ArrayLike,
+ bw_method: Literal["scott", "silverman"]
+ | float
+ | Callable[[GaussianKDE], float]
+ | None = ...,
+ ) -> None: ...
+ def scotts_factor(self) -> float: ...
+ def silverman_factor(self) -> float: ...
+ def covariance_factor(self) -> float: ...
+ def evaluate(self, points: ArrayLike) -> np.ndarray: ...
+ def __call__(self, points: ArrayLike) -> np.ndarray: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi b/contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi
new file mode 100644
index 0000000000..fdd6ce287f
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi
@@ -0,0 +1,321 @@
+import matplotlib.artist as martist
+from matplotlib.backend_bases import RendererBase, Event, FigureCanvasBase
+from matplotlib.colors import Colormap, Normalize
+import matplotlib.text as mtext
+from matplotlib.figure import Figure
+from matplotlib.font_manager import FontProperties
+from matplotlib.image import BboxImage
+from matplotlib.patches import FancyArrowPatch, FancyBboxPatch
+from matplotlib.transforms import Bbox, BboxBase, Transform
+
+import numpy as np
+from numpy.typing import ArrayLike
+from collections.abc import Callable, Sequence
+from typing import Any, Literal, overload
+
+DEBUG: bool
+
+def bbox_artist(*args, **kwargs) -> None: ...
+def _get_packed_offsets(
+ widths: Sequence[float],
+ total: float | None,
+ sep: float | None,
+ mode: Literal["fixed", "expand", "equal"] = ...,
+) -> tuple[float, np.ndarray]: ...
+
+class OffsetBox(martist.Artist):
+ width: float | None
+ height: float | None
+ def __init__(self, *args, **kwargs) -> None: ...
+ def set_figure(self, fig: Figure) -> None: ...
+ def set_offset(
+ self,
+ xy: tuple[float, float]
+ | Callable[[float, float, float, float, RendererBase], tuple[float, float]],
+ ) -> None: ...
+
+ @overload
+ def get_offset(self, bbox: Bbox, renderer: RendererBase) -> tuple[float, float]: ...
+ @overload
+ def get_offset(
+ self,
+ width: float,
+ height: float,
+ xdescent: float,
+ ydescent: float,
+ renderer: RendererBase
+ ) -> tuple[float, float]: ...
+
+ def set_width(self, width: float) -> None: ...
+ def set_height(self, height: float) -> None: ...
+ def get_visible_children(self) -> list[martist.Artist]: ...
+ def get_children(self) -> list[martist.Artist]: ...
+ def get_bbox(self, renderer: RendererBase) -> Bbox: ...
+ def get_extent_offsets(
+ self, renderer: RendererBase
+ ) -> tuple[float, float, float, float, list[tuple[float, float]]]: ...
+ def get_extent(
+ self, renderer: RendererBase
+ ) -> tuple[float, float, float, float]: ...
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
+
+class PackerBase(OffsetBox):
+ height: float | None
+ width: float | None
+ sep: float | None
+ pad: float | None
+ mode: Literal["fixed", "expand", "equal"]
+ align: Literal["top", "bottom", "left", "right", "center", "baseline"]
+ def __init__(
+ self,
+ pad: float | None = ...,
+ sep: float | None = ...,
+ width: float | None = ...,
+ height: float | None = ...,
+ align: Literal["top", "bottom", "left", "right", "center", "baseline"] = ...,
+ mode: Literal["fixed", "expand", "equal"] = ...,
+ children: list[martist.Artist] | None = ...,
+ ) -> None: ...
+
+class VPacker(PackerBase): ...
+class HPacker(PackerBase): ...
+
+class PaddedBox(OffsetBox):
+ pad: float | None
+ patch: FancyBboxPatch
+ def __init__(
+ self,
+ child: martist.Artist,
+ pad: float | None = ...,
+ *,
+ draw_frame: bool = ...,
+ patch_attrs: dict[str, Any] | None = ...,
+ ) -> None: ...
+ def update_frame(self, bbox: Bbox, fontsize: float | None = ...) -> None: ...
+ def draw_frame(self, renderer: RendererBase) -> None: ...
+
+class DrawingArea(OffsetBox):
+ width: float
+ height: float
+ xdescent: float
+ ydescent: float
+ offset_transform: Transform
+ dpi_transform: Transform
+ def __init__(
+ self,
+ width: float,
+ height: float,
+ xdescent: float = ...,
+ ydescent: float = ...,
+ clip: bool = ...,
+ ) -> None: ...
+ @property
+ def clip_children(self) -> bool: ...
+ @clip_children.setter
+ def clip_children(self, val: bool) -> None: ...
+ def get_transform(self) -> Transform: ...
+
+ # does not accept all options of superclass
+ def set_offset(self, xy: tuple[float, float]) -> None: ... # type: ignore[override]
+ def get_offset(self) -> tuple[float, float]: ... # type: ignore[override]
+ def add_artist(self, a: martist.Artist) -> None: ...
+
+class TextArea(OffsetBox):
+ offset_transform: Transform
+ def __init__(
+ self,
+ s: str,
+ *,
+ textprops: dict[str, Any] | None = ...,
+ multilinebaseline: bool = ...,
+ ) -> None: ...
+ def set_text(self, s: str) -> None: ...
+ def get_text(self) -> str: ...
+ def set_multilinebaseline(self, t: bool) -> None: ...
+ def get_multilinebaseline(self) -> bool: ...
+
+ # does not accept all options of superclass
+ def set_offset(self, xy: tuple[float, float]) -> None: ... # type: ignore[override]
+ def get_offset(self) -> tuple[float, float]: ... # type: ignore[override]
+
+class AuxTransformBox(OffsetBox):
+ aux_transform: Transform
+ offset_transform: Transform
+ ref_offset_transform: Transform
+ def __init__(self, aux_transform: Transform) -> None: ...
+ def add_artist(self, a: martist.Artist) -> None: ...
+ def get_transform(self) -> Transform: ...
+
+ # does not accept all options of superclass
+ def set_offset(self, xy: tuple[float, float]) -> None: ... # type: ignore[override]
+ def get_offset(self) -> tuple[float, float]: ... # type: ignore[override]
+
+class AnchoredOffsetbox(OffsetBox):
+ zorder: float
+ codes: dict[str, int]
+ loc: int
+ borderpad: float
+ pad: float
+ prop: FontProperties
+ patch: FancyBboxPatch
+ def __init__(
+ self,
+ loc: str,
+ *,
+ pad: float = ...,
+ borderpad: float = ...,
+ child: OffsetBox | None = ...,
+ prop: FontProperties | None = ...,
+ frameon: bool = ...,
+ bbox_to_anchor: BboxBase
+ | tuple[float, float]
+ | tuple[float, float, float, float]
+ | None = ...,
+ bbox_transform: Transform | None = ...,
+ **kwargs
+ ) -> None: ...
+ def set_child(self, child: OffsetBox | None) -> None: ...
+ def get_child(self) -> OffsetBox | None: ...
+ def get_children(self) -> list[martist.Artist]: ...
+ def get_bbox_to_anchor(self) -> Bbox: ...
+ def set_bbox_to_anchor(
+ self, bbox: BboxBase, transform: Transform | None = ...
+ ) -> None: ...
+ def update_frame(self, bbox: Bbox, fontsize: float | None = ...) -> None: ...
+
+class AnchoredText(AnchoredOffsetbox):
+ txt: TextArea
+ def __init__(
+ self,
+ s: str,
+ loc: str,
+ *,
+ pad: float = ...,
+ borderpad: float = ...,
+ prop: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> None: ...
+
+class OffsetImage(OffsetBox):
+ image: BboxImage
+ def __init__(
+ self,
+ arr: ArrayLike,
+ *,
+ zoom: float = ...,
+ cmap: Colormap | str | None = ...,
+ norm: Normalize | str | None = ...,
+ interpolation: str | None = ...,
+ origin: Literal["upper", "lower"] | None = ...,
+ filternorm: bool = ...,
+ filterrad: float = ...,
+ resample: bool = ...,
+ dpi_cor: bool = ...,
+ **kwargs
+ ) -> None: ...
+ stale: bool
+ def set_data(self, arr: ArrayLike | None) -> None: ...
+ def get_data(self) -> ArrayLike | None: ...
+ def set_zoom(self, zoom: float) -> None: ...
+ def get_zoom(self) -> float: ...
+ def get_children(self) -> list[martist.Artist]: ...
+ def get_offset(self) -> tuple[float, float]: ... # type: ignore[override]
+
+class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
+ zorder: float
+ offsetbox: OffsetBox
+ arrowprops: dict[str, Any] | None
+ xybox: tuple[float, float]
+ boxcoords: str | tuple[str, str] | martist.Artist | Transform | Callable[
+ [RendererBase], Bbox | Transform
+ ]
+ arrow_patch: FancyArrowPatch | None
+ patch: FancyBboxPatch
+ prop: FontProperties
+ def __init__(
+ self,
+ offsetbox: OffsetBox,
+ xy: tuple[float, float],
+ xybox: tuple[float, float] | None = ...,
+ xycoords: str
+ | tuple[str, str]
+ | martist.Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform] = ...,
+ boxcoords: str
+ | tuple[str, str]
+ | martist.Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform]
+ | None = ...,
+ *,
+ frameon: bool = ...,
+ pad: float = ...,
+ annotation_clip: bool | None = ...,
+ box_alignment: tuple[float, float] = ...,
+ bboxprops: dict[str, Any] | None = ...,
+ arrowprops: dict[str, Any] | None = ...,
+ fontsize: float | str | None = ...,
+ **kwargs
+ ) -> None: ...
+ @property
+ def xyann(self) -> tuple[float, float]: ...
+ @xyann.setter
+ def xyann(self, xyann: tuple[float, float]) -> None: ...
+ @property
+ def anncoords(
+ self,
+ ) -> str | tuple[str, str] | martist.Artist | Transform | Callable[
+ [RendererBase], Bbox | Transform
+ ]: ...
+ @anncoords.setter
+ def anncoords(
+ self,
+ coords: str
+ | tuple[str, str]
+ | martist.Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform],
+ ) -> None: ...
+ def get_children(self) -> list[martist.Artist]: ...
+ def set_figure(self, fig: Figure) -> None: ...
+ def set_fontsize(self, s: str | float | None = ...) -> None: ...
+ def get_fontsize(self) -> float: ...
+ def get_tightbbox(self, renderer: RendererBase | None = ...) -> Bbox: ...
+ def update_positions(self, renderer: RendererBase) -> None: ...
+
+class DraggableBase:
+ ref_artist: martist.Artist
+ got_artist: bool
+ mouse_x: int
+ mouse_y: int
+ background: Any
+
+ @property
+ def canvas(self) -> FigureCanvasBase: ...
+ @property
+ def cids(self) -> list[int]: ...
+
+ def __init__(self, ref_artist: martist.Artist, use_blit: bool = ...) -> None: ...
+ def on_motion(self, evt: Event) -> None: ...
+ def on_pick(self, evt: Event) -> None: ...
+ def on_release(self, event: Event) -> None: ...
+ def disconnect(self) -> None: ...
+ def save_offset(self) -> None: ...
+ def update_offset(self, dx: float, dy: float) -> None: ...
+ def finalize_offset(self) -> None: ...
+
+class DraggableOffsetBox(DraggableBase):
+ offsetbox: OffsetBox
+ def __init__(
+ self, ref_artist: martist.Artist, offsetbox: OffsetBox, use_blit: bool = ...
+ ) -> None: ...
+ def save_offset(self) -> None: ...
+ def update_offset(self, dx: float, dy: float) -> None: ...
+ def get_loc_in_canvas(self) -> tuple[float, float]: ...
+
+class DraggableAnnotation(DraggableBase):
+ annotation: mtext.Annotation
+ def __init__(self, annotation: mtext.Annotation, use_blit: bool = ...) -> None: ...
+ def save_offset(self) -> None: ...
+ def update_offset(self, dx: float, dy: float) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/patches.pyi b/contrib/python/matplotlib/py3/matplotlib/patches.pyi
new file mode 100644
index 0000000000..29fe36aa6c
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/patches.pyi
@@ -0,0 +1,751 @@
+from . import artist
+from .axes import Axes
+from .backend_bases import RendererBase, MouseEvent
+from .path import Path
+from .transforms import Transform, Bbox
+
+from typing import Any, Literal, overload
+
+import numpy as np
+from numpy.typing import ArrayLike
+from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType
+
+class Patch(artist.Artist):
+ zorder: float
+ def __init__(
+ self,
+ *,
+ edgecolor: ColorType | None = ...,
+ facecolor: ColorType | None = ...,
+ color: ColorType | None = ...,
+ linewidth: float | None = ...,
+ linestyle: LineStyleType | None = ...,
+ antialiased: bool | None = ...,
+ hatch: str | None = ...,
+ fill: bool = ...,
+ capstyle: CapStyleType | None = ...,
+ joinstyle: JoinStyleType | None = ...,
+ **kwargs,
+ ) -> None: ...
+ def get_verts(self) -> ArrayLike: ...
+ def contains(self, mouseevent: MouseEvent, radius: float | None = None) -> tuple[bool, dict[Any, Any]]: ...
+ def contains_point(
+ self, point: tuple[float, float], radius: float | None = ...
+ ) -> bool: ...
+ def contains_points(
+ self, points: ArrayLike, radius: float | None = ...
+ ) -> np.ndarray: ...
+ def get_extents(self) -> Bbox: ...
+ def get_transform(self) -> Transform: ...
+ def get_data_transform(self) -> Transform: ...
+ def get_patch_transform(self) -> Transform: ...
+ def get_antialiased(self) -> bool: ...
+ def get_edgecolor(self) -> ColorType: ...
+ def get_facecolor(self) -> ColorType: ...
+ def get_linewidth(self) -> float: ...
+ def get_linestyle(self) -> LineStyleType: ...
+ def set_antialiased(self, aa: bool | None) -> None: ...
+ def set_edgecolor(self, color: ColorType | None) -> None: ...
+ def set_facecolor(self, color: ColorType | None) -> None: ...
+ def set_color(self, c: ColorType | None) -> None: ...
+ def set_alpha(self, alpha: float | None) -> None: ...
+ def set_linewidth(self, w: float | None) -> None: ...
+ def set_linestyle(self, ls: LineStyleType | None) -> None: ...
+ def set_fill(self, b: bool) -> None: ...
+ def get_fill(self) -> bool: ...
+ fill = property(get_fill, set_fill)
+ def set_capstyle(self, s: CapStyleType) -> None: ...
+ def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ...
+ def set_joinstyle(self, s: JoinStyleType) -> None: ...
+ def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ...
+ def set_hatch(self, hatch: str) -> None: ...
+ def get_hatch(self) -> str: ...
+ def get_path(self) -> Path: ...
+
+class Shadow(Patch):
+ patch: Patch
+ def __init__(self, patch: Patch, ox: float, oy: float, *, shade: float = ..., **kwargs) -> None: ...
+
+class Rectangle(Patch):
+ angle: float
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ width: float,
+ height: float,
+ *,
+ angle: float = ...,
+ rotation_point: Literal["xy", "center"] | tuple[float, float] = ...,
+ **kwargs,
+ ) -> None: ...
+ @property
+ def rotation_point(self) -> Literal["xy", "center"] | tuple[float, float]: ...
+ @rotation_point.setter
+ def rotation_point(
+ self, value: Literal["xy", "center"] | tuple[float, float]
+ ) -> None: ...
+ def get_x(self) -> float: ...
+ def get_y(self) -> float: ...
+ def get_xy(self) -> tuple[float, float]: ...
+ def get_corners(self) -> np.ndarray: ...
+ def get_center(self) -> np.ndarray: ...
+ def get_width(self) -> float: ...
+ def get_height(self) -> float: ...
+ def get_angle(self) -> float: ...
+ def set_x(self, x: float) -> None: ...
+ def set_y(self, y: float) -> None: ...
+ def set_angle(self, angle: float) -> None: ...
+ def set_xy(self, xy: tuple[float, float]) -> None: ...
+ def set_width(self, w: float) -> None: ...
+ def set_height(self, h: float) -> None: ...
+ @overload
+ def set_bounds(self, args: tuple[float, float, float, float], /) -> None: ...
+ @overload
+ def set_bounds(
+ self, left: float, bottom: float, width: float, height: float, /
+ ) -> None: ...
+ def get_bbox(self) -> Bbox: ...
+ xy = property(get_xy, set_xy)
+
+class RegularPolygon(Patch):
+ xy: tuple[float, float]
+ numvertices: int
+ orientation: float
+ radius: float
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ numVertices: int,
+ *,
+ radius: float = ...,
+ orientation: float = ...,
+ **kwargs,
+ ) -> None: ...
+
+class PathPatch(Patch):
+ def __init__(self, path: Path, **kwargs) -> None: ...
+ def set_path(self, path: Path) -> None: ...
+
+class StepPatch(PathPatch):
+ orientation: Literal["vertical", "horizontal"]
+ def __init__(
+ self,
+ values: ArrayLike,
+ edges: ArrayLike,
+ *,
+ orientation: Literal["vertical", "horizontal"] = ...,
+ baseline: float = ...,
+ **kwargs,
+ ) -> None: ...
+
+ # NamedTuple StairData, defined in body of method
+ def get_data(self) -> tuple[np.ndarray, np.ndarray, float]: ...
+ def set_data(
+ self,
+ values: ArrayLike | None = ...,
+ edges: ArrayLike | None = ...,
+ baseline: float | None = ...,
+ ) -> None: ...
+
+class Polygon(Patch):
+ def __init__(self, xy: ArrayLike, *, closed: bool = ..., **kwargs) -> None: ...
+ def get_closed(self) -> bool: ...
+ def set_closed(self, closed: bool) -> None: ...
+ def get_xy(self) -> np.ndarray: ...
+ def set_xy(self, xy: ArrayLike) -> None: ...
+ xy = property(get_xy, set_xy)
+
+class Wedge(Patch):
+ center: tuple[float, float]
+ r: float
+ theta1: float
+ theta2: float
+ width: float | None
+ def __init__(
+ self,
+ center: tuple[float, float],
+ r: float,
+ theta1: float,
+ theta2: float,
+ *,
+ width: float | None = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_center(self, center: tuple[float, float]) -> None: ...
+ def set_radius(self, radius: float) -> None: ...
+ def set_theta1(self, theta1: float) -> None: ...
+ def set_theta2(self, theta2: float) -> None: ...
+ def set_width(self, width: float | None) -> None: ...
+
+class Arrow(Patch):
+ def __init__(
+ self, x: float, y: float, dx: float, dy: float, *, width: float = ..., **kwargs
+ ) -> None: ...
+
+class FancyArrow(Polygon):
+ def __init__(
+ self,
+ x: float,
+ y: float,
+ dx: float,
+ dy: float,
+ *,
+ width: float = ...,
+ length_includes_head: bool = ...,
+ head_width: float | None = ...,
+ head_length: float | None = ...,
+ shape: Literal["full", "left", "right"] = ...,
+ overhang: float = ...,
+ head_starts_at_zero: bool = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_data(
+ self,
+ *,
+ x: float | None = ...,
+ y: float | None = ...,
+ dx: float | None = ...,
+ dy: float | None = ...,
+ width: float | None = ...,
+ head_width: float | None = ...,
+ head_length: float | None = ...,
+ ) -> None: ...
+
+class CirclePolygon(RegularPolygon):
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ radius: float = ...,
+ *,
+ resolution: int = ...,
+ **kwargs,
+ ) -> None: ...
+
+class Ellipse(Patch):
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ width: float,
+ height: float,
+ *,
+ angle: float = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_center(self, xy: tuple[float, float]) -> None: ...
+ def get_center(self) -> float: ...
+ center = property(get_center, set_center)
+
+ def set_width(self, width: float) -> None: ...
+ def get_width(self) -> float: ...
+ width = property(get_width, set_width)
+
+ def set_height(self, height: float) -> None: ...
+ def get_height(self) -> float: ...
+ height = property(get_height, set_height)
+
+ def set_angle(self, angle: float) -> None: ...
+ def get_angle(self) -> float: ...
+ angle = property(get_angle, set_angle)
+
+ def get_corners(self) -> np.ndarray: ...
+
+ def get_vertices(self) -> list[tuple[float, float]]: ...
+ def get_co_vertices(self) -> list[tuple[float, float]]: ...
+
+
+class Annulus(Patch):
+ a: float
+ b: float
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ r: float | tuple[float, float],
+ width: float,
+ angle: float = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_center(self, xy: tuple[float, float]) -> None: ...
+ def get_center(self) -> tuple[float, float]: ...
+ center = property(get_center, set_center)
+
+ def set_width(self, width: float) -> None: ...
+ def get_width(self) -> float: ...
+ width = property(get_width, set_width)
+
+ def set_angle(self, angle: float) -> None: ...
+ def get_angle(self) -> float: ...
+ angle = property(get_angle, set_angle)
+
+ def set_semimajor(self, a: float) -> None: ...
+ def set_semiminor(self, b: float) -> None: ...
+ def set_radii(self, r: float | tuple[float, float]) -> None: ...
+ def get_radii(self) -> tuple[float, float]: ...
+ radii = property(get_radii, set_radii)
+
+class Circle(Ellipse):
+ def __init__(
+ self, xy: tuple[float, float], radius: float = ..., **kwargs
+ ) -> None: ...
+ def set_radius(self, radius: float) -> None: ...
+ def get_radius(self) -> float: ...
+ radius = property(get_radius, set_radius)
+
+class Arc(Ellipse):
+ theta1: float
+ theta2: float
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ width: float,
+ height: float,
+ *,
+ angle: float = ...,
+ theta1: float = ...,
+ theta2: float = ...,
+ **kwargs,
+ ) -> None: ...
+
+def bbox_artist(
+ artist: artist.Artist,
+ renderer: RendererBase,
+ props: dict[str, Any] | None = ...,
+ fill: bool = ...,
+) -> None: ...
+def draw_bbox(
+ bbox: Bbox,
+ renderer: RendererBase,
+ color: ColorType = ...,
+ trans: Transform | None = ...,
+) -> None: ...
+
+class _Style:
+ def __new__(cls, stylename, **kwargs): ...
+ @classmethod
+ def get_styles(cls) -> dict[str, type]: ...
+ @classmethod
+ def pprint_styles(cls) -> str: ...
+ @classmethod
+ def register(cls, name: str, style: type) -> None: ...
+
+class BoxStyle(_Style):
+ class Square(BoxStyle):
+ pad: float
+ def __init__(self, pad: float = ...) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class Circle(BoxStyle):
+ pad: float
+ def __init__(self, pad: float = ...) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class Ellipse(BoxStyle):
+ pad: float
+ def __init__(self, pad: float = ...) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class LArrow(BoxStyle):
+ pad: float
+ def __init__(self, pad: float = ...) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class RArrow(LArrow):
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class DArrow(BoxStyle):
+ pad: float
+ def __init__(self, pad: float = ...) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class Round(BoxStyle):
+ pad: float
+ rounding_size: float | None
+ def __init__(
+ self, pad: float = ..., rounding_size: float | None = ...
+ ) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class Round4(BoxStyle):
+ pad: float
+ rounding_size: float | None
+ def __init__(
+ self, pad: float = ..., rounding_size: float | None = ...
+ ) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class Sawtooth(BoxStyle):
+ pad: float
+ tooth_size: float | None
+ def __init__(
+ self, pad: float = ..., tooth_size: float | None = ...
+ ) -> None: ...
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+ class Roundtooth(Sawtooth):
+ def __call__(
+ self,
+ x0: float,
+ y0: float,
+ width: float,
+ height: float,
+ mutation_size: float,
+ ) -> Path: ...
+
+class ConnectionStyle(_Style):
+ class _Base(ConnectionStyle):
+ class SimpleEvent:
+ def __init__(self, xy: tuple[float, float]) -> None: ...
+
+ def __call__(
+ self,
+ posA: tuple[float, float],
+ posB: tuple[float, float],
+ shrinkA: float = ...,
+ shrinkB: float = ...,
+ patchA: Patch | None = ...,
+ patchB: Patch | None = ...,
+ ) -> Path: ...
+
+ class Arc3(_Base):
+ rad: float
+ def __init__(self, rad: float = ...) -> None: ...
+ def connect(
+ self, posA: tuple[float, float], posB: tuple[float, float]
+ ) -> Path: ...
+
+ class Angle3(_Base):
+ angleA: float
+ angleB: float
+ def __init__(self, angleA: float = ..., angleB: float = ...) -> None: ...
+ def connect(
+ self, posA: tuple[float, float], posB: tuple[float, float]
+ ) -> Path: ...
+
+ class Angle(_Base):
+ angleA: float
+ angleB: float
+ rad: float
+ def __init__(
+ self, angleA: float = ..., angleB: float = ..., rad: float = ...
+ ) -> None: ...
+ def connect(
+ self, posA: tuple[float, float], posB: tuple[float, float]
+ ) -> Path: ...
+
+ class Arc(_Base):
+ angleA: float
+ angleB: float
+ armA: float | None
+ armB: float | None
+ rad: float
+ def __init__(
+ self,
+ angleA: float = ...,
+ angleB: float = ...,
+ armA: float | None = ...,
+ armB: float | None = ...,
+ rad: float = ...,
+ ) -> None: ...
+ def connect(
+ self, posA: tuple[float, float], posB: tuple[float, float]
+ ) -> Path: ...
+
+ class Bar(_Base):
+ armA: float
+ armB: float
+ fraction: float
+ angle: float | None
+ def __init__(
+ self,
+ armA: float = ...,
+ armB: float = ...,
+ fraction: float = ...,
+ angle: float | None = ...,
+ ) -> None: ...
+ def connect(
+ self, posA: tuple[float, float], posB: tuple[float, float]
+ ) -> Path: ...
+
+class ArrowStyle(_Style):
+ class _Base(ArrowStyle):
+ @staticmethod
+ def ensure_quadratic_bezier(path: Path) -> list[float]: ...
+ def transmute(
+ self, path: Path, mutation_size: float, linewidth: float
+ ) -> tuple[Path, bool]: ...
+ def __call__(
+ self,
+ path: Path,
+ mutation_size: float,
+ linewidth: float,
+ aspect_ratio: float = ...,
+ ) -> tuple[Path, bool]: ...
+
+ class _Curve(_Base):
+ arrow: str
+ fillbegin: bool
+ fillend: bool
+ def __init__(
+ self,
+ head_length: float = ...,
+ head_width: float = ...,
+ widthA: float = ...,
+ widthB: float = ...,
+ lengthA: float = ...,
+ lengthB: float = ...,
+ angleA: float | None = ...,
+ angleB: float | None = ...,
+ scaleA: float | None = ...,
+ scaleB: float | None = ...,
+ ) -> None: ...
+
+ class Curve(_Curve):
+ def __init__(self) -> None: ...
+
+ class CurveA(_Curve):
+ arrow: str
+
+ class CurveB(_Curve):
+ arrow: str
+
+ class CurveAB(_Curve):
+ arrow: str
+
+ class CurveFilledA(_Curve):
+ arrow: str
+
+ class CurveFilledB(_Curve):
+ arrow: str
+
+ class CurveFilledAB(_Curve):
+ arrow: str
+
+ class BracketA(_Curve):
+ arrow: str
+ def __init__(
+ self, widthA: float = ..., lengthA: float = ..., angleA: float = ...
+ ) -> None: ...
+
+ class BracketB(_Curve):
+ arrow: str
+ def __init__(
+ self, widthB: float = ..., lengthB: float = ..., angleB: float = ...
+ ) -> None: ...
+
+ class BracketAB(_Curve):
+ arrow: str
+ def __init__(
+ self,
+ widthA: float = ...,
+ lengthA: float = ...,
+ angleA: float = ...,
+ widthB: float = ...,
+ lengthB: float = ...,
+ angleB: float = ...,
+ ) -> None: ...
+
+ class BarAB(_Curve):
+ arrow: str
+ def __init__(
+ self,
+ widthA: float = ...,
+ angleA: float = ...,
+ widthB: float = ...,
+ angleB: float = ...,
+ ) -> None: ...
+
+ class BracketCurve(_Curve):
+ arrow: str
+ def __init__(
+ self, widthA: float = ..., lengthA: float = ..., angleA: float | None = ...
+ ) -> None: ...
+
+ class CurveBracket(_Curve):
+ arrow: str
+ def __init__(
+ self, widthB: float = ..., lengthB: float = ..., angleB: float | None = ...
+ ) -> None: ...
+
+ class Simple(_Base):
+ def __init__(
+ self,
+ head_length: float = ...,
+ head_width: float = ...,
+ tail_width: float = ...,
+ ) -> None: ...
+
+ class Fancy(_Base):
+ def __init__(
+ self,
+ head_length: float = ...,
+ head_width: float = ...,
+ tail_width: float = ...,
+ ) -> None: ...
+
+ class Wedge(_Base):
+ tail_width: float
+ shrink_factor: float
+ def __init__(
+ self, tail_width: float = ..., shrink_factor: float = ...
+ ) -> None: ...
+
+class FancyBboxPatch(Patch):
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ width: float,
+ height: float,
+ boxstyle: str | BoxStyle = ...,
+ *,
+ mutation_scale: float = ...,
+ mutation_aspect: float = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_boxstyle(self, boxstyle: str | BoxStyle | None = ..., **kwargs) -> None: ...
+ def get_boxstyle(self) -> BoxStyle: ...
+ def set_mutation_scale(self, scale: float) -> None: ...
+ def get_mutation_scale(self) -> float: ...
+ def set_mutation_aspect(self, aspect: float) -> None: ...
+ def get_mutation_aspect(self) -> float: ...
+ def get_x(self) -> float: ...
+ def get_y(self) -> float: ...
+ def get_width(self) -> float: ...
+ def get_height(self) -> float: ...
+ def set_x(self, x: float) -> None: ...
+ def set_y(self, y: float) -> None: ...
+ def set_width(self, w: float) -> None: ...
+ def set_height(self, h: float) -> None: ...
+ @overload
+ def set_bounds(self, args: tuple[float, float, float, float], /) -> None: ...
+ @overload
+ def set_bounds(
+ self, left: float, bottom: float, width: float, height: float, /
+ ) -> None: ...
+ def get_bbox(self) -> Bbox: ...
+
+class FancyArrowPatch(Patch):
+ patchA: Patch
+ patchB: Patch
+ shrinkA: float
+ shrinkB: float
+ def __init__(
+ self,
+ posA: tuple[float, float] | None = ...,
+ posB: tuple[float, float] | None = ...,
+ *,
+ path: Path | None = ...,
+ arrowstyle: str | ArrowStyle = ...,
+ connectionstyle: str | ConnectionStyle = ...,
+ patchA: Patch | None = ...,
+ patchB: Patch | None = ...,
+ shrinkA: float = ...,
+ shrinkB: float = ...,
+ mutation_scale: float = ...,
+ mutation_aspect: float | None = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_positions(
+ self, posA: tuple[float, float], posB: tuple[float, float]
+ ) -> None: ...
+ def set_patchA(self, patchA: Patch) -> None: ...
+ def set_patchB(self, patchB: Patch) -> None: ...
+ def set_connectionstyle(self, connectionstyle: str | ConnectionStyle | None = ..., **kwargs) -> None: ...
+ def get_connectionstyle(self) -> ConnectionStyle: ...
+ def set_arrowstyle(self, arrowstyle: str | ArrowStyle | None = ..., **kwargs) -> None: ...
+ def get_arrowstyle(self) -> ArrowStyle: ...
+ def set_mutation_scale(self, scale: float) -> None: ...
+ def get_mutation_scale(self) -> float: ...
+ def set_mutation_aspect(self, aspect: float | None) -> None: ...
+ def get_mutation_aspect(self) -> float: ...
+
+class ConnectionPatch(FancyArrowPatch):
+ xy1: tuple[float, float]
+ xy2: tuple[float, float]
+ coords1: str | Transform
+ coords2: str | Transform | None
+ axesA: Axes | None
+ axesB: Axes | None
+ def __init__(
+ self,
+ xyA: tuple[float, float],
+ xyB: tuple[float, float],
+ coordsA: str | Transform,
+ coordsB: str | Transform | None = ...,
+ *,
+ axesA: Axes | None = ...,
+ axesB: Axes | None = ...,
+ arrowstyle: str | ArrowStyle = ...,
+ connectionstyle: str | ConnectionStyle = ...,
+ patchA: Patch | None = ...,
+ patchB: Patch | None = ...,
+ shrinkA: float = ...,
+ shrinkB: float = ...,
+ mutation_scale: float = ...,
+ mutation_aspect: float | None = ...,
+ clip_on: bool = ...,
+ **kwargs,
+ ) -> None: ...
+ def set_annotation_clip(self, b: bool | None) -> None: ...
+ def get_annotation_clip(self) -> bool | None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/path.pyi b/contrib/python/matplotlib/py3/matplotlib/path.pyi
new file mode 100644
index 0000000000..464fc6d9a9
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/path.pyi
@@ -0,0 +1,140 @@
+from .bezier import BezierSegment
+from .transforms import Affine2D, Transform, Bbox
+from collections.abc import Generator, Iterable, Sequence
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+from typing import Any, overload
+
+class Path:
+ code_type: type[np.uint8]
+ STOP: np.uint8
+ MOVETO: np.uint8
+ LINETO: np.uint8
+ CURVE3: np.uint8
+ CURVE4: np.uint8
+ CLOSEPOLY: np.uint8
+ NUM_VERTICES_FOR_CODE: dict[np.uint8, int]
+
+ def __init__(
+ self,
+ vertices: ArrayLike,
+ codes: ArrayLike | None = ...,
+ _interpolation_steps: int = ...,
+ closed: bool = ...,
+ readonly: bool = ...,
+ ) -> None: ...
+ @property
+ def vertices(self) -> ArrayLike: ...
+ @vertices.setter
+ def vertices(self, vertices: ArrayLike) -> None: ...
+ @property
+ def codes(self) -> ArrayLike | None: ...
+ @codes.setter
+ def codes(self, codes: ArrayLike) -> None: ...
+ @property
+ def simplify_threshold(self) -> float: ...
+ @simplify_threshold.setter
+ def simplify_threshold(self, threshold: float) -> None: ...
+ @property
+ def should_simplify(self) -> bool: ...
+ @should_simplify.setter
+ def should_simplify(self, should_simplify: bool) -> None: ...
+ @property
+ def readonly(self) -> bool: ...
+ def copy(self) -> Path: ...
+ def __deepcopy__(self, memo: dict[int, Any] | None = ...) -> Path: ...
+ deepcopy = __deepcopy__
+
+ @classmethod
+ def make_compound_path_from_polys(cls, XY: ArrayLike) -> Path: ...
+ @classmethod
+ def make_compound_path(cls, *args: Path) -> Path: ...
+ def __len__(self) -> int: ...
+ def iter_segments(
+ self,
+ transform: Transform | None = ...,
+ remove_nans: bool = ...,
+ clip: tuple[float, float, float, float] | None = ...,
+ snap: bool | None = ...,
+ stroke_width: float = ...,
+ simplify: bool | None = ...,
+ curves: bool = ...,
+ sketch: tuple[float, float, float] | None = ...,
+ ) -> Generator[tuple[np.ndarray, np.uint8], None, None]: ...
+ def iter_bezier(self, **kwargs) -> Generator[BezierSegment, None, None]: ...
+ def cleaned(
+ self,
+ transform: Transform | None = ...,
+ remove_nans: bool = ...,
+ clip: tuple[float, float, float, float] | None = ...,
+ *,
+ simplify: bool | None = ...,
+ curves: bool = ...,
+ stroke_width: float = ...,
+ snap: bool | None = ...,
+ sketch: tuple[float, float, float] | None = ...
+ ) -> Path: ...
+ def transformed(self, transform: Transform) -> Path: ...
+ def contains_point(
+ self,
+ point: tuple[float, float],
+ transform: Transform | None = ...,
+ radius: float = ...,
+ ) -> bool: ...
+ def contains_points(
+ self, points: ArrayLike, transform: Transform | None = ..., radius: float = ...
+ ) -> np.ndarray: ...
+ def contains_path(self, path: Path, transform: Transform | None = ...) -> bool: ...
+ def get_extents(self, transform: Transform | None = ..., **kwargs) -> Bbox: ...
+ def intersects_path(self, other: Path, filled: bool = ...) -> bool: ...
+ def intersects_bbox(self, bbox: Bbox, filled: bool = ...) -> bool: ...
+ def interpolated(self, steps: int) -> Path: ...
+ def to_polygons(
+ self,
+ transform: Transform | None = ...,
+ width: float = ...,
+ height: float = ...,
+ closed_only: bool = ...,
+ ) -> list[ArrayLike]: ...
+ @classmethod
+ def unit_rectangle(cls) -> Path: ...
+ @classmethod
+ def unit_regular_polygon(cls, numVertices: int) -> Path: ...
+ @classmethod
+ def unit_regular_star(cls, numVertices: int, innerCircle: float = ...) -> Path: ...
+ @classmethod
+ def unit_regular_asterisk(cls, numVertices: int) -> Path: ...
+ @classmethod
+ def unit_circle(cls) -> Path: ...
+ @classmethod
+ def circle(
+ cls,
+ center: tuple[float, float] = ...,
+ radius: float = ...,
+ readonly: bool = ...,
+ ) -> Path: ...
+ @classmethod
+ def unit_circle_righthalf(cls) -> Path: ...
+ @classmethod
+ def arc(
+ cls, theta1: float, theta2: float, n: int | None = ..., is_wedge: bool = ...
+ ) -> Path: ...
+ @classmethod
+ def wedge(cls, theta1: float, theta2: float, n: int | None = ...) -> Path: ...
+ @overload
+ @staticmethod
+ def hatch(hatchpattern: str, density: float = ...) -> Path: ...
+ @overload
+ @staticmethod
+ def hatch(hatchpattern: None, density: float = ...) -> None: ...
+ def clip_to_bbox(self, bbox: Bbox, inside: bool = ...) -> Path: ...
+
+def get_path_collection_extents(
+ master_transform: Transform,
+ paths: Sequence[Path],
+ transforms: Iterable[Affine2D],
+ offsets: ArrayLike,
+ offset_transform: Affine2D,
+) -> Bbox: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/patheffects.pyi b/contrib/python/matplotlib/py3/matplotlib/patheffects.pyi
new file mode 100644
index 0000000000..5d8dcfeab6
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/patheffects.pyi
@@ -0,0 +1,106 @@
+from collections.abc import Iterable, Sequence
+from typing import Any
+
+from matplotlib.backend_bases import RendererBase, GraphicsContextBase
+from matplotlib.path import Path
+from matplotlib.patches import Patch
+from matplotlib.transforms import Transform
+
+from matplotlib.typing import ColorType
+
+class AbstractPathEffect:
+ def __init__(self, offset: tuple[float, float] = ...) -> None: ...
+ def draw_path(
+ self,
+ renderer: RendererBase,
+ gc: GraphicsContextBase,
+ tpath: Path,
+ affine: Transform,
+ rgbFace: ColorType | None = ...,
+ ) -> None: ...
+
+class PathEffectRenderer(RendererBase):
+ def __init__(
+ self, path_effects: Iterable[AbstractPathEffect], renderer: RendererBase
+ ) -> None: ...
+ def copy_with_path_effect(self, path_effects: Iterable[AbstractPathEffect]) -> PathEffectRenderer: ...
+ def draw_path(
+ self,
+ gc: GraphicsContextBase,
+ tpath: Path,
+ affine: Transform,
+ rgbFace: ColorType | None = ...,
+ ) -> None: ...
+ def draw_markers(
+ self,
+ gc: GraphicsContextBase,
+ marker_path: Path,
+ marker_trans: Transform,
+ path: Path,
+ *args,
+ **kwargs
+ ) -> None: ...
+ def draw_path_collection(
+ self,
+ gc: GraphicsContextBase,
+ master_transform: Transform,
+ paths: Sequence[Path],
+ *args,
+ **kwargs
+ ) -> None: ...
+ def __getattribute__(self, name: str) -> Any: ...
+
+class Normal(AbstractPathEffect): ...
+
+class Stroke(AbstractPathEffect):
+ def __init__(self, offset: tuple[float, float] = ..., **kwargs) -> None: ...
+ # rgbFace becomes non-optional
+ def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore
+
+class withStroke(Stroke): ...
+
+class SimplePatchShadow(AbstractPathEffect):
+ def __init__(
+ self,
+ offset: tuple[float, float] = ...,
+ shadow_rgbFace: ColorType | None = ...,
+ alpha: float | None = ...,
+ rho: float = ...,
+ **kwargs
+ ) -> None: ...
+ # rgbFace becomes non-optional
+ def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore
+
+class withSimplePatchShadow(SimplePatchShadow): ...
+
+class SimpleLineShadow(AbstractPathEffect):
+ def __init__(
+ self,
+ offset: tuple[float, float] = ...,
+ shadow_color: ColorType = ...,
+ alpha: float = ...,
+ rho: float = ...,
+ **kwargs
+ ) -> None: ...
+ # rgbFace becomes non-optional
+ def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore
+
+class PathPatchEffect(AbstractPathEffect):
+ patch: Patch
+ def __init__(self, offset: tuple[float, float] = ..., **kwargs) -> None: ...
+ # rgbFace becomes non-optional
+ def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore
+
+class TickedStroke(AbstractPathEffect):
+ def __init__(
+ self,
+ offset: tuple[float, float] = ...,
+ spacing: float = ...,
+ angle: float = ...,
+ length: float = ...,
+ **kwargs
+ ) -> None: ...
+ # rgbFace becomes non-optional
+ def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore
+
+class withTickedStroke(TickedStroke): ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi
new file mode 100644
index 0000000000..0f8b6c0980
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi
@@ -0,0 +1,15 @@
+from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
+from .polar import PolarAxes
+from ..axes import Axes
+
+class ProjectionRegistry:
+ def __init__(self) -> None: ...
+ def register(self, *projections: type[Axes]) -> None: ...
+ def get_projection_class(self, name: str) -> type[Axes]: ...
+ def get_projection_names(self) -> list[str]: ...
+
+projection_registry: ProjectionRegistry
+
+def register_projection(cls: type[Axes]) -> None: ...
+def get_projection_class(projection: str | None = ...) -> type[Axes]: ...
+def get_projection_names() -> list[str]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi b/contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi
new file mode 100644
index 0000000000..93220f8cbc
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi
@@ -0,0 +1,112 @@
+from matplotlib.axes import Axes
+from matplotlib.ticker import Formatter
+from matplotlib.transforms import Transform
+
+from typing import Any, Literal
+
+class GeoAxes(Axes):
+ class ThetaFormatter(Formatter):
+ def __init__(self, round_to: float = ...) -> None: ...
+ def __call__(self, x: float, pos: Any | None = ...): ...
+ RESOLUTION: float
+ def get_xaxis_transform(
+ self, which: Literal["tick1", "tick2", "grid"] = ...
+ ) -> Transform: ...
+ def get_xaxis_text1_transform(
+ self, pad: float
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_xaxis_text2_transform(
+ self, pad: float
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_yaxis_transform(
+ self, which: Literal["tick1", "tick2", "grid"] = ...
+ ) -> Transform: ...
+ def get_yaxis_text1_transform(
+ self, pad: float
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_yaxis_text2_transform(
+ self, pad: float
+ ) -> tuple[
+ Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def set_xlim(self, *args, **kwargs) -> tuple[float, float]: ...
+ def set_ylim(self, *args, **kwargs) -> tuple[float, float]: ...
+ def format_coord(self, lon: float, lat: float) -> str: ...
+ def set_longitude_grid(self, degrees: float) -> None: ...
+ def set_latitude_grid(self, degrees: float) -> None: ...
+ def set_longitude_grid_ends(self, degrees: float) -> None: ...
+ def get_data_ratio(self) -> float: ...
+ def can_zoom(self) -> bool: ...
+ def can_pan(self) -> bool: ...
+ def start_pan(self, x, y, button) -> None: ...
+ def end_pan(self) -> None: ...
+ def drag_pan(self, button, key, x, y) -> None: ...
+
+class _GeoTransform(Transform):
+ input_dims: int
+ output_dims: int
+ def __init__(self, resolution: int) -> None: ...
+
+class AitoffAxes(GeoAxes):
+ name: str
+
+ class AitoffTransform(_GeoTransform):
+ def inverted(self) -> AitoffAxes.InvertedAitoffTransform: ...
+
+ class InvertedAitoffTransform(_GeoTransform):
+ def inverted(self) -> AitoffAxes.AitoffTransform: ...
+
+class HammerAxes(GeoAxes):
+ name: str
+
+ class HammerTransform(_GeoTransform):
+ def inverted(self) -> HammerAxes.InvertedHammerTransform: ...
+
+ class InvertedHammerTransform(_GeoTransform):
+ def inverted(self) -> HammerAxes.HammerTransform: ...
+
+class MollweideAxes(GeoAxes):
+ name: str
+
+ class MollweideTransform(_GeoTransform):
+ def inverted(self) -> MollweideAxes.InvertedMollweideTransform: ...
+
+ class InvertedMollweideTransform(_GeoTransform):
+ def inverted(self) -> MollweideAxes.MollweideTransform: ...
+
+class LambertAxes(GeoAxes):
+ name: str
+
+ class LambertTransform(_GeoTransform):
+ def __init__(
+ self, center_longitude: float, center_latitude: float, resolution: int
+ ) -> None: ...
+ def inverted(self) -> LambertAxes.InvertedLambertTransform: ...
+
+ class InvertedLambertTransform(_GeoTransform):
+ def __init__(
+ self, center_longitude: float, center_latitude: float, resolution: int
+ ) -> None: ...
+ def inverted(self) -> LambertAxes.LambertTransform: ...
+
+ def __init__(
+ self,
+ *args,
+ center_longitude: float = ...,
+ center_latitude: float = ...,
+ **kwargs
+ ) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi b/contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi
new file mode 100644
index 0000000000..2592d49471
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi
@@ -0,0 +1,196 @@
+import matplotlib.axis as maxis
+import matplotlib.ticker as mticker
+import matplotlib.transforms as mtransforms
+from matplotlib.axes import Axes
+from matplotlib.lines import Line2D
+from matplotlib.text import Text
+
+import numpy as np
+from numpy.typing import ArrayLike
+from collections.abc import Sequence
+from typing import Any, ClassVar, Literal, overload
+
+class PolarTransform(mtransforms.Transform):
+ input_dims: int
+ output_dims: int
+ def __init__(
+ self,
+ axis: PolarAxes | None = ...,
+ use_rmin: bool = ...,
+ _apply_theta_transforms: bool = ...,
+ *,
+ scale_transform: mtransforms.Transform | None = ...,
+ ) -> None: ...
+ def inverted(self) -> InvertedPolarTransform: ...
+
+class PolarAffine(mtransforms.Affine2DBase):
+ def __init__(
+ self, scale_transform: mtransforms.Transform, limits: mtransforms.BboxBase
+ ) -> None: ...
+
+class InvertedPolarTransform(mtransforms.Transform):
+ input_dims: int
+ output_dims: int
+ def __init__(
+ self,
+ axis: PolarAxes | None = ...,
+ use_rmin: bool = ...,
+ _apply_theta_transforms: bool = ...,
+ ) -> None: ...
+ def inverted(self) -> PolarTransform: ...
+
+class ThetaFormatter(mticker.Formatter): ...
+
+class _AxisWrapper:
+ def __init__(self, axis: maxis.Axis) -> None: ...
+ def get_view_interval(self) -> np.ndarray: ...
+ def set_view_interval(self, vmin: float, vmax: float) -> None: ...
+ def get_minpos(self) -> float: ...
+ def get_data_interval(self) -> np.ndarray: ...
+ def set_data_interval(self, vmin: float, vmax: float) -> None: ...
+ def get_tick_space(self) -> int: ...
+
+class ThetaLocator(mticker.Locator):
+ base: mticker.Locator
+ axis: _AxisWrapper | None
+ def __init__(self, base: mticker.Locator) -> None: ...
+
+class ThetaTick(maxis.XTick):
+ def __init__(self, axes: PolarAxes, *args, **kwargs) -> None: ...
+
+class ThetaAxis(maxis.XAxis):
+ axis_name: str
+
+class RadialLocator(mticker.Locator):
+ base: mticker.Locator
+ def __init__(self, base, axes: PolarAxes | None = ...) -> None: ...
+
+class RadialTick(maxis.YTick): ...
+
+class RadialAxis(maxis.YAxis):
+ axis_name: str
+
+class _WedgeBbox(mtransforms.Bbox):
+ def __init__(
+ self,
+ center: tuple[float, float],
+ viewLim: mtransforms.Bbox,
+ originLim: mtransforms.Bbox,
+ **kwargs,
+ ) -> None: ...
+
+class PolarAxes(Axes):
+
+ PolarTransform: ClassVar[type] = PolarTransform
+ PolarAffine: ClassVar[type] = PolarAffine
+ InvertedPolarTransform: ClassVar[type] = InvertedPolarTransform
+ ThetaFormatter: ClassVar[type] = ThetaFormatter
+ RadialLocator: ClassVar[type] = RadialLocator
+ ThetaLocator: ClassVar[type] = ThetaLocator
+
+ name: str
+ use_sticky_edges: bool
+ def __init__(
+ self,
+ *args,
+ theta_offset: float = ...,
+ theta_direction: float = ...,
+ rlabel_position: float = ...,
+ **kwargs,
+ ) -> None: ...
+ def get_xaxis_transform(
+ self, which: Literal["tick1", "tick2", "grid"] = ...
+ ) -> mtransforms.Transform: ...
+ def get_xaxis_text1_transform(
+ self, pad: float
+ ) -> tuple[
+ mtransforms.Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_xaxis_text2_transform(
+ self, pad: float
+ ) -> tuple[
+ mtransforms.Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_yaxis_transform(
+ self, which: Literal["tick1", "tick2", "grid"] = ...
+ ) -> mtransforms.Transform: ...
+ def get_yaxis_text1_transform(
+ self, pad: float
+ ) -> tuple[
+ mtransforms.Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def get_yaxis_text2_transform(
+ self, pad: float
+ ) -> tuple[
+ mtransforms.Transform,
+ Literal["center", "top", "bottom", "baseline", "center_baseline"],
+ Literal["center", "left", "right"],
+ ]: ...
+ def set_thetamax(self, thetamax: float) -> None: ...
+ def get_thetamax(self) -> float: ...
+ def set_thetamin(self, thetamin: float) -> None: ...
+ def get_thetamin(self) -> float: ...
+ @overload
+ def set_thetalim(self, minval: float, maxval: float, /) -> tuple[float, float]: ...
+ @overload
+ def set_thetalim(self, *, thetamin: float, thetamax: float) -> tuple[float, float]: ...
+ def set_theta_offset(self, offset: float) -> None: ...
+ def get_theta_offset(self) -> float: ...
+ def set_theta_zero_location(
+ self,
+ loc: Literal["N", "NW", "W", "SW", "S", "SE", "E", "NE"],
+ offset: float = ...,
+ ) -> None: ...
+ def set_theta_direction(
+ self,
+ direction: Literal[-1, 1, "clockwise", "counterclockwise", "anticlockwise"],
+ ) -> None: ...
+ def get_theta_direction(self) -> Literal[-1, 1]: ...
+ def set_rmax(self, rmax: float) -> None: ...
+ def get_rmax(self) -> float: ...
+ def set_rmin(self, rmin: float) -> None: ...
+ def get_rmin(self) -> float: ...
+ def set_rorigin(self, rorigin: float | None) -> None: ...
+ def get_rorigin(self) -> float: ...
+ def get_rsign(self) -> float: ...
+ def set_rlim(
+ self,
+ bottom: float | tuple[float, float] | None = ...,
+ top: float | None = ...,
+ *,
+ emit: bool = ...,
+ auto: bool = ...,
+ **kwargs,
+ ) -> tuple[float, float]: ...
+ def get_rlabel_position(self) -> float: ...
+ def set_rlabel_position(self, value: float) -> None: ...
+ def set_rscale(self, *args, **kwargs) -> None: ...
+ def set_rticks(self, *args, **kwargs) -> None: ...
+ def set_thetagrids(
+ self,
+ angles: ArrayLike,
+ labels: Sequence[str | Text] | None = ...,
+ fmt: str | None = ...,
+ **kwargs,
+ ) -> tuple[list[Line2D], list[Text]]: ...
+ def set_rgrids(
+ self,
+ radii: ArrayLike,
+ labels: Sequence[str | Text] | None = ...,
+ angle: float | None = ...,
+ fmt: str | None = ...,
+ **kwargs,
+ ) -> tuple[list[Line2D], list[Text]]: ...
+ def format_coord(self, theta: float, r: float) -> str: ...
+ def get_data_ratio(self) -> float: ...
+ def can_zoom(self) -> bool: ...
+ def can_pan(self) -> bool: ...
+ def start_pan(self, x: float, y: float, button: int) -> None: ...
+ def end_pan(self) -> None: ...
+ def drag_pan(self, button: Any, key: Any, x: float, y: float) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/quiver.pyi b/contrib/python/matplotlib/py3/matplotlib/quiver.pyi
new file mode 100644
index 0000000000..c673c5dd3a
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/quiver.pyi
@@ -0,0 +1,187 @@
+import matplotlib.artist as martist
+import matplotlib.collections as mcollections
+from matplotlib.axes import Axes
+from matplotlib.figure import Figure
+from matplotlib.text import Text
+from matplotlib.transforms import Transform, Bbox
+
+
+import numpy as np
+from numpy.typing import ArrayLike
+from collections.abc import Sequence
+from typing import Any, Literal, overload
+from matplotlib.typing import ColorType
+
+class QuiverKey(martist.Artist):
+ halign: dict[Literal["N", "S", "E", "W"], Literal["left", "center", "right"]]
+ valign: dict[Literal["N", "S", "E", "W"], Literal["top", "center", "bottom"]]
+ pivot: dict[Literal["N", "S", "E", "W"], Literal["middle", "tip", "tail"]]
+ Q: Quiver
+ X: float
+ Y: float
+ U: float
+ angle: float
+ coord: Literal["axes", "figure", "data", "inches"]
+ color: ColorType | None
+ label: str
+ labelpos: Literal["N", "S", "E", "W"]
+ labelcolor: ColorType | None
+ fontproperties: dict[str, Any]
+ kw: dict[str, Any]
+ text: Text
+ zorder: float
+ def __init__(
+ self,
+ Q: Quiver,
+ X: float,
+ Y: float,
+ U: float,
+ label: str,
+ *,
+ angle: float = ...,
+ coordinates: Literal["axes", "figure", "data", "inches"] = ...,
+ color: ColorType | None = ...,
+ labelsep: float = ...,
+ labelpos: Literal["N", "S", "E", "W"] = ...,
+ labelcolor: ColorType | None = ...,
+ fontproperties: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> None: ...
+ @property
+ def labelsep(self) -> float: ...
+ def set_figure(self, fig: Figure) -> None: ...
+
+class Quiver(mcollections.PolyCollection):
+ X: ArrayLike
+ Y: ArrayLike
+ XY: ArrayLike
+ U: ArrayLike
+ V: ArrayLike
+ Umask: ArrayLike
+ N: int
+ scale: float | None
+ headwidth: float
+ headlength: float
+ headaxislength: float
+ minshaft: float
+ minlength: float
+ units: Literal["width", "height", "dots", "inches", "x", "y", "xy"]
+ scale_units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] | None
+ angles: Literal["uv", "xy"] | ArrayLike
+ width: float | None
+ pivot: Literal["tail", "middle", "tip"]
+ transform: Transform
+ polykw: dict[str, Any]
+
+ @overload
+ def __init__(
+ self,
+ ax: Axes,
+ U: ArrayLike,
+ V: ArrayLike,
+ C: ArrayLike = ...,
+ *,
+ scale: float | None = ...,
+ headwidth: float = ...,
+ headlength: float = ...,
+ headaxislength: float = ...,
+ minshaft: float = ...,
+ minlength: float = ...,
+ units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] = ...,
+ scale_units: Literal["width", "height", "dots", "inches", "x", "y", "xy"]
+ | None = ...,
+ angles: Literal["uv", "xy"] | ArrayLike = ...,
+ width: float | None = ...,
+ color: ColorType | Sequence[ColorType] = ...,
+ pivot: Literal["tail", "mid", "middle", "tip"] = ...,
+ **kwargs
+ ) -> None: ...
+ @overload
+ def __init__(
+ self,
+ ax: Axes,
+ X: ArrayLike,
+ Y: ArrayLike,
+ U: ArrayLike,
+ V: ArrayLike,
+ C: ArrayLike = ...,
+ *,
+ scale: float | None = ...,
+ headwidth: float = ...,
+ headlength: float = ...,
+ headaxislength: float = ...,
+ minshaft: float = ...,
+ minlength: float = ...,
+ units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] = ...,
+ scale_units: Literal["width", "height", "dots", "inches", "x", "y", "xy"]
+ | None = ...,
+ angles: Literal["uv", "xy"] | ArrayLike = ...,
+ width: float | None = ...,
+ color: ColorType | Sequence[ColorType] = ...,
+ pivot: Literal["tail", "mid", "middle", "tip"] = ...,
+ **kwargs
+ ) -> None: ...
+ def get_datalim(self, transData: Transform) -> Bbox: ...
+ def set_UVC(
+ self, U: ArrayLike, V: ArrayLike, C: ArrayLike | None = ...
+ ) -> None: ...
+ @property
+ def quiver_doc(self) -> str: ...
+
+class Barbs(mcollections.PolyCollection):
+ sizes: dict[str, float]
+ fill_empty: bool
+ barb_increments: dict[str, float]
+ rounding: bool
+ flip: np.ndarray
+ x: ArrayLike
+ y: ArrayLike
+ u: ArrayLike
+ v: ArrayLike
+
+ @overload
+ def __init__(
+ self,
+ ax: Axes,
+ U: ArrayLike,
+ V: ArrayLike,
+ C: ArrayLike = ...,
+ *,
+ pivot: str = ...,
+ length: int = ...,
+ barbcolor: ColorType | Sequence[ColorType] | None = ...,
+ flagcolor: ColorType | Sequence[ColorType] | None = ...,
+ sizes: dict[str, float] | None = ...,
+ fill_empty: bool = ...,
+ barb_increments: dict[str, float] | None = ...,
+ rounding: bool = ...,
+ flip_barb: bool | ArrayLike = ...,
+ **kwargs
+ ) -> None: ...
+ @overload
+ def __init__(
+ self,
+ ax: Axes,
+ X: ArrayLike,
+ Y: ArrayLike,
+ U: ArrayLike,
+ V: ArrayLike,
+ C: ArrayLike = ...,
+ *,
+ pivot: str = ...,
+ length: int = ...,
+ barbcolor: ColorType | Sequence[ColorType] | None = ...,
+ flagcolor: ColorType | Sequence[ColorType] | None = ...,
+ sizes: dict[str, float] | None = ...,
+ fill_empty: bool = ...,
+ barb_increments: dict[str, float] | None = ...,
+ rounding: bool = ...,
+ flip_barb: bool | ArrayLike = ...,
+ **kwargs
+ ) -> None: ...
+ def set_UVC(
+ self, U: ArrayLike, V: ArrayLike, C: ArrayLike | None = ...
+ ) -> None: ...
+ def set_offsets(self, xy: ArrayLike) -> None: ...
+ @property
+ def barbs_doc(self) -> str: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi b/contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi
new file mode 100644
index 0000000000..70e94a7694
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi
@@ -0,0 +1,157 @@
+from cycler import Cycler
+
+from collections.abc import Callable, Iterable
+from typing import Any, Literal, TypeVar
+from matplotlib.typing import ColorType, LineStyleType, MarkEveryType
+
+interactive_bk: list[str]
+non_interactive_bk: list[str]
+all_backends: list[str]
+
+_T = TypeVar("_T")
+
+def _listify_validator(s: Callable[[Any], _T]) -> Callable[[Any], list[_T]]: ...
+
+class ValidateInStrings:
+ key: str
+ ignorecase: bool
+ valid: dict[str, str]
+ def __init__(
+ self,
+ key: str,
+ valid: Iterable[str],
+ ignorecase: bool = ...,
+ *,
+ _deprecated_since: str | None = ...
+ ) -> None: ...
+ def __call__(self, s: Any) -> str: ...
+
+def validate_any(s: Any) -> Any: ...
+def validate_anylist(s: Any) -> list[Any]: ...
+def validate_bool(b: Any) -> bool: ...
+def validate_axisbelow(s: Any) -> bool | Literal["line"]: ...
+def validate_dpi(s: Any) -> Literal["figure"] | float: ...
+def validate_string(s: Any) -> str: ...
+def validate_string_or_None(s: Any) -> str | None: ...
+def validate_stringlist(s: Any) -> list[str]: ...
+def validate_int(s: Any) -> int: ...
+def validate_int_or_None(s: Any) -> int | None: ...
+def validate_float(s: Any) -> float: ...
+def validate_float_or_None(s: Any) -> float | None: ...
+def validate_floatlist(s: Any) -> list[float]: ...
+def validate_fonttype(s: Any) -> int: ...
+
+_auto_backend_sentinel: object
+
+def validate_backend(s: Any) -> str: ...
+def validate_color_or_inherit(s: Any) -> Literal["inherit"] | ColorType: ...
+def validate_color_or_auto(s: Any) -> ColorType | Literal["auto"]: ...
+def validate_color_for_prop_cycle(s: Any) -> ColorType: ...
+def validate_color(s: Any) -> ColorType: ...
+def validate_colorlist(s: Any) -> list[ColorType]: ...
+def _validate_color_or_linecolor(
+ s: Any,
+) -> ColorType | Literal["linecolor", "markerfacecolor", "markeredgecolor"] | None: ...
+def validate_aspect(s: Any) -> Literal["auto", "equal"] | float: ...
+def validate_fontsize_None(
+ s: Any,
+) -> Literal[
+ "xx-small",
+ "x-small",
+ "small",
+ "medium",
+ "large",
+ "x-large",
+ "xx-large",
+ "smaller",
+ "larger",
+] | float | None: ...
+def validate_fontsize(
+ s: Any,
+) -> Literal[
+ "xx-small",
+ "x-small",
+ "small",
+ "medium",
+ "large",
+ "x-large",
+ "xx-large",
+ "smaller",
+ "larger",
+] | float: ...
+def validate_fontsizelist(
+ s: Any,
+) -> list[
+ Literal[
+ "xx-small",
+ "x-small",
+ "small",
+ "medium",
+ "large",
+ "x-large",
+ "xx-large",
+ "smaller",
+ "larger",
+ ]
+ | float
+]: ...
+def validate_fontweight(
+ s: Any,
+) -> Literal[
+ "ultralight",
+ "light",
+ "normal",
+ "regular",
+ "book",
+ "medium",
+ "roman",
+ "semibold",
+ "demibold",
+ "demi",
+ "bold",
+ "heavy",
+ "extra bold",
+ "black",
+] | int: ...
+def validate_fontstretch(
+ s: Any,
+) -> Literal[
+ "ultra-condensed",
+ "extra-condensed",
+ "condensed",
+ "semi-condensed",
+ "normal",
+ "semi-expanded",
+ "expanded",
+ "extra-expanded",
+ "ultra-expanded",
+] | int: ...
+def validate_font_properties(s: Any) -> dict[str, Any]: ...
+def validate_whiskers(s: Any) -> list[float] | float: ...
+def validate_ps_distiller(s: Any) -> None | Literal["ghostscript", "xpdf"]: ...
+
+validate_fillstyle: ValidateInStrings
+
+def validate_fillstylelist(
+ s: Any,
+) -> list[Literal["full", "left", "right", "bottom", "top", "none"]]: ...
+def validate_markevery(s: Any) -> MarkEveryType: ...
+def _validate_linestyle(s: Any) -> LineStyleType: ...
+def validate_markeverylist(s: Any) -> list[MarkEveryType]: ...
+def validate_bbox(s: Any) -> Literal["tight", "standard"] | None: ...
+def validate_sketch(s: Any) -> None | tuple[float, float, float]: ...
+def validate_hatch(s: Any) -> str: ...
+def validate_hatchlist(s: Any) -> list[str]: ...
+def validate_dashlist(s: Any) -> list[list[float]]: ...
+
+# TODO: copy cycler overloads?
+def cycler(*args, **kwargs) -> Cycler: ...
+def validate_cycler(s: Any) -> Cycler: ...
+def validate_hist_bins(
+ s: Any,
+) -> Literal["auto", "sturges", "fd", "doane", "scott", "rice", "sqrt"] | int | list[
+ float
+]: ...
+
+# At runtime is added in __init__.py
+defaultParams: dict[str, Any]
diff --git a/contrib/python/matplotlib/py3/matplotlib/sankey.pyi b/contrib/python/matplotlib/py3/matplotlib/sankey.pyi
new file mode 100644
index 0000000000..4a40c31e3c
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/sankey.pyi
@@ -0,0 +1,61 @@
+from matplotlib.axes import Axes
+
+from collections.abc import Callable, Iterable
+from typing import Any
+
+import numpy as np
+
+__license__: str
+__credits__: list[str]
+__author__: str
+__version__: str
+
+RIGHT: int
+UP: int
+DOWN: int
+
+# TODO typing units
+class Sankey:
+ diagrams: list[Any]
+ ax: Axes
+ unit: Any
+ format: str | Callable[[float], str]
+ scale: float
+ gap: float
+ radius: float
+ shoulder: float
+ offset: float
+ margin: float
+ pitch: float
+ tolerance: float
+ extent: np.ndarray
+ def __init__(
+ self,
+ ax: Axes | None = ...,
+ scale: float = ...,
+ unit: Any = ...,
+ format: str | Callable[[float], str] = ...,
+ gap: float = ...,
+ radius: float = ...,
+ shoulder: float = ...,
+ offset: float = ...,
+ head_angle: float = ...,
+ margin: float = ...,
+ tolerance: float = ...,
+ **kwargs
+ ) -> None: ...
+ def add(
+ self,
+ patchlabel: str = ...,
+ flows: Iterable[float] | None = ...,
+ orientations: Iterable[int] | None = ...,
+ labels: str | Iterable[str | None] = ...,
+ trunklength: float = ...,
+ pathlengths: float | Iterable[float] = ...,
+ prior: int | None = ...,
+ connect: tuple[int, int] = ...,
+ rotation: float = ...,
+ **kwargs
+ # Replace return with Self when py3.9 is dropped
+ ) -> Sankey: ...
+ def finish(self) -> list[Any]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/scale.pyi b/contrib/python/matplotlib/py3/matplotlib/scale.pyi
new file mode 100644
index 0000000000..7fec8e68cc
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/scale.pyi
@@ -0,0 +1,178 @@
+from matplotlib.axis import Axis
+from matplotlib.transforms import Transform
+
+from collections.abc import Callable, Iterable
+from typing import Literal
+from numpy.typing import ArrayLike
+
+class ScaleBase:
+ def __init__(self, axis: Axis | None) -> None: ...
+ def get_transform(self) -> Transform: ...
+ def set_default_locators_and_formatters(self, axis: Axis) -> None: ...
+ def limit_range_for_scale(
+ self, vmin: float, vmax: float, minpos: float
+ ) -> tuple[float, float]: ...
+
+class LinearScale(ScaleBase):
+ name: str
+
+class FuncTransform(Transform):
+ input_dims: int
+ output_dims: int
+ def __init__(
+ self,
+ forward: Callable[[ArrayLike], ArrayLike],
+ inverse: Callable[[ArrayLike], ArrayLike],
+ ) -> None: ...
+ def inverted(self) -> FuncTransform: ...
+
+class FuncScale(ScaleBase):
+ name: str
+ def __init__(
+ self,
+ axis: Axis | None,
+ functions: tuple[
+ Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
+ ],
+ ) -> None: ...
+
+class LogTransform(Transform):
+ input_dims: int
+ output_dims: int
+ base: float
+ def __init__(
+ self, base: float, nonpositive: Literal["clip", "mask"] = ...
+ ) -> None: ...
+ def inverted(self) -> InvertedLogTransform: ...
+
+class InvertedLogTransform(Transform):
+ input_dims: int
+ output_dims: int
+ base: float
+ def __init__(self, base: float) -> None: ...
+ def inverted(self) -> LogTransform: ...
+
+class LogScale(ScaleBase):
+ name: str
+ subs: Iterable[int] | None
+ def __init__(
+ self,
+ axis: Axis | None,
+ *,
+ base: float = ...,
+ subs: Iterable[int] | None = ...,
+ nonpositive: Literal["clip", "mask"] = ...
+ ) -> None: ...
+ @property
+ def base(self) -> float: ...
+ def get_transform(self) -> Transform: ...
+
+class FuncScaleLog(LogScale):
+ def __init__(
+ self,
+ axis: Axis | None,
+ functions: tuple[
+ Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
+ ],
+ base: float = ...,
+ ) -> None: ...
+ @property
+ def base(self) -> float: ...
+ def get_transform(self) -> Transform: ...
+
+class SymmetricalLogTransform(Transform):
+ input_dims: int
+ output_dims: int
+ base: float
+ linthresh: float
+ linscale: float
+ def __init__(self, base: float, linthresh: float, linscale: float) -> None: ...
+ def inverted(self) -> InvertedSymmetricalLogTransform: ...
+
+class InvertedSymmetricalLogTransform(Transform):
+ input_dims: int
+ output_dims: int
+ base: float
+ linthresh: float
+ invlinthresh: float
+ linscale: float
+ def __init__(self, base: float, linthresh: float, linscale: float) -> None: ...
+ def inverted(self) -> SymmetricalLogTransform: ...
+
+class SymmetricalLogScale(ScaleBase):
+ name: str
+ subs: Iterable[int] | None
+ def __init__(
+ self,
+ axis: Axis | None,
+ *,
+ base: float = ...,
+ linthresh: float = ...,
+ subs: Iterable[int] | None = ...,
+ linscale: float = ...
+ ) -> None: ...
+ @property
+ def base(self) -> float: ...
+ @property
+ def linthresh(self) -> float: ...
+ @property
+ def linscale(self) -> float: ...
+ def get_transform(self) -> SymmetricalLogTransform: ...
+
+class AsinhTransform(Transform):
+ input_dims: int
+ output_dims: int
+ linear_width: float
+ def __init__(self, linear_width: float) -> None: ...
+ def inverted(self) -> InvertedAsinhTransform: ...
+
+class InvertedAsinhTransform(Transform):
+ input_dims: int
+ output_dims: int
+ linear_width: float
+ def __init__(self, linear_width: float) -> None: ...
+ def inverted(self) -> AsinhTransform: ...
+
+class AsinhScale(ScaleBase):
+ name: str
+ auto_tick_multipliers: dict[int, tuple[int, ...]]
+ def __init__(
+ self,
+ axis: Axis | None,
+ *,
+ linear_width: float = ...,
+ base: float = ...,
+ subs: Iterable[int] | Literal["auto"] | None = ...,
+ **kwargs
+ ) -> None: ...
+ @property
+ def linear_width(self) -> float: ...
+ def get_transform(self) -> AsinhTransform: ...
+
+class LogitTransform(Transform):
+ input_dims: int
+ output_dims: int
+ def __init__(self, nonpositive: Literal["mask", "clip"] = ...) -> None: ...
+ def inverted(self) -> LogisticTransform: ...
+
+class LogisticTransform(Transform):
+ input_dims: int
+ output_dims: int
+ def __init__(self, nonpositive: Literal["mask", "clip"] = ...) -> None: ...
+ def inverted(self) -> LogitTransform: ...
+
+class LogitScale(ScaleBase):
+ name: str
+ def __init__(
+ self,
+ axis: Axis | None,
+ nonpositive: Literal["mask", "clip"] = ...,
+ *,
+ one_half: str = ...,
+ use_overline: bool = ...
+ ) -> None: ...
+ def get_transform(self) -> LogitTransform: ...
+
+def get_scale_names() -> list[str]: ...
+def scale_factory(scale: str, axis: Axis, **kwargs) -> ScaleBase: ...
+def register_scale(scale_class: type[ScaleBase]) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/spines.pyi b/contrib/python/matplotlib/py3/matplotlib/spines.pyi
new file mode 100644
index 0000000000..0f06a6d1ce
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/spines.pyi
@@ -0,0 +1,83 @@
+from collections.abc import Callable, Iterator, MutableMapping
+from typing import Any, Literal, TypeVar, overload
+
+import matplotlib.patches as mpatches
+from matplotlib.axes import Axes
+from matplotlib.axis import Axis
+from matplotlib.path import Path
+from matplotlib.transforms import Transform
+from matplotlib.typing import ColorType
+
+class Spine(mpatches.Patch):
+ axes: Axes
+ spine_type: str
+ axis: Axis | None
+ def __init__(self, axes: Axes, spine_type: str, path: Path, **kwargs) -> None: ...
+ def set_patch_arc(
+ self, center: tuple[float, float], radius: float, theta1: float, theta2: float
+ ) -> None: ...
+ def set_patch_circle(self, center: tuple[float, float], radius: float) -> None: ...
+ def set_patch_line(self) -> None: ...
+ def get_patch_transform(self) -> Transform: ...
+ def get_path(self) -> Path: ...
+ def register_axis(self, axis: Axis) -> None: ...
+ def clear(self) -> None: ...
+ def set_position(
+ self,
+ position: Literal["center", "zero"]
+ | tuple[Literal["outward", "axes", "data"], float],
+ ) -> None: ...
+ def get_position(
+ self,
+ ) -> Literal["center", "zero"] | tuple[
+ Literal["outward", "axes", "data"], float
+ ]: ...
+ def get_spine_transform(self) -> Transform: ...
+ def set_bounds(self, low: float | None = ..., high: float | None = ...) -> None: ...
+ def get_bounds(self) -> tuple[float, float]: ...
+
+ _T = TypeVar("_T", bound=Spine)
+ @classmethod
+ def linear_spine(
+ cls: type[_T],
+ axes: Axes,
+ spine_type: Literal["left", "right", "bottom", "top"],
+ **kwargs
+ ) -> _T: ...
+ @classmethod
+ def arc_spine(
+ cls: type[_T],
+ axes: Axes,
+ spine_type: Literal["left", "right", "bottom", "top"],
+ center: tuple[float, float],
+ radius: float,
+ theta1: float,
+ theta2: float,
+ **kwargs
+ ) -> _T: ...
+ @classmethod
+ def circular_spine(
+ cls: type[_T], axes: Axes, center: tuple[float, float], radius: float, **kwargs
+ ) -> _T: ...
+ def set_color(self, c: ColorType | None) -> None: ...
+
+class SpinesProxy:
+ def __init__(self, spine_dict: dict[str, Spine]) -> None: ...
+ def __getattr__(self, name: str) -> Callable[..., None]: ...
+ def __dir__(self) -> list[str]: ...
+
+class Spines(MutableMapping[str, Spine]):
+ def __init__(self, **kwargs: Spine) -> None: ...
+ @classmethod
+ def from_dict(cls, d: dict[str, Spine]) -> Spines: ...
+ def __getattr__(self, name: str) -> Spine: ...
+ @overload
+ def __getitem__(self, key: str) -> Spine: ...
+ @overload
+ def __getitem__(self, key: list[str]) -> SpinesProxy: ...
+ @overload
+ def __getitem__(self, key: slice) -> SpinesProxy: ...
+ def __setitem__(self, key: str, value: Spine) -> None: ...
+ def __delitem__(self, key: str) -> None: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def __len__(self) -> int: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/stackplot.pyi b/contrib/python/matplotlib/py3/matplotlib/stackplot.pyi
new file mode 100644
index 0000000000..503e282665
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/stackplot.pyi
@@ -0,0 +1,17 @@
+from matplotlib.axes import Axes
+from matplotlib.collections import PolyCollection
+
+from collections.abc import Iterable
+from typing import Literal
+from numpy.typing import ArrayLike
+from matplotlib.typing import ColorType
+
+def stackplot(
+ axes: Axes,
+ x: ArrayLike,
+ *args: ArrayLike,
+ labels: Iterable[str] = ...,
+ colors: Iterable[ColorType] | None = ...,
+ baseline: Literal["zero", "sym", "wiggle", "weighted_wiggle"] = ...,
+ **kwargs
+) -> list[PolyCollection]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/streamplot.pyi b/contrib/python/matplotlib/py3/matplotlib/streamplot.pyi
new file mode 100644
index 0000000000..9da83096e5
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/streamplot.pyi
@@ -0,0 +1,82 @@
+from matplotlib.axes import Axes
+from matplotlib.colors import Normalize, Colormap
+from matplotlib.collections import LineCollection, PatchCollection
+from matplotlib.patches import ArrowStyle
+from matplotlib.transforms import Transform
+
+from typing import Literal
+from numpy.typing import ArrayLike
+from .typing import ColorType
+
+def streamplot(
+ axes: Axes,
+ x: ArrayLike,
+ y: ArrayLike,
+ u: ArrayLike,
+ v: ArrayLike,
+ density: float | tuple[float, float] = ...,
+ linewidth: float | ArrayLike | None = ...,
+ color: ColorType | ArrayLike | None = ...,
+ cmap: str | Colormap | None = ...,
+ norm: str | Normalize | None = ...,
+ arrowsize: float = ...,
+ arrowstyle: str | ArrowStyle = ...,
+ minlength: float = ...,
+ transform: Transform | None = ...,
+ zorder: float | None = ...,
+ start_points: ArrayLike | None = ...,
+ maxlength: float = ...,
+ integration_direction: Literal["forward", "backward", "both"] = ...,
+ broken_streamlines: bool = ...,
+) -> StreamplotSet: ...
+
+class StreamplotSet:
+ lines: LineCollection
+ arrows: PatchCollection
+ def __init__(self, lines: LineCollection, arrows: PatchCollection) -> None: ...
+
+class DomainMap:
+ grid: Grid
+ mask: StreamMask
+ x_grid2mask: float
+ y_grid2mask: float
+ x_mask2grid: float
+ y_mask2grid: float
+ x_data2grid: float
+ y_data2grid: float
+ def __init__(self, grid: Grid, mask: StreamMask) -> None: ...
+ def grid2mask(self, xi: float, yi: float) -> tuple[int, int]: ...
+ def mask2grid(self, xm: float, ym: float) -> tuple[float, float]: ...
+ def data2grid(self, xd: float, yd: float) -> tuple[float, float]: ...
+ def grid2data(self, xg: float, yg: float) -> tuple[float, float]: ...
+ def start_trajectory(
+ self, xg: float, yg: float, broken_streamlines: bool = ...
+ ) -> None: ...
+ def reset_start_point(self, xg: float, yg: float) -> None: ...
+ def update_trajectory(self, xg, yg, broken_streamlines: bool = ...) -> None: ...
+ def undo_trajectory(self) -> None: ...
+
+class Grid:
+ nx: int
+ ny: int
+ dx: float
+ dy: float
+ x_origin: float
+ y_origin: float
+ width: float
+ height: float
+ def __init__(self, x: ArrayLike, y: ArrayLike) -> None: ...
+ @property
+ def shape(self) -> tuple[int, int]: ...
+ def within_grid(self, xi: float, yi: float) -> bool: ...
+
+class StreamMask:
+ nx: int
+ ny: int
+ shape: tuple[int, int]
+ def __init__(self, density: float | tuple[float, float]) -> None: ...
+ def __getitem__(self, args): ...
+
+class InvalidIndexError(Exception): ...
+class TerminateTrajectory(Exception): ...
+class OutOfBounds(IndexError): ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/style/core.pyi b/contrib/python/matplotlib/py3/matplotlib/style/core.pyi
new file mode 100644
index 0000000000..7340049214
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/style/core.pyi
@@ -0,0 +1,19 @@
+from collections.abc import Generator
+import contextlib
+
+from matplotlib import RcParams
+from matplotlib.typing import RcStyleType
+
+USER_LIBRARY_PATHS: list[str] = ...
+STYLE_EXTENSION: str = ...
+
+def use(style: RcStyleType) -> None: ...
+@contextlib.contextmanager
+def context(
+ style: RcStyleType, after_reset: bool = ...
+) -> Generator[None, None, None]: ...
+
+library: dict[str, RcParams]
+available: list[str]
+
+def reload_library() -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/table.pyi b/contrib/python/matplotlib/py3/matplotlib/table.pyi
new file mode 100644
index 0000000000..842c55edb5
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/table.pyi
@@ -0,0 +1,85 @@
+from .artist import Artist
+from .axes import Axes
+from .backend_bases import RendererBase
+from .patches import Rectangle
+from .path import Path
+from .text import Text
+from .transforms import Bbox
+from .typing import ColorType
+
+from collections.abc import Sequence
+from typing import Any, Literal
+
+class Cell(Rectangle):
+ PAD: float
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ width: float,
+ height: float,
+ *,
+ edgecolor: ColorType = ...,
+ facecolor: ColorType = ...,
+ fill: bool = ...,
+ text: str = ...,
+ loc: Literal["left", "center", "right"] | None = ...,
+ fontproperties: dict[str, Any] | None = ...,
+ visible_edges: str | None = ...
+ ) -> None: ...
+ def get_text(self) -> Text: ...
+ def set_fontsize(self, size: float) -> None: ...
+ def get_fontsize(self) -> float: ...
+ def auto_set_font_size(self, renderer: RendererBase) -> float: ...
+ def get_text_bounds(
+ self, renderer: RendererBase
+ ) -> tuple[float, float, float, float]: ...
+ def get_required_width(self, renderer: RendererBase) -> float: ...
+ def set_text_props(self, **kwargs) -> None: ...
+ @property
+ def visible_edges(self) -> str: ...
+ @visible_edges.setter
+ def visible_edges(self, value: str | None) -> None: ...
+ def get_path(self) -> Path: ...
+
+CustomCell = Cell
+
+class Table(Artist):
+ codes: dict[str, int]
+ FONTSIZE: float
+ AXESPAD: float
+ def __init__(
+ self, ax: Axes, loc: str | None = ..., bbox: Bbox | None = ..., **kwargs
+ ) -> None: ...
+ def add_cell(self, row: int, col: int, *args, **kwargs) -> Cell: ...
+ def __setitem__(self, position: tuple[int, int], cell: Cell) -> None: ...
+ def __getitem__(self, position: tuple[int, int]) -> Cell: ...
+ @property
+ def edges(self) -> str | None: ...
+ @edges.setter
+ def edges(self, value: str | None) -> None: ...
+ def draw(self, renderer) -> None: ...
+ def get_children(self) -> list[Artist]: ...
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
+ def auto_set_column_width(self, col: int | Sequence[int]) -> None: ...
+ def auto_set_font_size(self, value: bool = ...) -> None: ...
+ def scale(self, xscale: float, yscale: float) -> None: ...
+ def set_fontsize(self, size: float) -> None: ...
+ def get_celld(self) -> dict[tuple[int, int], Cell]: ...
+
+def table(
+ ax: Axes,
+ cellText: Sequence[Sequence[str]] | None = ...,
+ cellColours: Sequence[Sequence[ColorType]] | None = ...,
+ cellLoc: Literal["left", "center", "right"] = ...,
+ colWidths: Sequence[float] | None = ...,
+ rowLabels: Sequence[str] | None = ...,
+ rowColours: Sequence[ColorType] | None = ...,
+ rowLoc: Literal["left", "center", "right"] = ...,
+ colLabels: Sequence[str] | None = ...,
+ colColours: Sequence[ColorType] | None = ...,
+ colLoc: Literal["left", "center", "right"] = ...,
+ loc: str = ...,
+ bbox: Bbox | None = ...,
+ edges: str = ...,
+ **kwargs
+) -> Table: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi
new file mode 100644
index 0000000000..30cfd9a9ed
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi
@@ -0,0 +1,49 @@
+from collections.abc import Callable
+import subprocess
+from typing import Any, IO, Literal, overload
+
+def set_font_settings_for_testing() -> None: ...
+def set_reproducibility_for_testing() -> None: ...
+def setup() -> None: ...
+@overload
+def subprocess_run_for_testing(
+ command: list[str],
+ env: dict[str, str] | None = ...,
+ timeout: float | None = ...,
+ stdout: int | IO[Any] | None = ...,
+ stderr: int | IO[Any] | None = ...,
+ check: bool = ...,
+ *,
+ text: Literal[True],
+ capture_output: bool = ...,
+) -> subprocess.CompletedProcess[str]: ...
+@overload
+def subprocess_run_for_testing(
+ command: list[str],
+ env: dict[str, str] | None = ...,
+ timeout: float | None = ...,
+ stdout: int | IO[Any] | None = ...,
+ stderr: int | IO[Any] | None = ...,
+ check: bool = ...,
+ text: Literal[False] = ...,
+ capture_output: bool = ...,
+) -> subprocess.CompletedProcess[bytes]: ...
+@overload
+def subprocess_run_for_testing(
+ command: list[str],
+ env: dict[str, str] | None = ...,
+ timeout: float | None = ...,
+ stdout: int | IO[Any] | None = ...,
+ stderr: int | IO[Any] | None = ...,
+ check: bool = ...,
+ text: bool = ...,
+ capture_output: bool = ...,
+) -> subprocess.CompletedProcess[bytes] | subprocess.CompletedProcess[str]: ...
+def subprocess_run_helper(
+ func: Callable[[], None],
+ *args: Any,
+ timeout: float,
+ extra_env: dict[str, str] | None = ...,
+) -> subprocess.CompletedProcess[str]: ...
+def _check_for_pgf(texsystem: str) -> bool: ...
+def _has_tex_package(package: str) -> bool: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi
new file mode 100644
index 0000000000..8f11b3bebc
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi
@@ -0,0 +1,32 @@
+from collections.abc import Callable
+from typing import Literal, overload
+
+from numpy.typing import NDArray
+
+__all__ = ["calculate_rms", "comparable_formats", "compare_images"]
+
+def make_test_filename(fname: str, purpose: str) -> str: ...
+def get_cache_dir() -> str: ...
+def get_file_hash(path: str, block_size: int = ...) -> str: ...
+
+converter: dict[str, Callable[[str, str], None]] = {}
+
+def comparable_formats() -> list[str]: ...
+def convert(filename: str, cache: bool) -> str: ...
+def crop_to_same(
+ actual_path: str, actual_image: NDArray, expected_path: str, expected_image: NDArray
+) -> tuple[NDArray, NDArray]: ...
+def calculate_rms(expected_image: NDArray, actual_image: NDArray) -> float: ...
+@overload
+def compare_images(
+ expected: str, actual: str, tol: float, in_decorator: Literal[True]
+) -> None | dict[str, float | str]: ...
+@overload
+def compare_images(
+ expected: str, actual: str, tol: float, in_decorator: Literal[False]
+) -> None | str: ...
+@overload
+def compare_images(
+ expected: str, actual: str, tol: float, in_decorator: bool = ...
+) -> None | str | dict[str, float | str]: ...
+def save_diff_image(expected: str, actual: str, output: str) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi
new file mode 100644
index 0000000000..2af0eb93cc
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi
@@ -0,0 +1,12 @@
+from types import ModuleType
+
+import pytest
+
+def pytest_configure(config: pytest.Config) -> None: ...
+def pytest_unconfigure(config: pytest.Config) -> None: ...
+@pytest.fixture
+def mpl_test_settings(request: pytest.FixtureRequest) -> None: ...
+@pytest.fixture
+def pd() -> ModuleType: ...
+@pytest.fixture
+def xr() -> ModuleType: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi
new file mode 100644
index 0000000000..f1b6c5e595
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi
@@ -0,0 +1,25 @@
+from collections.abc import Callable, Sequence
+from pathlib import Path
+from typing import Any, TypeVar
+from typing_extensions import ParamSpec
+
+from matplotlib.figure import Figure
+from matplotlib.typing import RcStyleType
+
+_P = ParamSpec("_P")
+_R = TypeVar("_R")
+
+def remove_ticks_and_titles(figure: Figure) -> None: ...
+def image_comparison(
+ baseline_images: list[str] | None,
+ extensions: list[str] | None = ...,
+ tol: float = ...,
+ freetype_version: tuple[str, str] | str | None = ...,
+ remove_text: bool = ...,
+ savefig_kwarg: dict[str, Any] | None = ...,
+ style: RcStyleType = ...,
+) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
+def check_figures_equal(
+ *, extensions: Sequence[str] = ..., tol: float = ...
+) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
+def _image_directories(func: Callable) -> tuple[Path, Path]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi
new file mode 100644
index 0000000000..858ff45715
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi
@@ -0,0 +1,31 @@
+from typing import Any, Literal
+
+from matplotlib.axes import Axes
+from matplotlib.backend_bases import Event, MouseButton
+from matplotlib.widgets import AxesWidget, Widget
+
+def get_ax() -> Axes: ...
+def noop(*args: Any, **kwargs: Any) -> None: ...
+def mock_event(
+ ax: Axes,
+ button: MouseButton | int | Literal["up", "down"] | None = ...,
+ xdata: float = ...,
+ ydata: float = ...,
+ key: str | None = ...,
+ step: int = ...,
+) -> Event: ...
+def do_event(
+ tool: AxesWidget,
+ etype: str,
+ button: MouseButton | int | Literal["up", "down"] | None = ...,
+ xdata: float = ...,
+ ydata: float = ...,
+ key: str | None = ...,
+ step: int = ...,
+) -> None: ...
+def click_and_drag(
+ tool: Widget,
+ start: tuple[float, float],
+ end: tuple[float, float],
+ key: str | None = ...,
+) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/texmanager.pyi b/contrib/python/matplotlib/py3/matplotlib/texmanager.pyi
new file mode 100644
index 0000000000..94f0d76fa8
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/texmanager.pyi
@@ -0,0 +1,38 @@
+from .backend_bases import RendererBase
+
+from matplotlib.typing import ColorType
+
+import numpy as np
+
+class TexManager:
+ texcache: str
+ @classmethod
+ def get_basefile(
+ cls, tex: str, fontsize: float, dpi: float | None = ...
+ ) -> str: ...
+ @classmethod
+ def get_font_preamble(cls) -> str: ...
+ @classmethod
+ def get_custom_preamble(cls) -> str: ...
+ @classmethod
+ def make_tex(cls, tex: str, fontsize: float) -> str: ...
+ @classmethod
+ def make_dvi(cls, tex: str, fontsize: float) -> str: ...
+ @classmethod
+ def make_png(cls, tex: str, fontsize: float, dpi: float) -> str: ...
+ @classmethod
+ def get_grey(
+ cls, tex: str, fontsize: float | None = ..., dpi: float | None = ...
+ ) -> np.ndarray: ...
+ @classmethod
+ def get_rgba(
+ cls,
+ tex: str,
+ fontsize: float | None = ...,
+ dpi: float | None = ...,
+ rgb: ColorType = ...,
+ ) -> np.ndarray: ...
+ @classmethod
+ def get_text_width_height_descent(
+ cls, tex: str, fontsize, renderer: RendererBase | None = ...
+ ) -> tuple[int, int, int]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/text.pyi b/contrib/python/matplotlib/py3/matplotlib/text.pyi
new file mode 100644
index 0000000000..6a83b1bbbe
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/text.pyi
@@ -0,0 +1,214 @@
+from .artist import Artist
+from .backend_bases import RendererBase
+from .font_manager import FontProperties
+from .offsetbox import DraggableAnnotation
+from .path import Path
+from .patches import FancyArrowPatch, FancyBboxPatch
+from .textpath import ( # noqa: reexported API
+ TextPath as TextPath,
+ TextToPath as TextToPath,
+)
+from .transforms import (
+ Bbox,
+ BboxBase,
+ Transform,
+)
+
+from collections.abc import Callable, Iterable
+from typing import Any, Literal
+from .typing import ColorType
+
+class Text(Artist):
+ zorder: float
+ def __init__(
+ self,
+ x: float = ...,
+ y: float = ...,
+ text: Any = ...,
+ *,
+ color: ColorType | None = ...,
+ verticalalignment: Literal[
+ "bottom", "baseline", "center", "center_baseline", "top"
+ ] = ...,
+ horizontalalignment: Literal["left", "center", "right"] = ...,
+ multialignment: Literal["left", "center", "right"] | None = ...,
+ fontproperties: str | Path | FontProperties | None = ...,
+ rotation: float | Literal["vertical", "horizontal"] | None = ...,
+ linespacing: float | None = ...,
+ rotation_mode: Literal["default", "anchor"] | None = ...,
+ usetex: bool | None = ...,
+ wrap: bool = ...,
+ transform_rotates_text: bool = ...,
+ parse_math: bool | None = ...,
+ antialiased: bool | None = ...,
+ **kwargs
+ ) -> None: ...
+ def update(self, kwargs: dict[str, Any]) -> list[Any]: ...
+ def get_rotation(self) -> float: ...
+ def get_transform_rotates_text(self) -> bool: ...
+ def set_rotation_mode(self, m: None | Literal["default", "anchor"]) -> None: ...
+ def get_rotation_mode(self) -> Literal["default", "anchor"]: ...
+ def set_bbox(self, rectprops: dict[str, Any]) -> None: ...
+ def get_bbox_patch(self) -> None | FancyBboxPatch: ...
+ def update_bbox_position_size(self, renderer: RendererBase) -> None: ...
+ def get_wrap(self) -> bool: ...
+ def set_wrap(self, wrap: bool) -> None: ...
+ def get_color(self) -> ColorType: ...
+ def get_fontproperties(self) -> FontProperties: ...
+ def get_fontfamily(self) -> list[str]: ...
+ def get_fontname(self) -> str: ...
+ def get_fontstyle(self) -> Literal["normal", "italic", "oblique"]: ...
+ def get_fontsize(self) -> float | str: ...
+ def get_fontvariant(self) -> Literal["normal", "small-caps"]: ...
+ def get_fontweight(self) -> int | str: ...
+ def get_stretch(self) -> int | str: ...
+ def get_horizontalalignment(self) -> Literal["left", "center", "right"]: ...
+ def get_unitless_position(self) -> tuple[float, float]: ...
+ def get_position(self) -> tuple[float, float]: ...
+ def get_text(self) -> str: ...
+ def get_verticalalignment(
+ self,
+ ) -> Literal["bottom", "baseline", "center", "center_baseline", "top"]: ...
+ def get_window_extent(
+ self, renderer: RendererBase | None = ..., dpi: float | None = ...
+ ) -> Bbox: ...
+ def set_backgroundcolor(self, color: ColorType) -> None: ...
+ def set_color(self, color: ColorType) -> None: ...
+ def set_horizontalalignment(
+ self, align: Literal["left", "center", "right"]
+ ) -> None: ...
+ def set_multialignment(self, align: Literal["left", "center", "right"]) -> None: ...
+ def set_linespacing(self, spacing: float) -> None: ...
+ def set_fontfamily(self, fontname: str | Iterable[str]) -> None: ...
+ def set_fontvariant(self, variant: Literal["normal", "small-caps"]) -> None: ...
+ def set_fontstyle(
+ self, fontstyle: Literal["normal", "italic", "oblique"]
+ ) -> None: ...
+ def set_fontsize(self, fontsize: float | str) -> None: ...
+ def get_math_fontfamily(self) -> str: ...
+ def set_math_fontfamily(self, fontfamily: str) -> None: ...
+ def set_fontweight(self, weight: int | str) -> None: ...
+ def set_fontstretch(self, stretch: int | str) -> None: ...
+ def set_position(self, xy: tuple[float, float]) -> None: ...
+ def set_x(self, x: float) -> None: ...
+ def set_y(self, y: float) -> None: ...
+ def set_rotation(self, s: float) -> None: ...
+ def set_transform_rotates_text(self, t: bool) -> None: ...
+ def set_verticalalignment(
+ self, align: Literal["bottom", "baseline", "center", "center_baseline", "top"]
+ ) -> None: ...
+ def set_text(self, s: Any) -> None: ...
+ def set_fontproperties(self, fp: FontProperties | str | Path | None) -> None: ...
+ def set_usetex(self, usetex: bool | None) -> None: ...
+ def get_usetex(self) -> bool: ...
+ def set_parse_math(self, parse_math: bool) -> None: ...
+ def get_parse_math(self) -> bool: ...
+ def set_fontname(self, fontname: str | Iterable[str]) -> None: ...
+ def get_antialiased(self) -> bool: ...
+ def set_antialiased(self, antialiased: bool) -> None: ...
+
+class OffsetFrom:
+ def __init__(
+ self,
+ artist: Artist | BboxBase | Transform,
+ ref_coord: tuple[float, float],
+ unit: Literal["points", "pixels"] = ...,
+ ) -> None: ...
+ def set_unit(self, unit: Literal["points", "pixels"]) -> None: ...
+ def get_unit(self) -> Literal["points", "pixels"]: ...
+ def __call__(self, renderer: RendererBase) -> Transform: ...
+
+class _AnnotationBase:
+ xy: tuple[float, float]
+ xycoords: str | tuple[str, str] | Artist | Transform | Callable[
+ [RendererBase], Bbox | Transform
+ ]
+ def __init__(
+ self,
+ xy,
+ xycoords: str
+ | tuple[str, str]
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform] = ...,
+ annotation_clip: bool | None = ...,
+ ) -> None: ...
+ def set_annotation_clip(self, b: bool | None) -> None: ...
+ def get_annotation_clip(self) -> bool | None: ...
+ def draggable(
+ self, state: bool | None = ..., use_blit: bool = ...
+ ) -> DraggableAnnotation | None: ...
+
+class Annotation(Text, _AnnotationBase):
+ arrowprops: dict[str, Any] | None
+ arrow_patch: FancyArrowPatch | None
+ def __init__(
+ self,
+ text: str,
+ xy: tuple[float, float],
+ xytext: tuple[float, float] | None = ...,
+ xycoords: str
+ | tuple[str, str]
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform] = ...,
+ textcoords: str
+ | tuple[str, str]
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform]
+ | None = ...,
+ arrowprops: dict[str, Any] | None = ...,
+ annotation_clip: bool | None = ...,
+ **kwargs
+ ) -> None: ...
+ @property
+ def xycoords(
+ self,
+ ) -> str | tuple[str, str] | Artist | Transform | Callable[
+ [RendererBase], Bbox | Transform
+ ]: ...
+ @xycoords.setter
+ def xycoords(
+ self,
+ xycoords: str
+ | tuple[str, str]
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform],
+ ) -> None: ...
+ @property
+ def xyann(self) -> tuple[float, float]: ...
+ @xyann.setter
+ def xyann(self, xytext: tuple[float, float]) -> None: ...
+ def get_anncoords(
+ self,
+ ) -> str | tuple[str, str] | Artist | Transform | Callable[
+ [RendererBase], Bbox | Transform
+ ]: ...
+ def set_anncoords(
+ self,
+ coords: str
+ | tuple[str, str]
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform],
+ ) -> None: ...
+ @property
+ def anncoords(
+ self,
+ ) -> str | tuple[str, str] | Artist | Transform | Callable[
+ [RendererBase], Bbox | Transform
+ ]: ...
+ @anncoords.setter
+ def anncoords(
+ self,
+ coords: str
+ | tuple[str, str]
+ | Artist
+ | Transform
+ | Callable[[RendererBase], Bbox | Transform],
+ ) -> None: ...
+ def update_positions(self, renderer: RendererBase) -> None: ...
+ # Drops `dpi` parameter from superclass
+ def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... # type: ignore[override]
diff --git a/contrib/python/matplotlib/py3/matplotlib/textpath.pyi b/contrib/python/matplotlib/py3/matplotlib/textpath.pyi
new file mode 100644
index 0000000000..34d4e92ac4
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/textpath.pyi
@@ -0,0 +1,74 @@
+from matplotlib.font_manager import FontProperties
+from matplotlib.ft2font import FT2Font
+from matplotlib.mathtext import MathTextParser, VectorParse
+from matplotlib.path import Path
+
+import numpy as np
+
+from typing import Literal
+
+class TextToPath:
+ FONT_SCALE: float
+ DPI: float
+ mathtext_parser: MathTextParser[VectorParse]
+ def __init__(self) -> None: ...
+ def get_text_width_height_descent(
+ self, s: str, prop: FontProperties, ismath: bool | Literal["TeX"]
+ ) -> tuple[float, float, float]: ...
+ def get_text_path(
+ self, prop: FontProperties, s: str, ismath: bool | Literal["TeX"] = ...
+ ) -> list[np.ndarray]: ...
+ def get_glyphs_with_font(
+ self,
+ font: FT2Font,
+ s: str,
+ glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ...,
+ return_new_glyphs_only: bool = ...,
+ ) -> tuple[
+ list[tuple[str, float, float, float]],
+ dict[str, tuple[np.ndarray, np.ndarray]],
+ list[tuple[list[tuple[float, float]], list[int]]],
+ ]: ...
+ def get_glyphs_mathtext(
+ self,
+ prop: FontProperties,
+ s: str,
+ glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ...,
+ return_new_glyphs_only: bool = ...,
+ ) -> tuple[
+ list[tuple[str, float, float, float]],
+ dict[str, tuple[np.ndarray, np.ndarray]],
+ list[tuple[list[tuple[float, float]], list[int]]],
+ ]: ...
+ def get_glyphs_tex(
+ self,
+ prop: FontProperties,
+ s: str,
+ glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ...,
+ return_new_glyphs_only: bool = ...,
+ ) -> tuple[
+ list[tuple[str, float, float, float]],
+ dict[str, tuple[np.ndarray, np.ndarray]],
+ list[tuple[list[tuple[float, float]], list[int]]],
+ ]: ...
+
+text_to_path: TextToPath
+
+class TextPath(Path):
+ def __init__(
+ self,
+ xy: tuple[float, float],
+ s: str,
+ size: float | None = ...,
+ prop: FontProperties | None = ...,
+ _interpolation_steps: int = ...,
+ usetex: bool = ...,
+ ) -> None: ...
+ def set_size(self, size: float | None) -> None: ...
+ def get_size(self) -> float | None: ...
+
+ # These are read only... there actually are protections in the base class, so probably can be deleted...
+ @property # type: ignore[misc]
+ def vertices(self) -> np.ndarray: ... # type: ignore[override]
+ @property # type: ignore[misc]
+ def codes(self) -> np.ndarray: ... # type: ignore[override]
diff --git a/contrib/python/matplotlib/py3/matplotlib/ticker.pyi b/contrib/python/matplotlib/py3/matplotlib/ticker.pyi
new file mode 100644
index 0000000000..f026b4943c
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/ticker.pyi
@@ -0,0 +1,301 @@
+from collections.abc import Callable, Sequence
+from typing import Any, Literal
+
+from matplotlib.axis import Axis
+from matplotlib.transforms import Transform
+from matplotlib.projections.polar import _AxisWrapper
+
+import numpy as np
+
+class _DummyAxis:
+ __name__: str
+ def __init__(self, minpos: float = ...) -> None: ...
+ def get_view_interval(self) -> tuple[float, float]: ...
+ def set_view_interval(self, vmin: float, vmax: float) -> None: ...
+ def get_minpos(self) -> float: ...
+ def get_data_interval(self) -> tuple[float, float]: ...
+ def set_data_interval(self, vmin: float, vmax: float) -> None: ...
+ def get_tick_space(self) -> int: ...
+
+class TickHelper:
+ axis: None | Axis | _DummyAxis | _AxisWrapper
+ def set_axis(self, axis: Axis | _DummyAxis | _AxisWrapper | None) -> None: ...
+ def create_dummy_axis(self, **kwargs) -> None: ...
+
+class Formatter(TickHelper):
+ locs: list[float]
+ def __call__(self, x: float, pos: int | None = ...) -> str: ...
+ def format_ticks(self, values: list[float]) -> list[str]: ...
+ def format_data(self, value: float) -> str: ...
+ def format_data_short(self, value: float) -> str: ...
+ def get_offset(self) -> str: ...
+ def set_locs(self, locs: list[float]) -> None: ...
+ @staticmethod
+ def fix_minus(s: str) -> str: ...
+
+class NullFormatter(Formatter): ...
+
+class FixedFormatter(Formatter):
+ seq: Sequence[str]
+ offset_string: str
+ def __init__(self, seq: Sequence[str]) -> None: ...
+ def set_offset_string(self, ofs: str) -> None: ...
+
+class FuncFormatter(Formatter):
+ func: Callable[[float, int | None], str]
+ offset_string: str
+ # Callable[[float, int | None], str] | Callable[[float], str]
+ def __init__(self, func: Callable[..., str]) -> None: ...
+ def set_offset_string(self, ofs: str) -> None: ...
+
+class FormatStrFormatter(Formatter):
+ fmt: str
+ def __init__(self, fmt: str) -> None: ...
+
+class StrMethodFormatter(Formatter):
+ fmt: str
+ def __init__(self, fmt: str) -> None: ...
+
+class ScalarFormatter(Formatter):
+ orderOfMagnitude: int
+ format: str
+ def __init__(
+ self,
+ useOffset: bool | float | None = ...,
+ useMathText: bool | None = ...,
+ useLocale: bool | None = ...,
+ ) -> None: ...
+ offset: float
+ def get_useOffset(self) -> bool: ...
+ def set_useOffset(self, val: bool | float) -> None: ...
+ @property
+ def useOffset(self) -> bool: ...
+ @useOffset.setter
+ def useOffset(self, val: bool | float) -> None: ...
+ def get_useLocale(self) -> bool: ...
+ def set_useLocale(self, val: bool | None) -> None: ...
+ @property
+ def useLocale(self) -> bool: ...
+ @useLocale.setter
+ def useLocale(self, val: bool | None) -> None: ...
+ def get_useMathText(self) -> bool: ...
+ def set_useMathText(self, val: bool | None) -> None: ...
+ @property
+ def useMathText(self) -> bool: ...
+ @useMathText.setter
+ def useMathText(self, val: bool | None) -> None: ...
+ def set_scientific(self, b: bool) -> None: ...
+ def set_powerlimits(self, lims: tuple[int, int]) -> None: ...
+ def format_data_short(self, value: float | np.ma.MaskedArray) -> str: ...
+ def format_data(self, value: float) -> str: ...
+
+class LogFormatter(Formatter):
+ minor_thresholds: tuple[float, float]
+ def __init__(
+ self,
+ base: float = ...,
+ labelOnlyBase: bool = ...,
+ minor_thresholds: tuple[float, float] | None = ...,
+ linthresh: float | None = ...,
+ ) -> None: ...
+ def set_base(self, base: float) -> None: ...
+ labelOnlyBase: bool
+ def set_label_minor(self, labelOnlyBase: bool) -> None: ...
+ def set_locs(self, locs: Any | None = ...) -> None: ...
+ def format_data(self, value: float) -> str: ...
+ def format_data_short(self, value: float) -> str: ...
+
+class LogFormatterExponent(LogFormatter): ...
+class LogFormatterMathtext(LogFormatter): ...
+class LogFormatterSciNotation(LogFormatterMathtext): ...
+
+class LogitFormatter(Formatter):
+ def __init__(
+ self,
+ *,
+ use_overline: bool = ...,
+ one_half: str = ...,
+ minor: bool = ...,
+ minor_threshold: int = ...,
+ minor_number: int = ...
+ ) -> None: ...
+ def use_overline(self, use_overline: bool) -> None: ...
+ def set_one_half(self, one_half: str) -> None: ...
+ def set_minor_threshold(self, minor_threshold: int) -> None: ...
+ def set_minor_number(self, minor_number: int) -> None: ...
+ def format_data_short(self, value: float) -> str: ...
+
+class EngFormatter(Formatter):
+ ENG_PREFIXES: dict[int, str]
+ unit: str
+ places: int | None
+ sep: str
+ def __init__(
+ self,
+ unit: str = ...,
+ places: int | None = ...,
+ sep: str = ...,
+ *,
+ usetex: bool | None = ...,
+ useMathText: bool | None = ...
+ ) -> None: ...
+ def get_usetex(self) -> bool: ...
+ def set_usetex(self, val: bool | None) -> None: ...
+ @property
+ def usetex(self) -> bool: ...
+ @usetex.setter
+ def usetex(self, val: bool | None) -> None: ...
+ def get_useMathText(self) -> bool: ...
+ def set_useMathText(self, val: bool | None) -> None: ...
+ @property
+ def useMathText(self) -> bool: ...
+ @useMathText.setter
+ def useMathText(self, val: bool | None) -> None: ...
+ def format_eng(self, num: float) -> str: ...
+
+class PercentFormatter(Formatter):
+ xmax: float
+ decimals: int | None
+ def __init__(
+ self,
+ xmax: float = ...,
+ decimals: int | None = ...,
+ symbol: str | None = ...,
+ is_latex: bool = ...,
+ ) -> None: ...
+ def format_pct(self, x: float, display_range: float) -> str: ...
+ def convert_to_pct(self, x: float) -> float: ...
+ @property
+ def symbol(self) -> str: ...
+ @symbol.setter
+ def symbol(self, symbol: str) -> None: ...
+
+class Locator(TickHelper):
+ MAXTICKS: int
+ def tick_values(self, vmin: float, vmax: float) -> Sequence[float]: ...
+ # Implementation accepts **kwargs, but is a no-op other than a warning
+ # Typing as **kwargs would require each subclass to accept **kwargs for mypy
+ def set_params(self) -> None: ...
+ def __call__(self) -> Sequence[float]: ...
+ def raise_if_exceeds(self, locs: Sequence[float]) -> Sequence[float]: ...
+ def nonsingular(self, v0: float, v1: float) -> tuple[float, float]: ...
+ def view_limits(self, vmin: float, vmax: float) -> tuple[float, float]: ...
+
+class IndexLocator(Locator):
+ offset: float
+ def __init__(self, base: float, offset: float) -> None: ...
+ def set_params(
+ self, base: float | None = ..., offset: float | None = ...
+ ) -> None: ...
+
+class FixedLocator(Locator):
+ nbins: int | None
+ def __init__(self, locs: Sequence[float], nbins: int | None = ...) -> None: ...
+ def set_params(self, nbins: int | None = ...) -> None: ...
+
+class NullLocator(Locator): ...
+
+class LinearLocator(Locator):
+ presets: dict[tuple[float, float], Sequence[float]]
+ def __init__(
+ self,
+ numticks: int | None = ...,
+ presets: dict[tuple[float, float], Sequence[float]] | None = ...,
+ ) -> None: ...
+ @property
+ def numticks(self) -> int: ...
+ @numticks.setter
+ def numticks(self, numticks: int | None) -> None: ...
+ def set_params(
+ self,
+ numticks: int | None = ...,
+ presets: dict[tuple[float, float], Sequence[float]] | None = ...,
+ ) -> None: ...
+
+class MultipleLocator(Locator):
+ def __init__(self, base: float = ..., offset: float = ...) -> None: ...
+ def set_params(self, base: float | None = ..., offset: float | None = ...) -> None: ...
+ def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ...
+
+class _Edge_integer:
+ step: float
+ def __init__(self, step: float, offset: float) -> None: ...
+ def closeto(self, ms: float, edge: float) -> bool: ...
+ def le(self, x: float) -> float: ...
+ def ge(self, x: float) -> float: ...
+
+class MaxNLocator(Locator):
+ default_params: dict[str, Any]
+ def __init__(self, nbins: int | Literal["auto"] | None = ..., **kwargs) -> None: ...
+ def set_params(self, **kwargs) -> None: ...
+ def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ...
+
+class LogLocator(Locator):
+ numdecs: float
+ numticks: int | None
+ def __init__(
+ self,
+ base: float = ...,
+ subs: None | Literal["auto", "all"] | Sequence[float] = ...,
+ numdecs: float = ...,
+ numticks: int | None = ...,
+ ) -> None: ...
+ def set_params(
+ self,
+ base: float | None = ...,
+ subs: Literal["auto", "all"] | Sequence[float] | None = ...,
+ numdecs: float | None = ...,
+ numticks: int | None = ...,
+ ) -> None: ...
+
+class SymmetricalLogLocator(Locator):
+ numticks: int
+ def __init__(
+ self,
+ transform: Transform | None = ...,
+ subs: Sequence[float] | None = ...,
+ linthresh: float | None = ...,
+ base: float | None = ...,
+ ) -> None: ...
+ def set_params(
+ self, subs: Sequence[float] | None = ..., numticks: int | None = ...
+ ) -> None: ...
+
+class AsinhLocator(Locator):
+ linear_width: float
+ numticks: int
+ symthresh: float
+ base: int
+ subs: Sequence[float] | None
+ def __init__(
+ self,
+ linear_width: float,
+ numticks: int = ...,
+ symthresh: float = ...,
+ base: int = ...,
+ subs: Sequence[float] | None = ...,
+ ) -> None: ...
+ def set_params(
+ self,
+ numticks: int | None = ...,
+ symthresh: float | None = ...,
+ base: int | None = ...,
+ subs: Sequence[float] | None = ...,
+ ) -> None: ...
+
+class LogitLocator(MaxNLocator):
+ def __init__(
+ self, minor: bool = ..., *, nbins: Literal["auto"] | int = ...
+ ) -> None: ...
+ def set_params(self, minor: bool | None = ..., **kwargs) -> None: ...
+ @property
+ def minor(self) -> bool: ...
+ @minor.setter
+ def minor(self, value: bool) -> None: ...
+
+class AutoLocator(MaxNLocator):
+ def __init__(self) -> None: ...
+
+class AutoMinorLocator(Locator):
+ ndivs: int
+ def __init__(self, n: int | None = ...) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/transforms.pyi b/contrib/python/matplotlib/py3/matplotlib/transforms.pyi
new file mode 100644
index 0000000000..90a527e5bf
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/transforms.pyi
@@ -0,0 +1,335 @@
+from .path import Path
+from .patches import Patch
+from .figure import Figure
+import numpy as np
+from numpy.typing import ArrayLike
+from collections.abc import Iterable, Sequence
+from typing import Literal
+
+DEBUG: bool
+
+class TransformNode:
+ INVALID_NON_AFFINE: int
+ INVALID_AFFINE: int
+ INVALID: int
+ is_bbox: bool
+ # Implemented as a standard attr in base class, but functionally readonly and some subclasses implement as such
+ @property
+ def is_affine(self) -> bool: ...
+ pass_through: bool
+ def __init__(self, shorthand_name: str | None = ...) -> None: ...
+ def __copy__(self) -> TransformNode: ...
+ def invalidate(self) -> None: ...
+ def set_children(self, *children: TransformNode) -> None: ...
+ def frozen(self) -> TransformNode: ...
+
+class BboxBase(TransformNode):
+ is_bbox: bool
+ is_affine: bool
+ def frozen(self) -> Bbox: ...
+ def __array__(self, *args, **kwargs): ...
+ @property
+ def x0(self) -> float: ...
+ @property
+ def y0(self) -> float: ...
+ @property
+ def x1(self) -> float: ...
+ @property
+ def y1(self) -> float: ...
+ @property
+ def p0(self) -> tuple[float, float]: ...
+ @property
+ def p1(self) -> tuple[float, float]: ...
+ @property
+ def xmin(self) -> float: ...
+ @property
+ def ymin(self) -> float: ...
+ @property
+ def xmax(self) -> float: ...
+ @property
+ def ymax(self) -> float: ...
+ @property
+ def min(self) -> tuple[float, float]: ...
+ @property
+ def max(self) -> tuple[float, float]: ...
+ @property
+ def intervalx(self) -> tuple[float, float]: ...
+ @property
+ def intervaly(self) -> tuple[float, float]: ...
+ @property
+ def width(self) -> float: ...
+ @property
+ def height(self) -> float: ...
+ @property
+ def size(self) -> tuple[float, float]: ...
+ @property
+ def bounds(self) -> tuple[float, float, float, float]: ...
+ @property
+ def extents(self) -> tuple[float, float, float, float]: ...
+ def get_points(self) -> np.ndarray: ...
+ def containsx(self, x: float) -> bool: ...
+ def containsy(self, y: float) -> bool: ...
+ def contains(self, x: float, y: float) -> bool: ...
+ def overlaps(self, other: BboxBase) -> bool: ...
+ def fully_containsx(self, x: float) -> bool: ...
+ def fully_containsy(self, y: float) -> bool: ...
+ def fully_contains(self, x: float, y: float) -> bool: ...
+ def fully_overlaps(self, other: BboxBase) -> bool: ...
+ def transformed(self, transform: Transform) -> Bbox: ...
+ coefs: dict[str, tuple[float, float]]
+ # anchored type can be s/str/Literal["C", "SW", "S", "SE", "E", "NE", "N", "NW", "W"]
+ def anchored(
+ self, c: tuple[float, float] | str, container: BboxBase | None = ...
+ ) -> Bbox: ...
+ def shrunk(self, mx: float, my: float) -> Bbox: ...
+ def shrunk_to_aspect(
+ self,
+ box_aspect: float,
+ container: BboxBase | None = ...,
+ fig_aspect: float = ...,
+ ) -> Bbox: ...
+ def splitx(self, *args: float) -> list[Bbox]: ...
+ def splity(self, *args: float) -> list[Bbox]: ...
+ def count_contains(self, vertices: ArrayLike) -> int: ...
+ def count_overlaps(self, bboxes: Iterable[BboxBase]) -> int: ...
+ def expanded(self, sw: float, sh: float) -> Bbox: ...
+ def padded(self, w_pad: float, h_pad: float | None = ...) -> Bbox: ...
+ def translated(self, tx: float, ty: float) -> Bbox: ...
+ def corners(self) -> np.ndarray: ...
+ def rotated(self, radians: float) -> Bbox: ...
+ @staticmethod
+ def union(bboxes: Sequence[BboxBase]) -> Bbox: ...
+ @staticmethod
+ def intersection(bbox1: BboxBase, bbox2: BboxBase) -> Bbox | None: ...
+
+class Bbox(BboxBase):
+ def __init__(self, points: ArrayLike, **kwargs) -> None: ...
+ @staticmethod
+ def unit() -> Bbox: ...
+ @staticmethod
+ def null() -> Bbox: ...
+ @staticmethod
+ def from_bounds(x0: float, y0: float, width: float, height: float) -> Bbox: ...
+ @staticmethod
+ def from_extents(*args: float, minpos: float | None = ...) -> Bbox: ...
+ def __format__(self, fmt: str) -> str: ...
+ def ignore(self, value: bool) -> None: ...
+ def update_from_path(
+ self,
+ path: Path,
+ ignore: bool | None = ...,
+ updatex: bool = ...,
+ updatey: bool = ...,
+ ) -> None: ...
+ def update_from_data_x(self, x: ArrayLike, ignore: bool | None = ...) -> None: ...
+ def update_from_data_y(self, y: ArrayLike, ignore: bool | None = ...) -> None: ...
+ def update_from_data_xy(
+ self,
+ xy: ArrayLike,
+ ignore: bool | None = ...,
+ updatex: bool = ...,
+ updatey: bool = ...,
+ ) -> None: ...
+ @property
+ def minpos(self) -> float: ...
+ @property
+ def minposx(self) -> float: ...
+ @property
+ def minposy(self) -> float: ...
+ def get_points(self) -> np.ndarray: ...
+ def set_points(self, points: ArrayLike) -> None: ...
+ def set(self, other: Bbox) -> None: ...
+ def mutated(self) -> bool: ...
+ def mutatedx(self) -> bool: ...
+ def mutatedy(self) -> bool: ...
+
+class TransformedBbox(BboxBase):
+ def __init__(self, bbox: Bbox, transform: Transform, **kwargs) -> None: ...
+ def get_points(self) -> np.ndarray: ...
+
+class LockableBbox(BboxBase):
+ def __init__(
+ self,
+ bbox: BboxBase,
+ x0: float | None = ...,
+ y0: float | None = ...,
+ x1: float | None = ...,
+ y1: float | None = ...,
+ **kwargs
+ ) -> None: ...
+ @property
+ def locked_x0(self) -> float | None: ...
+ @locked_x0.setter
+ def locked_x0(self, x0: float | None) -> None: ...
+ @property
+ def locked_y0(self) -> float | None: ...
+ @locked_y0.setter
+ def locked_y0(self, y0: float | None) -> None: ...
+ @property
+ def locked_x1(self) -> float | None: ...
+ @locked_x1.setter
+ def locked_x1(self, x1: float | None) -> None: ...
+ @property
+ def locked_y1(self) -> float | None: ...
+ @locked_y1.setter
+ def locked_y1(self, y1: float | None) -> None: ...
+
+class Transform(TransformNode):
+
+ # Implemented as a standard attrs in base class, but functionally readonly and some subclasses implement as such
+ @property
+ def input_dims(self) -> int | None: ...
+ @property
+ def output_dims(self) -> int | None: ...
+ @property
+ def is_separable(self) -> bool: ...
+ @property
+ def has_inverse(self) -> bool: ...
+
+ def __add__(self, other: Transform) -> Transform: ...
+ @property
+ def depth(self) -> int: ...
+ def contains_branch(self, other: Transform) -> bool: ...
+ def contains_branch_seperately(
+ self, other_transform: Transform
+ ) -> Sequence[bool]: ...
+ def __sub__(self, other: Transform) -> Transform: ...
+ def __array__(self, *args, **kwargs) -> np.ndarray: ...
+ def transform(self, values: ArrayLike) -> np.ndarray: ...
+ def transform_affine(self, values: ArrayLike) -> np.ndarray: ...
+ def transform_non_affine(self, values: ArrayLike) -> ArrayLike: ...
+ def transform_bbox(self, bbox: BboxBase) -> Bbox: ...
+ def get_affine(self) -> Transform: ...
+ def get_matrix(self) -> np.ndarray: ...
+ def transform_point(self, point: ArrayLike) -> np.ndarray: ...
+ def transform_path(self, path: Path) -> Path: ...
+ def transform_path_affine(self, path: Path) -> Path: ...
+ def transform_path_non_affine(self, path: Path) -> Path: ...
+ def transform_angles(
+ self,
+ angles: ArrayLike,
+ pts: ArrayLike,
+ radians: bool = ...,
+ pushoff: float = ...,
+ ) -> np.ndarray: ...
+ def inverted(self) -> Transform: ...
+
+class TransformWrapper(Transform):
+ pass_through: bool
+ def __init__(self, child: Transform) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+ def frozen(self) -> Transform: ...
+ def set(self, child: Transform) -> None: ...
+
+class AffineBase(Transform):
+ is_affine: Literal[True]
+ def __init__(self, *args, **kwargs) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+
+class Affine2DBase(AffineBase):
+ input_dims: Literal[2]
+ output_dims: Literal[2]
+ def frozen(self) -> Affine2D: ...
+ def to_values(self) -> tuple[float, float, float, float, float, float]: ...
+
+class Affine2D(Affine2DBase):
+ def __init__(self, matrix: ArrayLike | None = ..., **kwargs) -> None: ...
+ @staticmethod
+ def from_values(
+ a: float, b: float, c: float, d: float, e: float, f: float
+ ) -> Affine2D: ...
+ def set_matrix(self, mtx: ArrayLike) -> None: ...
+ def clear(self) -> Affine2D: ...
+ def rotate(self, theta: float) -> Affine2D: ...
+ def rotate_deg(self, degrees: float) -> Affine2D: ...
+ def rotate_around(self, x: float, y: float, theta: float) -> Affine2D: ...
+ def rotate_deg_around(self, x: float, y: float, degrees: float) -> Affine2D: ...
+ def translate(self, tx: float, ty: float) -> Affine2D: ...
+ def scale(self, sx: float, sy: float | None = ...) -> Affine2D: ...
+ def skew(self, xShear: float, yShear: float) -> Affine2D: ...
+ def skew_deg(self, xShear: float, yShear: float) -> Affine2D: ...
+
+class IdentityTransform(Affine2DBase): ...
+
+class _BlendedMixin:
+ def __eq__(self, other: object) -> bool: ...
+ def contains_branch_seperately(self, transform: Transform) -> Sequence[bool]: ...
+
+class BlendedGenericTransform(_BlendedMixin, Transform):
+ input_dims: Literal[2]
+ output_dims: Literal[2]
+ pass_through: bool
+ def __init__(
+ self, x_transform: Transform, y_transform: Transform, **kwargs
+ ) -> None: ...
+ @property
+ def depth(self) -> int: ...
+ def contains_branch(self, other: Transform) -> Literal[False]: ...
+ @property
+ def is_affine(self) -> bool: ...
+
+class BlendedAffine2D(_BlendedMixin, Affine2DBase):
+ def __init__(
+ self, x_transform: Transform, y_transform: Transform, **kwargs
+ ) -> None: ...
+
+def blended_transform_factory(
+ x_transform: Transform, y_transform: Transform
+) -> BlendedGenericTransform | BlendedAffine2D: ...
+
+class CompositeGenericTransform(Transform):
+ pass_through: bool
+ def __init__(self, a: Transform, b: Transform, **kwargs) -> None: ...
+
+class CompositeAffine2D(Affine2DBase):
+ def __init__(self, a: Affine2DBase, b: Affine2DBase, **kwargs) -> None: ...
+ @property
+ def depth(self) -> int: ...
+
+def composite_transform_factory(a: Transform, b: Transform) -> Transform: ...
+
+class BboxTransform(Affine2DBase):
+ def __init__(self, boxin: BboxBase, boxout: BboxBase, **kwargs) -> None: ...
+
+class BboxTransformTo(Affine2DBase):
+ def __init__(self, boxout: BboxBase, **kwargs) -> None: ...
+
+class BboxTransformToMaxOnly(BboxTransformTo): ...
+
+class BboxTransformFrom(Affine2DBase):
+ def __init__(self, boxin: BboxBase, **kwargs) -> None: ...
+
+class ScaledTranslation(Affine2DBase):
+ def __init__(
+ self, xt: float, yt: float, scale_trans: Affine2DBase, **kwargs
+ ) -> None: ...
+
+class AffineDeltaTransform(Affine2DBase):
+ def __init__(self, transform: Affine2DBase, **kwargs) -> None: ...
+
+class TransformedPath(TransformNode):
+ def __init__(self, path: Path, transform: Transform) -> None: ...
+ def get_transformed_points_and_affine(self) -> tuple[Path, Transform]: ...
+ def get_transformed_path_and_affine(self) -> tuple[Path, Transform]: ...
+ def get_fully_transformed_path(self) -> Path: ...
+ def get_affine(self) -> Transform: ...
+
+class TransformedPatchPath(TransformedPath):
+ def __init__(self, patch: Patch) -> None: ...
+
+def nonsingular(
+ vmin: float,
+ vmax: float,
+ expander: float = ...,
+ tiny: float = ...,
+ increasing: bool = ...,
+) -> tuple[float, float]: ...
+def interval_contains(interval: tuple[float, float], val: float) -> bool: ...
+def interval_contains_open(interval: tuple[float, float], val: float) -> bool: ...
+def offset_copy(
+ trans: Transform,
+ fig: Figure | None = ...,
+ x: float = ...,
+ y: float = ...,
+ units: Literal["inches", "points", "dots"] = ...,
+) -> Transform: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi
new file mode 100644
index 0000000000..6e00b272ed
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi
@@ -0,0 +1,33 @@
+from matplotlib import _tri
+from matplotlib.tri._trifinder import TriFinder
+
+import numpy as np
+from numpy.typing import ArrayLike
+from typing import Any
+
+class Triangulation:
+ x: np.ndarray
+ y: np.ndarray
+ mask: np.ndarray | None
+ is_delaunay: bool
+ triangles: np.ndarray
+ def __init__(
+ self,
+ x: ArrayLike,
+ y: ArrayLike,
+ triangles: ArrayLike | None = ...,
+ mask: ArrayLike | None = ...,
+ ) -> None: ...
+ def calculate_plane_coefficients(self, z: ArrayLike) -> np.ndarray: ...
+ @property
+ def edges(self) -> np.ndarray: ...
+ def get_cpp_triangulation(self) -> _tri.Triangulation: ...
+ def get_masked_triangles(self) -> np.ndarray: ...
+ @staticmethod
+ def get_from_args_and_kwargs(
+ *args, **kwargs
+ ) -> tuple[Triangulation, tuple[Any, ...], dict[str, Any]]: ...
+ def get_trifinder(self) -> TriFinder: ...
+ @property
+ def neighbors(self) -> np.ndarray: ...
+ def set_mask(self, mask: None | ArrayLike) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi
new file mode 100644
index 0000000000..31929d8661
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi
@@ -0,0 +1,52 @@
+from matplotlib.axes import Axes
+from matplotlib.contour import ContourSet
+from matplotlib.tri._triangulation import Triangulation
+
+from numpy.typing import ArrayLike
+from typing import overload
+
+# TODO: more explicit args/kwargs (for all things in this module)?
+
+class TriContourSet(ContourSet):
+ def __init__(self, ax: Axes, *args, **kwargs) -> None: ...
+
+@overload
+def tricontour(
+ ax: Axes,
+ triangulation: Triangulation,
+ z: ArrayLike,
+ levels: int | ArrayLike = ...,
+ **kwargs
+) -> TriContourSet: ...
+@overload
+def tricontour(
+ ax: Axes,
+ x: ArrayLike,
+ y: ArrayLike,
+ z: ArrayLike,
+ levels: int | ArrayLike = ...,
+ *,
+ triangles: ArrayLike = ...,
+ mask: ArrayLike = ...,
+ **kwargs
+) -> TriContourSet: ...
+@overload
+def tricontourf(
+ ax: Axes,
+ triangulation: Triangulation,
+ z: ArrayLike,
+ levels: int | ArrayLike = ...,
+ **kwargs
+) -> TriContourSet: ...
+@overload
+def tricontourf(
+ ax: Axes,
+ x: ArrayLike,
+ y: ArrayLike,
+ z: ArrayLike,
+ levels: int | ArrayLike = ...,
+ *,
+ triangles: ArrayLike = ...,
+ mask: ArrayLike = ...,
+ **kwargs
+) -> TriContourSet: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi
new file mode 100644
index 0000000000..41a9990b89
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi
@@ -0,0 +1,10 @@
+from matplotlib.tri import Triangulation
+from numpy.typing import ArrayLike
+
+class TriFinder:
+ def __init__(self, triangulation: Triangulation) -> None: ...
+ def __call__(self, x: ArrayLike, y: ArrayLike) -> ArrayLike: ...
+
+class TrapezoidMapTriFinder(TriFinder):
+ def __init__(self, triangulation: Triangulation) -> None: ...
+ def __call__(self, x: ArrayLike, y: ArrayLike) -> ArrayLike: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi
new file mode 100644
index 0000000000..8a56b22acd
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi
@@ -0,0 +1,30 @@
+from matplotlib.tri import Triangulation, TriFinder
+
+from typing import Literal
+import numpy as np
+from numpy.typing import ArrayLike
+
+class TriInterpolator:
+ def __init__(
+ self,
+ triangulation: Triangulation,
+ z: ArrayLike,
+ trifinder: TriFinder | None = ...,
+ ) -> None: ...
+ # __call__ and gradient are not actually implemented by the ABC, but are specified as required
+ def __call__(self, x: ArrayLike, y: ArrayLike) -> np.ma.MaskedArray: ...
+ def gradient(
+ self, x: ArrayLike, y: ArrayLike
+ ) -> tuple[np.ma.MaskedArray, np.ma.MaskedArray]: ...
+
+class LinearTriInterpolator(TriInterpolator): ...
+
+class CubicTriInterpolator(TriInterpolator):
+ def __init__(
+ self,
+ triangulation: Triangulation,
+ z: ArrayLike,
+ kind: Literal["min_E", "geom", "user"] = ...,
+ trifinder: TriFinder | None = ...,
+ dz: tuple[ArrayLike, ArrayLike] | None = ...,
+ ) -> None: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi
new file mode 100644
index 0000000000..42acffcdc5
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi
@@ -0,0 +1,71 @@
+from matplotlib.axes import Axes
+from matplotlib.collections import PolyCollection, TriMesh
+from matplotlib.colors import Normalize, Colormap
+from matplotlib.tri._triangulation import Triangulation
+
+from numpy.typing import ArrayLike
+
+from typing import overload, Literal
+
+@overload
+def tripcolor(
+ ax: Axes,
+ triangulation: Triangulation,
+ c: ArrayLike = ...,
+ *,
+ alpha: float = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ shading: Literal["flat"] = ...,
+ facecolors: ArrayLike | None = ...,
+ **kwargs
+) -> PolyCollection: ...
+@overload
+def tripcolor(
+ ax: Axes,
+ x: ArrayLike,
+ y: ArrayLike,
+ c: ArrayLike = ...,
+ *,
+ alpha: float = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ shading: Literal["flat"] = ...,
+ facecolors: ArrayLike | None = ...,
+ **kwargs
+) -> PolyCollection: ...
+@overload
+def tripcolor(
+ ax: Axes,
+ triangulation: Triangulation,
+ c: ArrayLike = ...,
+ *,
+ alpha: float = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ shading: Literal["gouraud"],
+ facecolors: ArrayLike | None = ...,
+ **kwargs
+) -> TriMesh: ...
+@overload
+def tripcolor(
+ ax: Axes,
+ x: ArrayLike,
+ y: ArrayLike,
+ c: ArrayLike = ...,
+ *,
+ alpha: float = ...,
+ norm: str | Normalize | None = ...,
+ cmap: str | Colormap | None = ...,
+ vmin: float | None = ...,
+ vmax: float | None = ...,
+ shading: Literal["gouraud"],
+ facecolors: ArrayLike | None = ...,
+ **kwargs
+) -> TriMesh: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi
new file mode 100644
index 0000000000..6224276afd
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi
@@ -0,0 +1,15 @@
+from matplotlib.tri._triangulation import Triangulation
+from matplotlib.axes import Axes
+from matplotlib.lines import Line2D
+
+from typing import overload
+from numpy.typing import ArrayLike
+
+@overload
+def triplot(
+ ax: Axes, triangulation: Triangulation, *args, **kwargs
+) -> tuple[Line2D, Line2D]: ...
+@overload
+def triplot(
+ ax: Axes, x: ArrayLike, y: ArrayLike, triangles: ArrayLike = ..., *args, **kwargs
+) -> tuple[Line2D, Line2D]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi
new file mode 100644
index 0000000000..7c60dc76e2
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi
@@ -0,0 +1,31 @@
+from typing import Literal, overload
+
+import numpy as np
+from numpy.typing import ArrayLike
+
+from matplotlib.tri._triangulation import Triangulation
+from matplotlib.tri._triinterpolate import TriInterpolator
+
+class TriRefiner:
+ def __init__(self, triangulation: Triangulation) -> None: ...
+
+class UniformTriRefiner(TriRefiner):
+ def __init__(self, triangulation: Triangulation) -> None: ...
+ @overload
+ def refine_triangulation(
+ self, *, return_tri_index: Literal[True], subdiv: int = ...
+ ) -> tuple[Triangulation, np.ndarray]: ...
+ @overload
+ def refine_triangulation(
+ self, return_tri_index: Literal[False] = ..., subdiv: int = ...
+ ) -> Triangulation: ...
+ @overload
+ def refine_triangulation(
+ self, return_tri_index: bool = ..., subdiv: int = ...
+ ) -> tuple[Triangulation, np.ndarray] | Triangulation: ...
+ def refine_field(
+ self,
+ z: ArrayLike,
+ triinterpolator: TriInterpolator | None = ...,
+ subdiv: int = ...,
+ ) -> tuple[Triangulation, np.ndarray]: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi
new file mode 100644
index 0000000000..9b5e1bec4b
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi
@@ -0,0 +1,12 @@
+from matplotlib.tri import Triangulation
+
+import numpy as np
+
+class TriAnalyzer:
+ def __init__(self, triangulation: Triangulation) -> None: ...
+ @property
+ def scale_factors(self) -> tuple[float, float]: ...
+ def circle_ratios(self, rescale: bool = ...) -> np.ndarray: ...
+ def get_flat_tri_mask(
+ self, min_circle_ratio: float = ..., rescale: bool = ...
+ ) -> np.ndarray: ...
diff --git a/contrib/python/matplotlib/py3/matplotlib/widgets.pyi b/contrib/python/matplotlib/py3/matplotlib/widgets.pyi
new file mode 100644
index 0000000000..00c2d0da8a
--- /dev/null
+++ b/contrib/python/matplotlib/py3/matplotlib/widgets.pyi
@@ -0,0 +1,487 @@
+from .artist import Artist
+from .axes import Axes
+from .backend_bases import FigureCanvasBase, Event, MouseEvent, MouseButton
+from .collections import LineCollection
+from .figure import Figure
+from .lines import Line2D
+from .patches import Circle, Polygon, Rectangle
+from .text import Text
+
+import PIL.Image
+
+from collections.abc import Callable, Collection, Iterable, Sequence
+from typing import Any, Literal
+from numpy.typing import ArrayLike
+from .typing import ColorType
+import numpy as np
+
+class LockDraw:
+ def __init__(self) -> None: ...
+ def __call__(self, o: Any) -> None: ...
+ def release(self, o: Any) -> None: ...
+ def available(self, o: Any) -> bool: ...
+ def isowner(self, o: Any) -> bool: ...
+ def locked(self) -> bool: ...
+
+class Widget:
+ drawon: bool
+ eventson: bool
+ active: bool
+ def set_active(self, active: bool) -> None: ...
+ def get_active(self) -> None: ...
+ def ignore(self, event) -> bool: ...
+
+class AxesWidget(Widget):
+ ax: Axes
+ canvas: FigureCanvasBase | None
+ def __init__(self, ax: Axes) -> None: ...
+ def connect_event(self, event: Event, callback: Callable) -> None: ...
+ def disconnect_events(self) -> None: ...
+
+class Button(AxesWidget):
+ label: Text
+ color: ColorType
+ hovercolor: ColorType
+ def __init__(
+ self,
+ ax: Axes,
+ label: str,
+ image: ArrayLike | PIL.Image.Image | None = ...,
+ color: ColorType = ...,
+ hovercolor: ColorType = ...,
+ *,
+ useblit: bool = ...
+ ) -> None: ...
+ def on_clicked(self, func: Callable[[Event], Any]) -> int: ...
+ def disconnect(self, cid: int) -> None: ...
+
+class SliderBase(AxesWidget):
+ orientation: Literal["horizontal", "vertical"]
+ closedmin: bool
+ closedmax: bool
+ valmin: float
+ valmax: float
+ valstep: float | ArrayLike | None
+ drag_active: bool
+ valfmt: str
+ def __init__(
+ self,
+ ax: Axes,
+ orientation: Literal["horizontal", "vertical"],
+ closedmin: bool,
+ closedmax: bool,
+ valmin: float,
+ valmax: float,
+ valfmt: str,
+ dragging: Slider | None,
+ valstep: float | ArrayLike | None,
+ ) -> None: ...
+ def disconnect(self, cid: int) -> None: ...
+ def reset(self) -> None: ...
+
+class Slider(SliderBase):
+ slidermin: Slider | None
+ slidermax: Slider | None
+ val: float
+ valinit: float
+ track: Rectangle
+ poly: Polygon
+ hline: Line2D
+ vline: Line2D
+ label: Text
+ valtext: Text
+ def __init__(
+ self,
+ ax: Axes,
+ label: str,
+ valmin: float,
+ valmax: float,
+ *,
+ valinit: float = ...,
+ valfmt: str | None = ...,
+ closedmin: bool = ...,
+ closedmax: bool = ...,
+ slidermin: Slider | None = ...,
+ slidermax: Slider | None = ...,
+ dragging: bool = ...,
+ valstep: float | ArrayLike | None = ...,
+ orientation: Literal["horizontal", "vertical"] = ...,
+ initcolor: ColorType = ...,
+ track_color: ColorType = ...,
+ handle_style: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def set_val(self, val: float) -> None: ...
+ def on_changed(self, func: Callable[[float], Any]) -> int: ...
+
+class RangeSlider(SliderBase):
+ val: tuple[float, float]
+ valinit: tuple[float, float]
+ track: Rectangle
+ poly: Polygon
+ label: Text
+ valtext: Text
+ def __init__(
+ self,
+ ax: Axes,
+ label: str,
+ valmin: float,
+ valmax: float,
+ *,
+ valinit: tuple[float, float] | None = ...,
+ valfmt: str | None = ...,
+ closedmin: bool = ...,
+ closedmax: bool = ...,
+ dragging: bool = ...,
+ valstep: float | ArrayLike | None = ...,
+ orientation: Literal["horizontal", "vertical"] = ...,
+ track_color: ColorType = ...,
+ handle_style: dict[str, Any] | None = ...,
+ **kwargs
+ ) -> None: ...
+ def set_min(self, min: float) -> None: ...
+ def set_max(self, max: float) -> None: ...
+ def set_val(self, val: ArrayLike) -> None: ...
+ def on_changed(self, func: Callable[[tuple[float, float]], Any]) -> int: ...
+
+class CheckButtons(AxesWidget):
+ labels: list[Text]
+ def __init__(
+ self,
+ ax: Axes,
+ labels: Sequence[str],
+ actives: Iterable[bool] | None = ...,
+ *,
+ useblit: bool = ...,
+ label_props: dict[str, Any] | None = ...,
+ frame_props: dict[str, Any] | None = ...,
+ check_props: dict[str, Any] | None = ...,
+ ) -> None: ...
+ def set_label_props(self, props: dict[str, Any]) -> None: ...
+ def set_frame_props(self, props: dict[str, Any]) -> None: ...
+ def set_check_props(self, props: dict[str, Any]) -> None: ...
+ def set_active(self, index: int) -> None: ...
+ def get_status(self) -> list[bool]: ...
+ def on_clicked(self, func: Callable[[str], Any]) -> int: ...
+ def disconnect(self, cid: int) -> None: ...
+ @property
+ def lines(self) -> list[tuple[Line2D, Line2D]]: ...
+ @property
+ def rectangles(self) -> list[Rectangle]: ...
+
+class TextBox(AxesWidget):
+ label: Text
+ text_disp: Text
+ cursor_index: int
+ cursor: LineCollection
+ color: ColorType
+ hovercolor: ColorType
+ capturekeystrokes: bool
+ def __init__(
+ self,
+ ax: Axes,
+ label: str,
+ initial: str = ...,
+ *,
+ color: ColorType = ...,
+ hovercolor: ColorType = ...,
+ label_pad: float = ...,
+ textalignment: Literal["left", "center", "right"] = ...,
+ ) -> None: ...
+ @property
+ def text(self) -> str: ...
+ def set_val(self, val: str) -> None: ...
+ def begin_typing(self, x = ...) -> None: ...
+ def stop_typing(self) -> None: ...
+ def on_text_change(self, func: Callable[[str], Any]) -> int: ...
+ def on_submit(self, func: Callable[[str], Any]) -> int: ...
+ def disconnect(self, cid: int) -> None: ...
+
+class RadioButtons(AxesWidget):
+ activecolor: ColorType
+ value_selected: str
+ labels: list[Text]
+ def __init__(
+ self,
+ ax: Axes,
+ labels: Iterable[str],
+ active: int = ...,
+ activecolor: ColorType | None = ...,
+ *,
+ useblit: bool = ...,
+ label_props: dict[str, Any] | Sequence[dict[str, Any]] | None = ...,
+ radio_props: dict[str, Any] | None = ...,
+ ) -> None: ...
+ def set_label_props(self, props: dict[str, Any]) -> None: ...
+ def set_radio_props(self, props: dict[str, Any]) -> None: ...
+ def set_active(self, index: int) -> None: ...
+ def on_clicked(self, func: Callable[[str], Any]) -> int: ...
+ def disconnect(self, cid: int) -> None: ...
+ @property
+ def circles(self) -> list[Circle]: ...
+
+class SubplotTool(Widget):
+ figure: Figure
+ targetfig: Figure
+ buttonreset: Button
+ def __init__(self, targetfig: Figure, toolfig: Figure) -> None: ...
+
+class Cursor(AxesWidget):
+ visible: bool
+ horizOn: bool
+ vertOn: bool
+ useblit: bool
+ lineh: Line2D
+ linev: Line2D
+ background: Any
+ needclear: bool
+ def __init__(
+ self,
+ ax: Axes,
+ *,
+ horizOn: bool = ...,
+ vertOn: bool = ...,
+ useblit: bool = ...,
+ **lineprops
+ ) -> None: ...
+ def clear(self, event: Event) -> None: ...
+ def onmove(self, event: Event) -> None: ...
+
+class MultiCursor(Widget):
+ axes: Sequence[Axes]
+ horizOn: bool
+ vertOn: bool
+ visible: bool
+ useblit: bool
+ needclear: bool
+ vlines: list[Line2D]
+ hlines: list[Line2D]
+ def __init__(
+ self,
+ canvas: Any,
+ axes: Sequence[Axes],
+ *,
+ useblit: bool = ...,
+ horizOn: bool = ...,
+ vertOn: bool = ...,
+ **lineprops
+ ) -> None: ...
+ def connect(self) -> None: ...
+ def disconnect(self) -> None: ...
+ def clear(self, event: Event) -> None: ...
+ def onmove(self, event: Event) -> None: ...
+
+class _SelectorWidget(AxesWidget):
+ onselect: Callable[[float, float], Any]
+ useblit: bool
+ background: Any
+ validButtons: list[MouseButton]
+ def __init__(
+ self,
+ ax: Axes,
+ onselect: Callable[[float, float], Any],
+ useblit: bool = ...,
+ button: MouseButton | Collection[MouseButton] | None = ...,
+ state_modifier_keys: dict[str, str] | None = ...,
+ use_data_coordinates: bool = ...,
+ ) -> None: ...
+ def update_background(self, event: Event) -> None: ...
+ def connect_default_events(self) -> None: ...
+ def ignore(self, event: Event) -> bool: ...
+ def update(self) -> None: ...
+ def press(self, event: Event) -> bool: ...
+ def release(self, event: Event) -> bool: ...
+ def onmove(self, event: Event) -> bool: ...
+ def on_scroll(self, event: Event) -> None: ...
+ def on_key_press(self, event: Event) -> None: ...
+ def on_key_release(self, event: Event) -> None: ...
+ def set_visible(self, visible: bool) -> None: ...
+ def get_visible(self) -> bool: ...
+ @property
+ def visible(self) -> bool: ...
+ def clear(self) -> None: ...
+ @property
+ def artists(self) -> tuple[Artist]: ...
+ def set_props(self, **props) -> None: ...
+ def set_handle_props(self, **handle_props) -> None: ...
+ def add_state(self, state: str) -> None: ...
+ def remove_state(self, state: str) -> None: ...
+
+class SpanSelector(_SelectorWidget):
+ snap_values: ArrayLike | None
+ onmove_callback: Callable[[float, float], Any]
+ minspan: float
+ grab_range: float
+ drag_from_anywhere: bool
+ ignore_event_outside: bool
+ canvas: FigureCanvasBase | None
+ def __init__(
+ self,
+ ax: Axes,
+ onselect: Callable[[float, float], Any],
+ direction: Literal["horizontal", "vertical"],
+ *,
+ minspan: float = ...,
+ useblit: bool = ...,
+ props: dict[str, Any] | None = ...,
+ onmove_callback: Callable[[float, float], Any] | None = ...,
+ interactive: bool = ...,
+ button: MouseButton | Collection[MouseButton] | None = ...,
+ handle_props: dict[str, Any] | None = ...,
+ grab_range: float = ...,
+ state_modifier_keys: dict[str, str] | None = ...,
+ drag_from_anywhere: bool = ...,
+ ignore_event_outside: bool = ...,
+ snap_values: ArrayLike | None = ...,
+ ) -> None: ...
+ def new_axes(self, ax: Axes, *, _props: dict[str, Any] | None = ...) -> None: ...
+ def connect_default_events(self) -> None: ...
+ @property
+ def direction(self) -> Literal["horizontal", "vertical"]: ...
+ @direction.setter
+ def direction(self, direction: Literal["horizontal", "vertical"]) -> None: ...
+ @property
+ def extents(self) -> tuple[float, float]: ...
+ @extents.setter
+ def extents(self, extents: tuple[float, float]) -> None: ...
+
+class ToolLineHandles:
+ ax: Axes
+ def __init__(
+ self,
+ ax: Axes,
+ positions: ArrayLike,
+ direction: Literal["horizontal", "vertical"],
+ *,
+ line_props: dict[str, Any] | None = ...,
+ useblit: bool = ...,
+ ) -> None: ...
+ @property
+ def artists(self) -> tuple[Line2D]: ...
+ @property
+ def positions(self) -> list[float]: ...
+ @property
+ def direction(self) -> Literal["horizontal", "vertical"]: ...
+ def set_data(self, positions: ArrayLike) -> None: ...
+ def set_visible(self, value: bool) -> None: ...
+ def set_animated(self, value: bool) -> None: ...
+ def remove(self) -> None: ...
+ def closest(self, x: float, y: float) -> tuple[int, float]: ...
+
+class ToolHandles:
+ ax: Axes
+ def __init__(
+ self,
+ ax: Axes,
+ x: ArrayLike,
+ y: ArrayLike,
+ *,
+ marker: str = ...,
+ marker_props: dict[str, Any] | None = ...,
+ useblit: bool = ...,
+ ) -> None: ...
+ @property
+ def x(self) -> ArrayLike: ...
+ @property
+ def y(self) -> ArrayLike: ...
+ @property
+ def artists(self) -> tuple[Line2D]: ...
+ def set_data(self, pts: ArrayLike, y: ArrayLike | None = ...) -> None: ...
+ def set_visible(self, val: bool) -> None: ...
+ def set_animated(self, val: bool) -> None: ...
+ def closest(self, x: float, y: float) -> tuple[int, float]: ...
+
+class RectangleSelector(_SelectorWidget):
+ drag_from_anywhere: bool
+ ignore_event_outside: bool
+ minspanx: float
+ minspany: float
+ spancoords: Literal["data", "pixels"]
+ grab_range: float
+ def __init__(
+ self,
+ ax: Axes,
+ onselect: Callable[[MouseEvent, MouseEvent], Any],
+ *,
+ minspanx: float = ...,
+ minspany: float = ...,
+ useblit: bool = ...,
+ props: dict[str, Any] | None = ...,
+ spancoords: Literal["data", "pixels"] = ...,
+ button: MouseButton | Collection[MouseButton] | None = ...,
+ grab_range: float = ...,
+ handle_props: dict[str, Any] | None = ...,
+ interactive: bool = ...,
+ state_modifier_keys: dict[str, str] | None = ...,
+ drag_from_anywhere: bool = ...,
+ ignore_event_outside: bool = ...,
+ use_data_coordinates: bool = ...,
+ ) -> None: ...
+ @property
+ def corners(self) -> tuple[np.ndarray, np.ndarray]: ...
+ @property
+ def edge_centers(self) -> tuple[np.ndarray, np.ndarray]: ...
+ @property
+ def center(self) -> tuple[float, float]: ...
+ @property
+ def extents(self) -> tuple[float, float, float, float]: ...
+ @extents.setter
+ def extents(self, extents: tuple[float, float, float, float]) -> None: ...
+ @property
+ def rotation(self) -> float: ...
+ @rotation.setter
+ def rotation(self, value: float) -> None: ...
+ @property
+ def geometry(self) -> np.ndarray: ...
+
+class EllipseSelector(RectangleSelector): ...
+
+class LassoSelector(_SelectorWidget):
+ verts: None | list[tuple[float, float]]
+ def __init__(
+ self,
+ ax: Axes,
+ onselect: Callable[[list[tuple[float, float]]], Any],
+ *,
+ useblit: bool = ...,
+ props: dict[str, Any] | None = ...,
+ button: MouseButton | Collection[MouseButton] | None = ...,
+ ) -> None: ...
+
+class PolygonSelector(_SelectorWidget):
+ grab_range: float
+ def __init__(
+ self,
+ ax: Axes,
+ onselect: Callable[[ArrayLike, ArrayLike], Any],
+ *,
+ useblit: bool = ...,
+ props: dict[str, Any] | None = ...,
+ handle_props: dict[str, Any] | None = ...,
+ grab_range: float = ...,
+ draw_bounding_box: bool = ...,
+ box_handle_props: dict[str, Any] | None = ...,
+ box_props: dict[str, Any] | None = ...
+ ) -> None: ...
+ def onmove(self, event: Event) -> bool: ...
+ @property
+ def verts(self) -> list[tuple[float, float]]: ...
+ @verts.setter
+ def verts(self, xys: Sequence[tuple[float, float]]) -> None: ...
+
+class Lasso(AxesWidget):
+ useblit: bool
+ background: Any
+ verts: list[tuple[float, float]] | None
+ line: Line2D
+ callback: Callable[[list[tuple[float, float]]], Any]
+ def __init__(
+ self,
+ ax: Axes,
+ xy: tuple[float, float],
+ callback: Callable[[list[tuple[float, float]]], Any],
+ *,
+ useblit: bool = ...,
+ ) -> None: ...
+ def onrelease(self, event: Event) -> None: ...
+ def onmove(self, event: Event) -> None: ...
diff --git a/contrib/python/more-itertools/py3/more_itertools/__init__.pyi b/contrib/python/more-itertools/py3/more_itertools/__init__.pyi
new file mode 100644
index 0000000000..96f6e36c7f
--- /dev/null
+++ b/contrib/python/more-itertools/py3/more_itertools/__init__.pyi
@@ -0,0 +1,2 @@
+from .more import *
+from .recipes import *
diff --git a/contrib/python/more-itertools/py3/more_itertools/more.pyi b/contrib/python/more-itertools/py3/more_itertools/more.pyi
new file mode 100644
index 0000000000..9a5fc911a3
--- /dev/null
+++ b/contrib/python/more-itertools/py3/more_itertools/more.pyi
@@ -0,0 +1,695 @@
+"""Stubs for more_itertools.more"""
+from __future__ import annotations
+
+from types import TracebackType
+from typing import (
+ Any,
+ Callable,
+ Container,
+ ContextManager,
+ Generic,
+ Hashable,
+ Iterable,
+ Iterator,
+ overload,
+ Reversible,
+ Sequence,
+ Sized,
+ Type,
+ TypeVar,
+ type_check_only,
+)
+from typing_extensions import Protocol
+
+# Type and type variable definitions
+_T = TypeVar('_T')
+_T1 = TypeVar('_T1')
+_T2 = TypeVar('_T2')
+_U = TypeVar('_U')
+_V = TypeVar('_V')
+_W = TypeVar('_W')
+_T_co = TypeVar('_T_co', covariant=True)
+_GenFn = TypeVar('_GenFn', bound=Callable[..., Iterator[Any]])
+_Raisable = BaseException | Type[BaseException]
+
+@type_check_only
+class _SizedIterable(Protocol[_T_co], Sized, Iterable[_T_co]): ...
+
+@type_check_only
+class _SizedReversible(Protocol[_T_co], Sized, Reversible[_T_co]): ...
+
+@type_check_only
+class _SupportsSlicing(Protocol[_T_co]):
+ def __getitem__(self, __k: slice) -> _T_co: ...
+
+def chunked(
+ iterable: Iterable[_T], n: int | None, strict: bool = ...
+) -> Iterator[list[_T]]: ...
+@overload
+def first(iterable: Iterable[_T]) -> _T: ...
+@overload
+def first(iterable: Iterable[_T], default: _U) -> _T | _U: ...
+@overload
+def last(iterable: Iterable[_T]) -> _T: ...
+@overload
+def last(iterable: Iterable[_T], default: _U) -> _T | _U: ...
+@overload
+def nth_or_last(iterable: Iterable[_T], n: int) -> _T: ...
+@overload
+def nth_or_last(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
+
+class peekable(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T]) -> None: ...
+ def __iter__(self) -> peekable[_T]: ...
+ def __bool__(self) -> bool: ...
+ @overload
+ def peek(self) -> _T: ...
+ @overload
+ def peek(self, default: _U) -> _T | _U: ...
+ def prepend(self, *items: _T) -> None: ...
+ def __next__(self) -> _T: ...
+ @overload
+ def __getitem__(self, index: int) -> _T: ...
+ @overload
+ def __getitem__(self, index: slice) -> list[_T]: ...
+
+def consumer(func: _GenFn) -> _GenFn: ...
+def ilen(iterable: Iterable[_T]) -> int: ...
+def iterate(func: Callable[[_T], _T], start: _T) -> Iterator[_T]: ...
+def with_iter(
+ context_manager: ContextManager[Iterable[_T]],
+) -> Iterator[_T]: ...
+def one(
+ iterable: Iterable[_T],
+ too_short: _Raisable | None = ...,
+ too_long: _Raisable | None = ...,
+) -> _T: ...
+def raise_(exception: _Raisable, *args: Any) -> None: ...
+def strictly_n(
+ iterable: Iterable[_T],
+ n: int,
+ too_short: _GenFn | None = ...,
+ too_long: _GenFn | None = ...,
+) -> list[_T]: ...
+def distinct_permutations(
+ iterable: Iterable[_T], r: int | None = ...
+) -> Iterator[tuple[_T, ...]]: ...
+def intersperse(
+ e: _U, iterable: Iterable[_T], n: int = ...
+) -> Iterator[_T | _U]: ...
+def unique_to_each(*iterables: Iterable[_T]) -> list[list[_T]]: ...
+@overload
+def windowed(
+ seq: Iterable[_T], n: int, *, step: int = ...
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def windowed(
+ seq: Iterable[_T], n: int, fillvalue: _U, step: int = ...
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def substrings(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def substrings_indexes(
+ seq: Sequence[_T], reverse: bool = ...
+) -> Iterator[tuple[Sequence[_T], int, int]]: ...
+
+class bucket(Generic[_T, _U], Container[_U]):
+ def __init__(
+ self,
+ iterable: Iterable[_T],
+ key: Callable[[_T], _U],
+ validator: Callable[[_U], object] | None = ...,
+ ) -> None: ...
+ def __contains__(self, value: object) -> bool: ...
+ def __iter__(self) -> Iterator[_U]: ...
+ def __getitem__(self, value: object) -> Iterator[_T]: ...
+
+def spy(
+ iterable: Iterable[_T], n: int = ...
+) -> tuple[list[_T], Iterator[_T]]: ...
+def interleave(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def interleave_longest(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def interleave_evenly(
+ iterables: list[Iterable[_T]], lengths: list[int] | None = ...
+) -> Iterator[_T]: ...
+def collapse(
+ iterable: Iterable[Any],
+ base_type: type | None = ...,
+ levels: int | None = ...,
+) -> Iterator[Any]: ...
+@overload
+def side_effect(
+ func: Callable[[_T], object],
+ iterable: Iterable[_T],
+ chunk_size: None = ...,
+ before: Callable[[], object] | None = ...,
+ after: Callable[[], object] | None = ...,
+) -> Iterator[_T]: ...
+@overload
+def side_effect(
+ func: Callable[[list[_T]], object],
+ iterable: Iterable[_T],
+ chunk_size: int,
+ before: Callable[[], object] | None = ...,
+ after: Callable[[], object] | None = ...,
+) -> Iterator[_T]: ...
+def sliced(
+ seq: _SupportsSlicing[_T], n: int, strict: bool = ...
+) -> Iterator[_T]: ...
+def split_at(
+ iterable: Iterable[_T],
+ pred: Callable[[_T], object],
+ maxsplit: int = ...,
+ keep_separator: bool = ...,
+) -> Iterator[list[_T]]: ...
+def split_before(
+ iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
+) -> Iterator[list[_T]]: ...
+def split_after(
+ iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
+) -> Iterator[list[_T]]: ...
+def split_when(
+ iterable: Iterable[_T],
+ pred: Callable[[_T, _T], object],
+ maxsplit: int = ...,
+) -> Iterator[list[_T]]: ...
+def split_into(
+ iterable: Iterable[_T], sizes: Iterable[int | None]
+) -> Iterator[list[_T]]: ...
+@overload
+def padded(
+ iterable: Iterable[_T],
+ *,
+ n: int | None = ...,
+ next_multiple: bool = ...,
+) -> Iterator[_T | None]: ...
+@overload
+def padded(
+ iterable: Iterable[_T],
+ fillvalue: _U,
+ n: int | None = ...,
+ next_multiple: bool = ...,
+) -> Iterator[_T | _U]: ...
+@overload
+def repeat_last(iterable: Iterable[_T]) -> Iterator[_T]: ...
+@overload
+def repeat_last(iterable: Iterable[_T], default: _U) -> Iterator[_T | _U]: ...
+def distribute(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ...
+@overload
+def stagger(
+ iterable: Iterable[_T],
+ offsets: _SizedIterable[int] = ...,
+ longest: bool = ...,
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def stagger(
+ iterable: Iterable[_T],
+ offsets: _SizedIterable[int] = ...,
+ longest: bool = ...,
+ fillvalue: _U = ...,
+) -> Iterator[tuple[_T | _U, ...]]: ...
+
+class UnequalIterablesError(ValueError):
+ def __init__(self, details: tuple[int, int, int] | None = ...) -> None: ...
+
+@overload
+def zip_equal(__iter1: Iterable[_T1]) -> Iterator[tuple[_T1]]: ...
+@overload
+def zip_equal(
+ __iter1: Iterable[_T1], __iter2: Iterable[_T2]
+) -> Iterator[tuple[_T1, _T2]]: ...
+@overload
+def zip_equal(
+ __iter1: Iterable[_T],
+ __iter2: Iterable[_T],
+ __iter3: Iterable[_T],
+ *iterables: Iterable[_T],
+) -> Iterator[tuple[_T, ...]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: None = None,
+) -> Iterator[tuple[_T1 | None]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ __iter2: Iterable[_T2],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: None = None,
+) -> Iterator[tuple[_T1 | None, _T2 | None]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T],
+ __iter2: Iterable[_T],
+ __iter3: Iterable[_T],
+ *iterables: Iterable[_T],
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: None = None,
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U,
+) -> Iterator[tuple[_T1 | _U]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ __iter2: Iterable[_T2],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U,
+) -> Iterator[tuple[_T1 | _U, _T2 | _U]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T],
+ __iter2: Iterable[_T],
+ __iter3: Iterable[_T],
+ *iterables: Iterable[_T],
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U,
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def sort_together(
+ iterables: Iterable[Iterable[_T]],
+ key_list: Iterable[int] = ...,
+ key: Callable[..., Any] | None = ...,
+ reverse: bool = ...,
+) -> list[tuple[_T, ...]]: ...
+def unzip(iterable: Iterable[Sequence[_T]]) -> tuple[Iterator[_T], ...]: ...
+def divide(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ...
+def always_iterable(
+ obj: object,
+ base_type: type | tuple[type | tuple[Any, ...], ...] | None = ...,
+) -> Iterator[Any]: ...
+def adjacent(
+ predicate: Callable[[_T], bool],
+ iterable: Iterable[_T],
+ distance: int = ...,
+) -> Iterator[tuple[bool, _T]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None = None,
+ valuefunc: None = None,
+ reducefunc: None = None,
+) -> Iterator[tuple[_T, Iterator[_T]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None,
+ reducefunc: None,
+) -> Iterator[tuple[_U, Iterator[_T]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None,
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None,
+) -> Iterable[tuple[_T, Iterable[_V]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None,
+) -> Iterable[tuple[_U, Iterator[_V]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None,
+ valuefunc: None,
+ reducefunc: Callable[[Iterator[_T]], _W],
+) -> Iterable[tuple[_T, _W]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None,
+ reducefunc: Callable[[Iterator[_T]], _W],
+) -> Iterable[tuple[_U, _W]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None,
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[Iterable[_V]], _W],
+) -> Iterable[tuple[_T, _W]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[Iterable[_V]], _W],
+) -> Iterable[tuple[_U, _W]]: ...
+
+class numeric_range(Generic[_T, _U], Sequence[_T], Hashable, Reversible[_T]):
+ @overload
+ def __init__(self, __stop: _T) -> None: ...
+ @overload
+ def __init__(self, __start: _T, __stop: _T) -> None: ...
+ @overload
+ def __init__(self, __start: _T, __stop: _T, __step: _U) -> None: ...
+ def __bool__(self) -> bool: ...
+ def __contains__(self, elem: object) -> bool: ...
+ def __eq__(self, other: object) -> bool: ...
+ @overload
+ def __getitem__(self, key: int) -> _T: ...
+ @overload
+ def __getitem__(self, key: slice) -> numeric_range[_T, _U]: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[_T]: ...
+ def __len__(self) -> int: ...
+ def __reduce__(
+ self,
+ ) -> tuple[Type[numeric_range[_T, _U]], tuple[_T, _T, _U]]: ...
+ def __repr__(self) -> str: ...
+ def __reversed__(self) -> Iterator[_T]: ...
+ def count(self, value: _T) -> int: ...
+ def index(self, value: _T) -> int: ... # type: ignore
+
+def count_cycle(
+ iterable: Iterable[_T], n: int | None = ...
+) -> Iterable[tuple[int, _T]]: ...
+def mark_ends(
+ iterable: Iterable[_T],
+) -> Iterable[tuple[bool, bool, _T]]: ...
+def locate(
+ iterable: Iterable[_T],
+ pred: Callable[..., Any] = ...,
+ window_size: int | None = ...,
+) -> Iterator[int]: ...
+def lstrip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+def rstrip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+def strip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+
+class islice_extended(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T], *args: int | None) -> None: ...
+ def __iter__(self) -> islice_extended[_T]: ...
+ def __next__(self) -> _T: ...
+ def __getitem__(self, index: slice) -> islice_extended[_T]: ...
+
+def always_reversible(iterable: Iterable[_T]) -> Iterator[_T]: ...
+def consecutive_groups(
+ iterable: Iterable[_T], ordering: Callable[[_T], int] = ...
+) -> Iterator[Iterator[_T]]: ...
+@overload
+def difference(
+ iterable: Iterable[_T],
+ func: Callable[[_T, _T], _U] = ...,
+ *,
+ initial: None = ...,
+) -> Iterator[_T | _U]: ...
+@overload
+def difference(
+ iterable: Iterable[_T], func: Callable[[_T, _T], _U] = ..., *, initial: _U
+) -> Iterator[_U]: ...
+
+class SequenceView(Generic[_T], Sequence[_T]):
+ def __init__(self, target: Sequence[_T]) -> None: ...
+ @overload
+ def __getitem__(self, index: int) -> _T: ...
+ @overload
+ def __getitem__(self, index: slice) -> Sequence[_T]: ...
+ def __len__(self) -> int: ...
+
+class seekable(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, iterable: Iterable[_T], maxlen: int | None = ...
+ ) -> None: ...
+ def __iter__(self) -> seekable[_T]: ...
+ def __next__(self) -> _T: ...
+ def __bool__(self) -> bool: ...
+ @overload
+ def peek(self) -> _T: ...
+ @overload
+ def peek(self, default: _U) -> _T | _U: ...
+ def elements(self) -> SequenceView[_T]: ...
+ def seek(self, index: int) -> None: ...
+ def relative_seek(self, count: int) -> None: ...
+
+class run_length:
+ @staticmethod
+ def encode(iterable: Iterable[_T]) -> Iterator[tuple[_T, int]]: ...
+ @staticmethod
+ def decode(iterable: Iterable[tuple[_T, int]]) -> Iterator[_T]: ...
+
+def exactly_n(
+ iterable: Iterable[_T], n: int, predicate: Callable[[_T], object] = ...
+) -> bool: ...
+def circular_shifts(iterable: Iterable[_T]) -> list[tuple[_T, ...]]: ...
+def make_decorator(
+ wrapping_func: Callable[..., _U], result_index: int = ...
+) -> Callable[..., Callable[[Callable[..., Any]], Callable[..., _U]]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None = ...,
+ reducefunc: None = ...,
+) -> dict[_U, list[_T]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None = ...,
+) -> dict[_U, list[_V]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None = ...,
+ reducefunc: Callable[[list[_T]], _W] = ...,
+) -> dict[_U, _W]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[list[_V]], _W],
+) -> dict[_U, _W]: ...
+def rlocate(
+ iterable: Iterable[_T],
+ pred: Callable[..., object] = ...,
+ window_size: int | None = ...,
+) -> Iterator[int]: ...
+def replace(
+ iterable: Iterable[_T],
+ pred: Callable[..., object],
+ substitutes: Iterable[_U],
+ count: int | None = ...,
+ window_size: int = ...,
+) -> Iterator[_T | _U]: ...
+def partitions(iterable: Iterable[_T]) -> Iterator[list[list[_T]]]: ...
+def set_partitions(
+ iterable: Iterable[_T], k: int | None = ...
+) -> Iterator[list[list[_T]]]: ...
+
+class time_limited(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, limit_seconds: float, iterable: Iterable[_T]
+ ) -> None: ...
+ def __iter__(self) -> islice_extended[_T]: ...
+ def __next__(self) -> _T: ...
+
+@overload
+def only(
+ iterable: Iterable[_T], *, too_long: _Raisable | None = ...
+) -> _T | None: ...
+@overload
+def only(
+ iterable: Iterable[_T], default: _U, too_long: _Raisable | None = ...
+) -> _T | _U: ...
+def ichunked(iterable: Iterable[_T], n: int) -> Iterator[Iterator[_T]]: ...
+def distinct_combinations(
+ iterable: Iterable[_T], r: int
+) -> Iterator[tuple[_T, ...]]: ...
+def filter_except(
+ validator: Callable[[Any], object],
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException],
+) -> Iterator[_T]: ...
+def map_except(
+ function: Callable[[Any], _U],
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException],
+) -> Iterator[_U]: ...
+def map_if(
+ iterable: Iterable[Any],
+ pred: Callable[[Any], bool],
+ func: Callable[[Any], Any],
+ func_else: Callable[[Any], Any] | None = ...,
+) -> Iterator[Any]: ...
+def sample(
+ iterable: Iterable[_T],
+ k: int,
+ weights: Iterable[float] | None = ...,
+) -> list[_T]: ...
+def is_sorted(
+ iterable: Iterable[_T],
+ key: Callable[[_T], _U] | None = ...,
+ reverse: bool = False,
+ strict: bool = False,
+) -> bool: ...
+
+class AbortThread(BaseException):
+ pass
+
+class callback_iter(Generic[_T], Iterator[_T]):
+ def __init__(
+ self,
+ func: Callable[..., Any],
+ callback_kwd: str = ...,
+ wait_seconds: float = ...,
+ ) -> None: ...
+ def __enter__(self) -> callback_iter[_T]: ...
+ def __exit__(
+ self,
+ exc_type: Type[BaseException] | None,
+ exc_value: BaseException | None,
+ traceback: TracebackType | None,
+ ) -> bool | None: ...
+ def __iter__(self) -> callback_iter[_T]: ...
+ def __next__(self) -> _T: ...
+ def _reader(self) -> Iterator[_T]: ...
+ @property
+ def done(self) -> bool: ...
+ @property
+ def result(self) -> Any: ...
+
+def windowed_complete(
+ iterable: Iterable[_T], n: int
+) -> Iterator[tuple[_T, ...]]: ...
+def all_unique(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> bool: ...
+def nth_product(index: int, *args: Iterable[_T]) -> tuple[_T, ...]: ...
+def nth_combination_with_replacement(
+ iterable: Iterable[_T], r: int, index: int
+) -> tuple[_T, ...]: ...
+def nth_permutation(
+ iterable: Iterable[_T], r: int, index: int
+) -> tuple[_T, ...]: ...
+def value_chain(*args: _T | Iterable[_T]) -> Iterable[_T]: ...
+def product_index(element: Iterable[_T], *args: Iterable[_T]) -> int: ...
+def combination_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+def combination_with_replacement_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+def permutation_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+def repeat_each(iterable: Iterable[_T], n: int = ...) -> Iterator[_T]: ...
+
+class countable(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T]) -> None: ...
+ def __iter__(self) -> countable[_T]: ...
+ def __next__(self) -> _T: ...
+
+def chunked_even(iterable: Iterable[_T], n: int) -> Iterator[list[_T]]: ...
+def zip_broadcast(
+ *objects: _T | Iterable[_T],
+ scalar_types: type | tuple[type | tuple[Any, ...], ...] | None = ...,
+ strict: bool = ...,
+) -> Iterable[tuple[_T, ...]]: ...
+def unique_in_window(
+ iterable: Iterable[_T], n: int, key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def duplicates_everseen(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def duplicates_justseen(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def classify_unique(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[tuple[_T, bool, bool]]: ...
+
+class _SupportsLessThan(Protocol):
+ def __lt__(self, __other: Any) -> bool: ...
+
+_SupportsLessThanT = TypeVar("_SupportsLessThanT", bound=_SupportsLessThan)
+
+@overload
+def minmax(
+ iterable_or_value: Iterable[_SupportsLessThanT], *, key: None = None
+) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+ iterable_or_value: Iterable[_T], *, key: Callable[[_T], _SupportsLessThan]
+) -> tuple[_T, _T]: ...
+@overload
+def minmax(
+ iterable_or_value: Iterable[_SupportsLessThanT],
+ *,
+ key: None = None,
+ default: _U,
+) -> _U | tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+ iterable_or_value: Iterable[_T],
+ *,
+ key: Callable[[_T], _SupportsLessThan],
+ default: _U,
+) -> _U | tuple[_T, _T]: ...
+@overload
+def minmax(
+ iterable_or_value: _SupportsLessThanT,
+ __other: _SupportsLessThanT,
+ *others: _SupportsLessThanT,
+) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+ iterable_or_value: _T,
+ __other: _T,
+ *others: _T,
+ key: Callable[[_T], _SupportsLessThan],
+) -> tuple[_T, _T]: ...
+def longest_common_prefix(
+ iterables: Iterable[Iterable[_T]],
+) -> Iterator[_T]: ...
+def iequals(*iterables: Iterable[Any]) -> bool: ...
+def constrained_batches(
+ iterable: Iterable[_T],
+ max_size: int,
+ max_count: int | None = ...,
+ get_len: Callable[[_T], object] = ...,
+ strict: bool = ...,
+) -> Iterator[tuple[_T]]: ...
+def gray_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def partial_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def takewhile_inclusive(
+ predicate: Callable[[_T], bool], iterable: Iterable[_T]
+) -> Iterator[_T]: ...
+def outer_product(
+ func: Callable[[_T, _U], _V],
+ xs: Iterable[_T],
+ ys: Iterable[_U],
+ *args: Any,
+ **kwargs: Any,
+) -> Iterator[tuple[_V, ...]]: ...
+def iter_suppress(
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException],
+) -> Iterator[_T]: ...
+def filter_map(
+ func: Callable[[_T], _V | None],
+ iterable: Iterable[_T],
+) -> Iterator[_V]: ...
diff --git a/contrib/python/more-itertools/py3/more_itertools/recipes.pyi b/contrib/python/more-itertools/py3/more_itertools/recipes.pyi
new file mode 100644
index 0000000000..ed4c19db49
--- /dev/null
+++ b/contrib/python/more-itertools/py3/more_itertools/recipes.pyi
@@ -0,0 +1,128 @@
+"""Stubs for more_itertools.recipes"""
+from __future__ import annotations
+
+from typing import (
+ Any,
+ Callable,
+ Iterable,
+ Iterator,
+ overload,
+ Sequence,
+ Type,
+ TypeVar,
+)
+
+# Type and type variable definitions
+_T = TypeVar('_T')
+_T1 = TypeVar('_T1')
+_T2 = TypeVar('_T2')
+_U = TypeVar('_U')
+
+def take(n: int, iterable: Iterable[_T]) -> list[_T]: ...
+def tabulate(
+ function: Callable[[int], _T], start: int = ...
+) -> Iterator[_T]: ...
+def tail(n: int, iterable: Iterable[_T]) -> Iterator[_T]: ...
+def consume(iterator: Iterable[_T], n: int | None = ...) -> None: ...
+@overload
+def nth(iterable: Iterable[_T], n: int) -> _T | None: ...
+@overload
+def nth(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
+def all_equal(iterable: Iterable[_T]) -> bool: ...
+def quantify(
+ iterable: Iterable[_T], pred: Callable[[_T], bool] = ...
+) -> int: ...
+def pad_none(iterable: Iterable[_T]) -> Iterator[_T | None]: ...
+def padnone(iterable: Iterable[_T]) -> Iterator[_T | None]: ...
+def ncycles(iterable: Iterable[_T], n: int) -> Iterator[_T]: ...
+def dotproduct(vec1: Iterable[_T1], vec2: Iterable[_T2]) -> Any: ...
+def flatten(listOfLists: Iterable[Iterable[_T]]) -> Iterator[_T]: ...
+def repeatfunc(
+ func: Callable[..., _U], times: int | None = ..., *args: Any
+) -> Iterator[_U]: ...
+def pairwise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T]]: ...
+def grouper(
+ iterable: Iterable[_T],
+ n: int,
+ incomplete: str = ...,
+ fillvalue: _U = ...,
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def roundrobin(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def partition(
+ pred: Callable[[_T], object] | None, iterable: Iterable[_T]
+) -> tuple[Iterator[_T], Iterator[_T]]: ...
+def powerset(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def unique_everseen(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def unique_justseen(
+ iterable: Iterable[_T], key: Callable[[_T], object] | None = ...
+) -> Iterator[_T]: ...
+@overload
+def iter_except(
+ func: Callable[[], _T],
+ exception: Type[BaseException] | tuple[Type[BaseException], ...],
+ first: None = ...,
+) -> Iterator[_T]: ...
+@overload
+def iter_except(
+ func: Callable[[], _T],
+ exception: Type[BaseException] | tuple[Type[BaseException], ...],
+ first: Callable[[], _U],
+) -> Iterator[_T | _U]: ...
+@overload
+def first_true(
+ iterable: Iterable[_T], *, pred: Callable[[_T], object] | None = ...
+) -> _T | None: ...
+@overload
+def first_true(
+ iterable: Iterable[_T],
+ default: _U,
+ pred: Callable[[_T], object] | None = ...,
+) -> _T | _U: ...
+def random_product(
+ *args: Iterable[_T], repeat: int = ...
+) -> tuple[_T, ...]: ...
+def random_permutation(
+ iterable: Iterable[_T], r: int | None = ...
+) -> tuple[_T, ...]: ...
+def random_combination(iterable: Iterable[_T], r: int) -> tuple[_T, ...]: ...
+def random_combination_with_replacement(
+ iterable: Iterable[_T], r: int
+) -> tuple[_T, ...]: ...
+def nth_combination(
+ iterable: Iterable[_T], r: int, index: int
+) -> tuple[_T, ...]: ...
+def prepend(value: _T, iterator: Iterable[_U]) -> Iterator[_T | _U]: ...
+def convolve(signal: Iterable[_T], kernel: Iterable[_T]) -> Iterator[_T]: ...
+def before_and_after(
+ predicate: Callable[[_T], bool], it: Iterable[_T]
+) -> tuple[Iterator[_T], Iterator[_T]]: ...
+def triplewise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T, _T]]: ...
+def sliding_window(
+ iterable: Iterable[_T], n: int
+) -> Iterator[tuple[_T, ...]]: ...
+def subslices(iterable: Iterable[_T]) -> Iterator[list[_T]]: ...
+def polynomial_from_roots(roots: Sequence[_T]) -> list[_T]: ...
+def iter_index(
+ iterable: Iterable[_T],
+ value: Any,
+ start: int | None = ...,
+ stop: int | None = ...,
+) -> Iterator[int]: ...
+def sieve(n: int) -> Iterator[int]: ...
+def batched(
+ iterable: Iterable[_T], n: int, *, strict: bool = False
+) -> Iterator[tuple[_T]]: ...
+def transpose(
+ it: Iterable[Iterable[_T]],
+) -> Iterator[tuple[_T, ...]]: ...
+def reshape(
+ matrix: Iterable[Iterable[_T]], cols: int
+) -> Iterator[tuple[_T, ...]]: ...
+def matmul(m1: Sequence[_T], m2: Sequence[_T]) -> Iterator[tuple[_T]]: ...
+def factor(n: int) -> Iterator[int]: ...
+def polynomial_eval(coefficients: Sequence[_T], x: _U) -> _U: ...
+def sum_of_squares(it: Iterable[_T]) -> _T: ...
+def polynomial_derivative(coefficients: Sequence[_T]) -> list[_T]: ...
+def totient(n: int) -> int: ...
diff --git a/contrib/python/multidict/multidict/__init__.pyi b/contrib/python/multidict/multidict/__init__.pyi
new file mode 100644
index 0000000000..0940340f81
--- /dev/null
+++ b/contrib/python/multidict/multidict/__init__.pyi
@@ -0,0 +1,152 @@
+import abc
+from typing import (
+ Generic,
+ Iterable,
+ Iterator,
+ Mapping,
+ MutableMapping,
+ TypeVar,
+ overload,
+)
+
+class istr(str): ...
+
+upstr = istr
+
+_S = str | istr
+
+_T = TypeVar("_T")
+
+_T_co = TypeVar("_T_co", covariant=True)
+
+_D = TypeVar("_D")
+
+class MultiMapping(Mapping[_S, _T_co]):
+ @overload
+ @abc.abstractmethod
+ def getall(self, key: _S) -> list[_T_co]: ...
+ @overload
+ @abc.abstractmethod
+ def getall(self, key: _S, default: _D) -> list[_T_co] | _D: ...
+ @overload
+ @abc.abstractmethod
+ def getone(self, key: _S) -> _T_co: ...
+ @overload
+ @abc.abstractmethod
+ def getone(self, key: _S, default: _D) -> _T_co | _D: ...
+
+_Arg = (
+ Mapping[str, _T]
+ | Mapping[istr, _T]
+ | dict[str, _T]
+ | dict[istr, _T]
+ | MultiMapping[_T]
+ | Iterable[tuple[str, _T]]
+ | Iterable[tuple[istr, _T]]
+)
+
+class MutableMultiMapping(MultiMapping[_T], MutableMapping[_S, _T], Generic[_T]):
+ @abc.abstractmethod
+ def add(self, key: _S, value: _T) -> None: ...
+ @abc.abstractmethod
+ def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
+ @overload
+ @abc.abstractmethod
+ def popone(self, key: _S) -> _T: ...
+ @overload
+ @abc.abstractmethod
+ def popone(self, key: _S, default: _D) -> _T | _D: ...
+ @overload
+ @abc.abstractmethod
+ def popall(self, key: _S) -> list[_T]: ...
+ @overload
+ @abc.abstractmethod
+ def popall(self, key: _S, default: _D) -> list[_T] | _D: ...
+
+class MultiDict(MutableMultiMapping[_T], Generic[_T]):
+ def __init__(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
+ def copy(self) -> MultiDict[_T]: ...
+ def __getitem__(self, k: _S) -> _T: ...
+ def __setitem__(self, k: _S, v: _T) -> None: ...
+ def __delitem__(self, v: _S) -> None: ...
+ def __iter__(self) -> Iterator[_S]: ...
+ def __len__(self) -> int: ...
+ @overload
+ def getall(self, key: _S) -> list[_T]: ...
+ @overload
+ def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
+ @overload
+ def getone(self, key: _S) -> _T: ...
+ @overload
+ def getone(self, key: _S, default: _D) -> _T | _D: ...
+ def add(self, key: _S, value: _T) -> None: ...
+ def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
+ @overload
+ def popone(self, key: _S) -> _T: ...
+ @overload
+ def popone(self, key: _S, default: _D) -> _T | _D: ...
+ @overload
+ def popall(self, key: _S) -> list[_T]: ...
+ @overload
+ def popall(self, key: _S, default: _D) -> list[_T] | _D: ...
+
+class CIMultiDict(MutableMultiMapping[_T], Generic[_T]):
+ def __init__(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
+ def copy(self) -> CIMultiDict[_T]: ...
+ def __getitem__(self, k: _S) -> _T: ...
+ def __setitem__(self, k: _S, v: _T) -> None: ...
+ def __delitem__(self, v: _S) -> None: ...
+ def __iter__(self) -> Iterator[_S]: ...
+ def __len__(self) -> int: ...
+ @overload
+ def getall(self, key: _S) -> list[_T]: ...
+ @overload
+ def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
+ @overload
+ def getone(self, key: _S) -> _T: ...
+ @overload
+ def getone(self, key: _S, default: _D) -> _T | _D: ...
+ def add(self, key: _S, value: _T) -> None: ...
+ def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
+ @overload
+ def popone(self, key: _S) -> _T: ...
+ @overload
+ def popone(self, key: _S, default: _D) -> _T | _D: ...
+ @overload
+ def popall(self, key: _S) -> list[_T]: ...
+ @overload
+ def popall(self, key: _S, default: _D) -> list[_T] | _D: ...
+
+class MultiDictProxy(MultiMapping[_T], Generic[_T]):
+ def __init__(self, arg: MultiMapping[_T] | MutableMultiMapping[_T]) -> None: ...
+ def copy(self) -> MultiDict[_T]: ...
+ def __getitem__(self, k: _S) -> _T: ...
+ def __iter__(self) -> Iterator[_S]: ...
+ def __len__(self) -> int: ...
+ @overload
+ def getall(self, key: _S) -> list[_T]: ...
+ @overload
+ def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
+ @overload
+ def getone(self, key: _S) -> _T: ...
+ @overload
+ def getone(self, key: _S, default: _D) -> _T | _D: ...
+
+class CIMultiDictProxy(MultiMapping[_T], Generic[_T]):
+ def __init__(self, arg: MultiMapping[_T] | MutableMultiMapping[_T]) -> None: ...
+ def __getitem__(self, k: _S) -> _T: ...
+ def __iter__(self) -> Iterator[_S]: ...
+ def __len__(self) -> int: ...
+ @overload
+ def getall(self, key: _S) -> list[_T]: ...
+ @overload
+ def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
+ @overload
+ def getone(self, key: _S) -> _T: ...
+ @overload
+ def getone(self, key: _S, default: _D) -> _T | _D: ...
+ def copy(self) -> CIMultiDict[_T]: ...
+
+def getversion(
+ md: MultiDict[_T] | CIMultiDict[_T] | MultiDictProxy[_T] | CIMultiDictProxy[_T],
+) -> int: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/algos.pyi b/contrib/python/pandas/py3/pandas/_libs/algos.pyi
new file mode 100644
index 0000000000..20a805533e
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/algos.pyi
@@ -0,0 +1,420 @@
+from typing import Any
+
+import numpy as np
+
+from pandas._typing import npt
+
+class Infinity:
+ """
+ Provide a positive Infinity comparison method for ranking.
+ """
+
+ def __eq__(self, other) -> bool: ...
+ def __ne__(self, other) -> bool: ...
+ def __lt__(self, other) -> bool: ...
+ def __le__(self, other) -> bool: ...
+ def __gt__(self, other) -> bool: ...
+ def __ge__(self, other) -> bool: ...
+
+class NegInfinity:
+ """
+ Provide a negative Infinity comparison method for ranking.
+ """
+
+ def __eq__(self, other) -> bool: ...
+ def __ne__(self, other) -> bool: ...
+ def __lt__(self, other) -> bool: ...
+ def __le__(self, other) -> bool: ...
+ def __gt__(self, other) -> bool: ...
+ def __ge__(self, other) -> bool: ...
+
+def unique_deltas(
+ arr: np.ndarray, # const int64_t[:]
+) -> np.ndarray: ... # np.ndarray[np.int64, ndim=1]
+def is_lexsorted(list_of_arrays: list[npt.NDArray[np.int64]]) -> bool: ...
+def groupsort_indexer(
+ index: np.ndarray, # const int64_t[:]
+ ngroups: int,
+) -> tuple[
+ np.ndarray, # ndarray[int64_t, ndim=1]
+ np.ndarray, # ndarray[int64_t, ndim=1]
+]: ...
+def kth_smallest(
+ arr: np.ndarray, # numeric[:]
+ k: int,
+) -> Any: ... # numeric
+
+# ----------------------------------------------------------------------
+# Pairwise correlation/covariance
+
+def nancorr(
+ mat: npt.NDArray[np.float64], # const float64_t[:, :]
+ cov: bool = ...,
+ minp: int | None = ...,
+) -> npt.NDArray[np.float64]: ... # ndarray[float64_t, ndim=2]
+def nancorr_spearman(
+ mat: npt.NDArray[np.float64], # ndarray[float64_t, ndim=2]
+ minp: int = ...,
+) -> npt.NDArray[np.float64]: ... # ndarray[float64_t, ndim=2]
+
+# ----------------------------------------------------------------------
+
+def validate_limit(nobs: int | None, limit=...) -> int: ...
+def pad(
+ old: np.ndarray, # ndarray[numeric_object_t]
+ new: np.ndarray, # ndarray[numeric_object_t]
+ limit=...,
+) -> npt.NDArray[np.intp]: ... # np.ndarray[np.intp, ndim=1]
+def pad_inplace(
+ values: np.ndarray, # numeric_object_t[:]
+ mask: np.ndarray, # uint8_t[:]
+ limit=...,
+) -> None: ...
+def pad_2d_inplace(
+ values: np.ndarray, # numeric_object_t[:, :]
+ mask: np.ndarray, # const uint8_t[:, :]
+ limit=...,
+) -> None: ...
+def backfill(
+ old: np.ndarray, # ndarray[numeric_object_t]
+ new: np.ndarray, # ndarray[numeric_object_t]
+ limit=...,
+) -> npt.NDArray[np.intp]: ... # np.ndarray[np.intp, ndim=1]
+def backfill_inplace(
+ values: np.ndarray, # numeric_object_t[:]
+ mask: np.ndarray, # uint8_t[:]
+ limit=...,
+) -> None: ...
+def backfill_2d_inplace(
+ values: np.ndarray, # numeric_object_t[:, :]
+ mask: np.ndarray, # const uint8_t[:, :]
+ limit=...,
+) -> None: ...
+def is_monotonic(
+ arr: np.ndarray, # ndarray[numeric_object_t, ndim=1]
+ timelike: bool,
+) -> tuple[bool, bool, bool]: ...
+
+# ----------------------------------------------------------------------
+# rank_1d, rank_2d
+# ----------------------------------------------------------------------
+
+def rank_1d(
+ values: np.ndarray, # ndarray[numeric_object_t, ndim=1]
+ labels: np.ndarray | None = ..., # const int64_t[:]=None
+ is_datetimelike: bool = ...,
+ ties_method=...,
+ ascending: bool = ...,
+ pct: bool = ...,
+ na_option=...,
+ mask: npt.NDArray[np.bool_] | None = ...,
+) -> np.ndarray: ... # np.ndarray[float64_t, ndim=1]
+def rank_2d(
+ in_arr: np.ndarray, # ndarray[numeric_object_t, ndim=2]
+ axis: int = ...,
+ is_datetimelike: bool = ...,
+ ties_method=...,
+ ascending: bool = ...,
+ na_option=...,
+ pct: bool = ...,
+) -> np.ndarray: ... # np.ndarray[float64_t, ndim=1]
+def diff_2d(
+ arr: np.ndarray, # ndarray[diff_t, ndim=2]
+ out: np.ndarray, # ndarray[out_t, ndim=2]
+ periods: int,
+ axis: int,
+ datetimelike: bool = ...,
+) -> None: ...
+def ensure_platform_int(arr: object) -> npt.NDArray[np.intp]: ...
+def ensure_object(arr: object) -> npt.NDArray[np.object_]: ...
+def ensure_float64(arr: object) -> npt.NDArray[np.float64]: ...
+def ensure_int8(arr: object) -> npt.NDArray[np.int8]: ...
+def ensure_int16(arr: object) -> npt.NDArray[np.int16]: ...
+def ensure_int32(arr: object) -> npt.NDArray[np.int32]: ...
+def ensure_int64(arr: object) -> npt.NDArray[np.int64]: ...
+def ensure_uint64(arr: object) -> npt.NDArray[np.uint64]: ...
+def take_1d_int8_int8(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int8_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int8_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int8_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int16_int16(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int16_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int16_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int16_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int32_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int32_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int32_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int64_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_int64_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_float32_float32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_float32_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_float64_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_object_object(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_bool_bool(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_1d_bool_object(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int8_int8(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int8_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int8_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int8_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int16_int16(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int16_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int16_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int16_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int32_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int32_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int32_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int64_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_int64_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_float32_float32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_float32_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_float64_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_object_object(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_bool_bool(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis0_bool_object(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int8_int8(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int8_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int8_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int8_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int16_int16(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int16_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int16_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int16_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int32_int32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int32_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int32_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int64_int64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_int64_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_float32_float32(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_float32_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_float64_float64(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_object_object(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_bool_bool(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_axis1_bool_object(
+ values: np.ndarray, indexer: npt.NDArray[np.intp], out: np.ndarray, fill_value=...
+) -> None: ...
+def take_2d_multi_int8_int8(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int8_int32(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int8_int64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int8_float64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int16_int16(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int16_int32(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int16_int64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int16_float64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int32_int32(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int32_int64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int32_float64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int64_float64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_float32_float32(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_float32_float64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_float64_float64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_object_object(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_bool_bool(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_bool_object(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
+def take_2d_multi_int64_int64(
+ values: np.ndarray,
+ indexer: tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]],
+ out: np.ndarray,
+ fill_value=...,
+) -> None: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/arrays.pyi b/contrib/python/pandas/py3/pandas/_libs/arrays.pyi
new file mode 100644
index 0000000000..c9350ed9b8
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/arrays.pyi
@@ -0,0 +1,34 @@
+from typing import Sequence
+
+import numpy as np
+
+from pandas._typing import (
+ DtypeObj,
+ Shape,
+)
+
+class NDArrayBacked:
+ _dtype: DtypeObj
+ _ndarray: np.ndarray
+ def __init__(self, values: np.ndarray, dtype: DtypeObj) -> None: ...
+ @classmethod
+ def _simple_new(cls, values: np.ndarray, dtype: DtypeObj): ...
+ def _from_backing_data(self, values: np.ndarray): ...
+ def __setstate__(self, state): ...
+ def __len__(self) -> int: ...
+ @property
+ def shape(self) -> Shape: ...
+ @property
+ def ndim(self) -> int: ...
+ @property
+ def size(self) -> int: ...
+ @property
+ def nbytes(self) -> int: ...
+ def copy(self): ...
+ def delete(self, loc, axis=...): ...
+ def swapaxes(self, axis1, axis2): ...
+ def repeat(self, repeats: int | Sequence[int], axis: int | None = ...): ...
+ def reshape(self, *args, **kwargs): ...
+ def ravel(self, order=...): ...
+ @property
+ def T(self): ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/groupby.pyi b/contrib/python/pandas/py3/pandas/_libs/groupby.pyi
new file mode 100644
index 0000000000..e3ca9c44d5
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/groupby.pyi
@@ -0,0 +1,191 @@
+from typing import Literal
+
+import numpy as np
+
+from pandas._typing import npt
+
+def group_median_float64(
+ out: np.ndarray, # ndarray[float64_t, ndim=2]
+ counts: npt.NDArray[np.int64],
+ values: np.ndarray, # ndarray[float64_t, ndim=2]
+ labels: npt.NDArray[np.int64],
+ min_count: int = ..., # Py_ssize_t
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_cumprod(
+ out: np.ndarray, # float64_t[:, ::1]
+ values: np.ndarray, # const float64_t[:, :]
+ labels: np.ndarray, # const int64_t[:]
+ ngroups: int,
+ is_datetimelike: bool,
+ skipna: bool = ...,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_cumsum(
+ out: np.ndarray, # int64float_t[:, ::1]
+ values: np.ndarray, # ndarray[int64float_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ ngroups: int,
+ is_datetimelike: bool,
+ skipna: bool = ...,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_shift_indexer(
+ out: np.ndarray, # int64_t[::1]
+ labels: np.ndarray, # const int64_t[:]
+ ngroups: int,
+ periods: int,
+) -> None: ...
+def group_fillna_indexer(
+ out: np.ndarray, # ndarray[intp_t]
+ labels: np.ndarray, # ndarray[int64_t]
+ sorted_labels: npt.NDArray[np.intp],
+ mask: npt.NDArray[np.uint8],
+ direction: Literal["ffill", "bfill"],
+ limit: int, # int64_t
+ dropna: bool,
+) -> None: ...
+def group_any_all(
+ out: np.ndarray, # uint8_t[::1]
+ values: np.ndarray, # const uint8_t[::1]
+ labels: np.ndarray, # const int64_t[:]
+ mask: np.ndarray, # const uint8_t[::1]
+ val_test: Literal["any", "all"],
+ skipna: bool,
+ nullable: bool,
+) -> None: ...
+def group_sum(
+ out: np.ndarray, # complexfloatingintuint_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[complexfloatingintuint_t, ndim=2]
+ labels: np.ndarray, # const intp_t[:]
+ mask: np.ndarray | None,
+ result_mask: np.ndarray | None = ...,
+ min_count: int = ...,
+ is_datetimelike: bool = ...,
+) -> None: ...
+def group_prod(
+ out: np.ndarray, # int64float_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[int64float_t, ndim=2]
+ labels: np.ndarray, # const intp_t[:]
+ mask: np.ndarray | None,
+ result_mask: np.ndarray | None = ...,
+ min_count: int = ...,
+) -> None: ...
+def group_var(
+ out: np.ndarray, # floating[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[floating, ndim=2]
+ labels: np.ndarray, # const intp_t[:]
+ min_count: int = ..., # Py_ssize_t
+ ddof: int = ..., # int64_t
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+ is_datetimelike: bool = ...,
+) -> None: ...
+def group_mean(
+ out: np.ndarray, # floating[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[floating, ndim=2]
+ labels: np.ndarray, # const intp_t[:]
+ min_count: int = ..., # Py_ssize_t
+ is_datetimelike: bool = ..., # bint
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_ohlc(
+ out: np.ndarray, # floatingintuint_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[floatingintuint_t, ndim=2]
+ labels: np.ndarray, # const intp_t[:]
+ min_count: int = ...,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_quantile(
+ out: npt.NDArray[np.float64],
+ values: np.ndarray, # ndarray[numeric, ndim=1]
+ labels: npt.NDArray[np.intp],
+ mask: npt.NDArray[np.uint8],
+ sort_indexer: npt.NDArray[np.intp], # const
+ qs: npt.NDArray[np.float64], # const
+ interpolation: Literal["linear", "lower", "higher", "nearest", "midpoint"],
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_last(
+ out: np.ndarray, # rank_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[rank_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ mask: npt.NDArray[np.bool_] | None,
+ result_mask: npt.NDArray[np.bool_] | None = ...,
+ min_count: int = ..., # Py_ssize_t
+ is_datetimelike: bool = ...,
+) -> None: ...
+def group_nth(
+ out: np.ndarray, # rank_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[rank_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ mask: npt.NDArray[np.bool_] | None,
+ result_mask: npt.NDArray[np.bool_] | None = ...,
+ min_count: int = ..., # int64_t
+ rank: int = ..., # int64_t
+ is_datetimelike: bool = ...,
+) -> None: ...
+def group_rank(
+ out: np.ndarray, # float64_t[:, ::1]
+ values: np.ndarray, # ndarray[rank_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ ngroups: int,
+ is_datetimelike: bool,
+ ties_method: Literal["average", "min", "max", "first", "dense"] = ...,
+ ascending: bool = ...,
+ pct: bool = ...,
+ na_option: Literal["keep", "top", "bottom"] = ...,
+ mask: npt.NDArray[np.bool_] | None = ...,
+) -> None: ...
+def group_max(
+ out: np.ndarray, # groupby_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[groupby_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ min_count: int = ...,
+ is_datetimelike: bool = ...,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_min(
+ out: np.ndarray, # groupby_t[:, ::1]
+ counts: np.ndarray, # int64_t[::1]
+ values: np.ndarray, # ndarray[groupby_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ min_count: int = ...,
+ is_datetimelike: bool = ...,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+) -> None: ...
+def group_cummin(
+ out: np.ndarray, # groupby_t[:, ::1]
+ values: np.ndarray, # ndarray[groupby_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ ngroups: int,
+ is_datetimelike: bool,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+ skipna: bool = ...,
+) -> None: ...
+def group_cummax(
+ out: np.ndarray, # groupby_t[:, ::1]
+ values: np.ndarray, # ndarray[groupby_t, ndim=2]
+ labels: np.ndarray, # const int64_t[:]
+ ngroups: int,
+ is_datetimelike: bool,
+ mask: np.ndarray | None = ...,
+ result_mask: np.ndarray | None = ...,
+ skipna: bool = ...,
+) -> None: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/hashing.pyi b/contrib/python/pandas/py3/pandas/_libs/hashing.pyi
new file mode 100644
index 0000000000..8361026e4a
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/hashing.pyi
@@ -0,0 +1,9 @@
+import numpy as np
+
+from pandas._typing import npt
+
+def hash_object_array(
+ arr: npt.NDArray[np.object_],
+ key: str,
+ encoding: str = ...,
+) -> npt.NDArray[np.uint64]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/hashtable.pyi b/contrib/python/pandas/py3/pandas/_libs/hashtable.pyi
new file mode 100644
index 0000000000..2bc6d74fe6
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/hashtable.pyi
@@ -0,0 +1,251 @@
+from typing import (
+ Any,
+ Hashable,
+ Literal,
+)
+
+import numpy as np
+
+from pandas._typing import npt
+
+def unique_label_indices(
+ labels: np.ndarray, # const int64_t[:]
+) -> np.ndarray: ...
+
+class Factorizer:
+ count: int
+ uniques: Any
+ def __init__(self, size_hint: int) -> None: ...
+ def get_count(self) -> int: ...
+ def factorize(
+ self,
+ values: np.ndarray,
+ sort: bool = ...,
+ na_sentinel=...,
+ na_value=...,
+ mask=...,
+ ) -> npt.NDArray[np.intp]: ...
+
+class ObjectFactorizer(Factorizer):
+ table: PyObjectHashTable
+ uniques: ObjectVector
+
+class Int64Factorizer(Factorizer):
+ table: Int64HashTable
+ uniques: Int64Vector
+
+class UInt64Factorizer(Factorizer):
+ table: UInt64HashTable
+ uniques: UInt64Vector
+
+class Int32Factorizer(Factorizer):
+ table: Int32HashTable
+ uniques: Int32Vector
+
+class UInt32Factorizer(Factorizer):
+ table: UInt32HashTable
+ uniques: UInt32Vector
+
+class Int16Factorizer(Factorizer):
+ table: Int16HashTable
+ uniques: Int16Vector
+
+class UInt16Factorizer(Factorizer):
+ table: UInt16HashTable
+ uniques: UInt16Vector
+
+class Int8Factorizer(Factorizer):
+ table: Int8HashTable
+ uniques: Int8Vector
+
+class UInt8Factorizer(Factorizer):
+ table: UInt8HashTable
+ uniques: UInt8Vector
+
+class Float64Factorizer(Factorizer):
+ table: Float64HashTable
+ uniques: Float64Vector
+
+class Float32Factorizer(Factorizer):
+ table: Float32HashTable
+ uniques: Float32Vector
+
+class Complex64Factorizer(Factorizer):
+ table: Complex64HashTable
+ uniques: Complex64Vector
+
+class Complex128Factorizer(Factorizer):
+ table: Complex128HashTable
+ uniques: Complex128Vector
+
+class Int64Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.int64]: ...
+
+class Int32Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.int32]: ...
+
+class Int16Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.int16]: ...
+
+class Int8Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.int8]: ...
+
+class UInt64Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.uint64]: ...
+
+class UInt32Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.uint32]: ...
+
+class UInt16Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.uint16]: ...
+
+class UInt8Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.uint8]: ...
+
+class Float64Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.float64]: ...
+
+class Float32Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.float32]: ...
+
+class Complex128Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.complex128]: ...
+
+class Complex64Vector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.complex64]: ...
+
+class StringVector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.object_]: ...
+
+class ObjectVector:
+ def __init__(self, *args) -> None: ...
+ def __len__(self) -> int: ...
+ def to_array(self) -> npt.NDArray[np.object_]: ...
+
+class HashTable:
+ # NB: The base HashTable class does _not_ actually have these methods;
+ # we are putting them here for the sake of mypy to avoid
+ # reproducing them in each subclass below.
+ def __init__(self, size_hint: int = ..., uses_mask: bool = ...) -> None: ...
+ def __len__(self) -> int: ...
+ def __contains__(self, key: Hashable) -> bool: ...
+ def sizeof(self, deep: bool = ...) -> int: ...
+ def get_state(self) -> dict[str, int]: ...
+ # TODO: `item` type is subclass-specific
+ def get_item(self, item): ... # TODO: return type?
+ def set_item(self, item, val) -> None: ...
+ def get_na(self): ... # TODO: return type?
+ def set_na(self, val) -> None: ...
+ def map_locations(
+ self,
+ values: np.ndarray, # np.ndarray[subclass-specific]
+ mask: npt.NDArray[np.bool_] | None = ...,
+ ) -> None: ...
+ def lookup(
+ self,
+ values: np.ndarray, # np.ndarray[subclass-specific]
+ mask: npt.NDArray[np.bool_] | None = ...,
+ ) -> npt.NDArray[np.intp]: ...
+ def get_labels(
+ self,
+ values: np.ndarray, # np.ndarray[subclass-specific]
+ uniques, # SubclassTypeVector
+ count_prior: int = ...,
+ na_sentinel: int = ...,
+ na_value: object = ...,
+ mask=...,
+ ) -> npt.NDArray[np.intp]: ...
+ def unique(
+ self,
+ values: np.ndarray, # np.ndarray[subclass-specific]
+ return_inverse: bool = ...,
+ ) -> (
+ tuple[
+ np.ndarray, # np.ndarray[subclass-specific]
+ npt.NDArray[np.intp],
+ ]
+ | np.ndarray
+ ): ... # np.ndarray[subclass-specific]
+ def factorize(
+ self,
+ values: np.ndarray, # np.ndarray[subclass-specific]
+ na_sentinel: int = ...,
+ na_value: object = ...,
+ mask=...,
+ ) -> tuple[np.ndarray, npt.NDArray[np.intp]]: ... # np.ndarray[subclass-specific]
+
+class Complex128HashTable(HashTable): ...
+class Complex64HashTable(HashTable): ...
+class Float64HashTable(HashTable): ...
+class Float32HashTable(HashTable): ...
+
+class Int64HashTable(HashTable):
+ # Only Int64HashTable has get_labels_groupby, map_keys_to_values
+ def get_labels_groupby(
+ self,
+ values: npt.NDArray[np.int64], # const int64_t[:]
+ ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.int64]]: ...
+ def map_keys_to_values(
+ self,
+ keys: npt.NDArray[np.int64],
+ values: npt.NDArray[np.int64], # const int64_t[:]
+ ) -> None: ...
+
+class Int32HashTable(HashTable): ...
+class Int16HashTable(HashTable): ...
+class Int8HashTable(HashTable): ...
+class UInt64HashTable(HashTable): ...
+class UInt32HashTable(HashTable): ...
+class UInt16HashTable(HashTable): ...
+class UInt8HashTable(HashTable): ...
+class StringHashTable(HashTable): ...
+class PyObjectHashTable(HashTable): ...
+class IntpHashTable(HashTable): ...
+
+def duplicated(
+ values: np.ndarray,
+ keep: Literal["last", "first", False] = ...,
+ mask: npt.NDArray[np.bool_] | None = ...,
+) -> npt.NDArray[np.bool_]: ...
+def mode(
+ values: np.ndarray, dropna: bool, mask: npt.NDArray[np.bool_] | None = ...
+) -> np.ndarray: ...
+def value_count(
+ values: np.ndarray,
+ dropna: bool,
+ mask: npt.NDArray[np.bool_] | None = ...,
+) -> tuple[np.ndarray, npt.NDArray[np.int64]]: ... # np.ndarray[same-as-values]
+
+# arr and values should have same dtype
+def ismember(
+ arr: np.ndarray,
+ values: np.ndarray,
+) -> npt.NDArray[np.bool_]: ...
+def object_hash(obj) -> int: ...
+def objects_are_equal(a, b) -> bool: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/index.pyi b/contrib/python/pandas/py3/pandas/_libs/index.pyi
new file mode 100644
index 0000000000..e08faaaa03
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/index.pyi
@@ -0,0 +1,105 @@
+import numpy as np
+
+from pandas._typing import npt
+
+from pandas import MultiIndex
+from pandas.core.arrays import ExtensionArray
+
+class IndexEngine:
+ over_size_threshold: bool
+ def __init__(self, values: np.ndarray) -> None: ...
+ def __contains__(self, val: object) -> bool: ...
+
+ # -> int | slice | np.ndarray[bool]
+ def get_loc(self, val: object) -> int | slice | np.ndarray: ...
+ def sizeof(self, deep: bool = ...) -> int: ...
+ def __sizeof__(self) -> int: ...
+ @property
+ def is_unique(self) -> bool: ...
+ @property
+ def is_monotonic_increasing(self) -> bool: ...
+ @property
+ def is_monotonic_decreasing(self) -> bool: ...
+ @property
+ def is_mapping_populated(self) -> bool: ...
+ def clear_mapping(self): ...
+ def get_indexer(self, values: np.ndarray) -> npt.NDArray[np.intp]: ...
+ def get_indexer_non_unique(
+ self,
+ targets: np.ndarray,
+ ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+
+class MaskedIndexEngine(IndexEngine):
+ def __init__(self, values: object) -> None: ...
+ def get_indexer_non_unique(
+ self, targets: object
+ ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+
+class Float64Engine(IndexEngine): ...
+class Float32Engine(IndexEngine): ...
+class Complex128Engine(IndexEngine): ...
+class Complex64Engine(IndexEngine): ...
+class Int64Engine(IndexEngine): ...
+class Int32Engine(IndexEngine): ...
+class Int16Engine(IndexEngine): ...
+class Int8Engine(IndexEngine): ...
+class UInt64Engine(IndexEngine): ...
+class UInt32Engine(IndexEngine): ...
+class UInt16Engine(IndexEngine): ...
+class UInt8Engine(IndexEngine): ...
+class ObjectEngine(IndexEngine): ...
+class DatetimeEngine(Int64Engine): ...
+class TimedeltaEngine(DatetimeEngine): ...
+class PeriodEngine(Int64Engine): ...
+class BoolEngine(UInt8Engine): ...
+class MaskedFloat64Engine(MaskedIndexEngine): ...
+class MaskedFloat32Engine(MaskedIndexEngine): ...
+class MaskedComplex128Engine(MaskedIndexEngine): ...
+class MaskedComplex64Engine(MaskedIndexEngine): ...
+class MaskedInt64Engine(MaskedIndexEngine): ...
+class MaskedInt32Engine(MaskedIndexEngine): ...
+class MaskedInt16Engine(MaskedIndexEngine): ...
+class MaskedInt8Engine(MaskedIndexEngine): ...
+class MaskedUInt64Engine(MaskedIndexEngine): ...
+class MaskedUInt32Engine(MaskedIndexEngine): ...
+class MaskedUInt16Engine(MaskedIndexEngine): ...
+class MaskedUInt8Engine(MaskedIndexEngine): ...
+class MaskedBoolEngine(MaskedUInt8Engine): ...
+
+class BaseMultiIndexCodesEngine:
+ levels: list[np.ndarray]
+ offsets: np.ndarray # ndarray[uint64_t, ndim=1]
+
+ def __init__(
+ self,
+ levels: list[np.ndarray], # all entries hashable
+ labels: list[np.ndarray], # all entries integer-dtyped
+ offsets: np.ndarray, # np.ndarray[np.uint64, ndim=1]
+ ) -> None: ...
+ def get_indexer(self, target: npt.NDArray[np.object_]) -> npt.NDArray[np.intp]: ...
+ def _extract_level_codes(self, target: MultiIndex) -> np.ndarray: ...
+ def get_indexer_with_fill(
+ self,
+ target: np.ndarray, # np.ndarray[object] of tuples
+ values: np.ndarray, # np.ndarray[object] of tuples
+ method: str,
+ limit: int | None,
+ ) -> npt.NDArray[np.intp]: ...
+
+class ExtensionEngine:
+ def __init__(self, values: ExtensionArray) -> None: ...
+ def __contains__(self, val: object) -> bool: ...
+ def get_loc(self, val: object) -> int | slice | np.ndarray: ...
+ def get_indexer(self, values: np.ndarray) -> npt.NDArray[np.intp]: ...
+ def get_indexer_non_unique(
+ self,
+ targets: np.ndarray,
+ ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+ @property
+ def is_unique(self) -> bool: ...
+ @property
+ def is_monotonic_increasing(self) -> bool: ...
+ @property
+ def is_monotonic_decreasing(self) -> bool: ...
+ def sizeof(self, deep: bool = ...) -> int: ...
+ def clear_mapping(self): ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/indexing.pyi b/contrib/python/pandas/py3/pandas/_libs/indexing.pyi
new file mode 100644
index 0000000000..3ae5c5044a
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/indexing.pyi
@@ -0,0 +1,17 @@
+from typing import (
+ Generic,
+ TypeVar,
+)
+
+from pandas.core.indexing import IndexingMixin
+
+_IndexingMixinT = TypeVar("_IndexingMixinT", bound=IndexingMixin)
+
+class NDFrameIndexerBase(Generic[_IndexingMixinT]):
+ name: str
+ # in practice obj is either a DataFrame or a Series
+ obj: _IndexingMixinT
+
+ def __init__(self, name: str, obj: _IndexingMixinT) -> None: ...
+ @property
+ def ndim(self) -> int: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/internals.pyi b/contrib/python/pandas/py3/pandas/_libs/internals.pyi
new file mode 100644
index 0000000000..cee9680129
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/internals.pyi
@@ -0,0 +1,102 @@
+from typing import (
+ Iterator,
+ Sequence,
+ final,
+ overload,
+)
+import weakref
+
+import numpy as np
+
+from pandas._typing import (
+ ArrayLike,
+ T,
+ npt,
+)
+
+from pandas import Index
+from pandas.core.arrays._mixins import NDArrayBackedExtensionArray
+from pandas.core.internals.blocks import Block as B
+
+def slice_len(slc: slice, objlen: int = ...) -> int: ...
+def get_blkno_indexers(
+ blknos: np.ndarray, # int64_t[:]
+ group: bool = ...,
+) -> list[tuple[int, slice | np.ndarray]]: ...
+def get_blkno_placements(
+ blknos: np.ndarray,
+ group: bool = ...,
+) -> Iterator[tuple[int, BlockPlacement]]: ...
+def update_blklocs_and_blknos(
+ blklocs: npt.NDArray[np.intp],
+ blknos: npt.NDArray[np.intp],
+ loc: int,
+ nblocks: int,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+@final
+class BlockPlacement:
+ def __init__(self, val: int | slice | np.ndarray) -> None: ...
+ @property
+ def indexer(self) -> np.ndarray | slice: ...
+ @property
+ def as_array(self) -> np.ndarray: ...
+ @property
+ def as_slice(self) -> slice: ...
+ @property
+ def is_slice_like(self) -> bool: ...
+ @overload
+ def __getitem__(
+ self, loc: slice | Sequence[int] | npt.NDArray[np.intp]
+ ) -> BlockPlacement: ...
+ @overload
+ def __getitem__(self, loc: int) -> int: ...
+ def __iter__(self) -> Iterator[int]: ...
+ def __len__(self) -> int: ...
+ def delete(self, loc) -> BlockPlacement: ...
+ def append(self, others: list[BlockPlacement]) -> BlockPlacement: ...
+ def tile_for_unstack(self, factor: int) -> npt.NDArray[np.intp]: ...
+
+class SharedBlock:
+ _mgr_locs: BlockPlacement
+ ndim: int
+ values: ArrayLike
+ refs: BlockValuesRefs
+ def __init__(
+ self,
+ values: ArrayLike,
+ placement: BlockPlacement,
+ ndim: int,
+ refs: BlockValuesRefs | None = ...,
+ ) -> None: ...
+
+class NumpyBlock(SharedBlock):
+ values: np.ndarray
+ @final
+ def getitem_block_index(self: T, slicer: slice) -> T: ...
+
+class NDArrayBackedBlock(SharedBlock):
+ values: NDArrayBackedExtensionArray
+ @final
+ def getitem_block_index(self: T, slicer: slice) -> T: ...
+
+class Block(SharedBlock): ...
+
+class BlockManager:
+ blocks: tuple[B, ...]
+ axes: list[Index]
+ _known_consolidated: bool
+ _is_consolidated: bool
+ _blknos: np.ndarray
+ _blklocs: np.ndarray
+ def __init__(
+ self, blocks: tuple[B, ...], axes: list[Index], verify_integrity=...
+ ) -> None: ...
+ def get_slice(self: T, slobj: slice, axis: int = ...) -> T: ...
+ def _rebuild_blknos_and_blklocs(self) -> None: ...
+
+class BlockValuesRefs:
+ referenced_blocks: list[weakref.ref]
+ def __init__(self, blk: SharedBlock | None = ...) -> None: ...
+ def add_reference(self, blk: SharedBlock) -> None: ...
+ def add_index_reference(self, index: object) -> None: ...
+ def has_reference(self) -> bool: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/interval.pyi b/contrib/python/pandas/py3/pandas/_libs/interval.pyi
new file mode 100644
index 0000000000..4c36246e04
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/interval.pyi
@@ -0,0 +1,174 @@
+from typing import (
+ Any,
+ Generic,
+ TypeVar,
+ overload,
+)
+
+import numpy as np
+import numpy.typing as npt
+
+from pandas._typing import (
+ IntervalClosedType,
+ Timedelta,
+ Timestamp,
+)
+
+VALID_CLOSED: frozenset[str]
+
+_OrderableScalarT = TypeVar("_OrderableScalarT", int, float)
+_OrderableTimesT = TypeVar("_OrderableTimesT", Timestamp, Timedelta)
+_OrderableT = TypeVar("_OrderableT", int, float, Timestamp, Timedelta)
+
+class _LengthDescriptor:
+ @overload
+ def __get__(
+ self, instance: Interval[_OrderableScalarT], owner: Any
+ ) -> _OrderableScalarT: ...
+ @overload
+ def __get__(
+ self, instance: Interval[_OrderableTimesT], owner: Any
+ ) -> Timedelta: ...
+
+class _MidDescriptor:
+ @overload
+ def __get__(self, instance: Interval[_OrderableScalarT], owner: Any) -> float: ...
+ @overload
+ def __get__(
+ self, instance: Interval[_OrderableTimesT], owner: Any
+ ) -> _OrderableTimesT: ...
+
+class IntervalMixin:
+ @property
+ def closed_left(self) -> bool: ...
+ @property
+ def closed_right(self) -> bool: ...
+ @property
+ def open_left(self) -> bool: ...
+ @property
+ def open_right(self) -> bool: ...
+ @property
+ def is_empty(self) -> bool: ...
+ def _check_closed_matches(self, other: IntervalMixin, name: str = ...) -> None: ...
+
+class Interval(IntervalMixin, Generic[_OrderableT]):
+ @property
+ def left(self: Interval[_OrderableT]) -> _OrderableT: ...
+ @property
+ def right(self: Interval[_OrderableT]) -> _OrderableT: ...
+ @property
+ def closed(self) -> IntervalClosedType: ...
+ mid: _MidDescriptor
+ length: _LengthDescriptor
+ def __init__(
+ self,
+ left: _OrderableT,
+ right: _OrderableT,
+ closed: IntervalClosedType = ...,
+ ) -> None: ...
+ def __hash__(self) -> int: ...
+ @overload
+ def __contains__(
+ self: Interval[Timedelta], key: Timedelta | Interval[Timedelta]
+ ) -> bool: ...
+ @overload
+ def __contains__(
+ self: Interval[Timestamp], key: Timestamp | Interval[Timestamp]
+ ) -> bool: ...
+ @overload
+ def __contains__(
+ self: Interval[_OrderableScalarT],
+ key: _OrderableScalarT | Interval[_OrderableScalarT],
+ ) -> bool: ...
+ @overload
+ def __add__(
+ self: Interval[_OrderableTimesT], y: Timedelta
+ ) -> Interval[_OrderableTimesT]: ...
+ @overload
+ def __add__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __add__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __radd__(
+ self: Interval[_OrderableTimesT], y: Timedelta
+ ) -> Interval[_OrderableTimesT]: ...
+ @overload
+ def __radd__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __radd__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __sub__(
+ self: Interval[_OrderableTimesT], y: Timedelta
+ ) -> Interval[_OrderableTimesT]: ...
+ @overload
+ def __sub__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __sub__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __rsub__(
+ self: Interval[_OrderableTimesT], y: Timedelta
+ ) -> Interval[_OrderableTimesT]: ...
+ @overload
+ def __rsub__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __rsub__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __mul__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __mul__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __rmul__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __rmul__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __truediv__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __truediv__(self: Interval[float], y: float) -> Interval[float]: ...
+ @overload
+ def __floordiv__(
+ self: Interval[int], y: _OrderableScalarT
+ ) -> Interval[_OrderableScalarT]: ...
+ @overload
+ def __floordiv__(self: Interval[float], y: float) -> Interval[float]: ...
+ def overlaps(self: Interval[_OrderableT], other: Interval[_OrderableT]) -> bool: ...
+
+def intervals_to_interval_bounds(
+ intervals: np.ndarray, validate_closed: bool = ...
+) -> tuple[np.ndarray, np.ndarray, str]: ...
+
+class IntervalTree(IntervalMixin):
+ def __init__(
+ self,
+ left: np.ndarray,
+ right: np.ndarray,
+ closed: IntervalClosedType = ...,
+ leaf_size: int = ...,
+ ) -> None: ...
+ @property
+ def mid(self) -> np.ndarray: ...
+ @property
+ def length(self) -> np.ndarray: ...
+ def get_indexer(self, target) -> npt.NDArray[np.intp]: ...
+ def get_indexer_non_unique(
+ self, target
+ ) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+ _na_count: int
+ @property
+ def is_overlapping(self) -> bool: ...
+ @property
+ def is_monotonic_increasing(self) -> bool: ...
+ def clear_mapping(self) -> None: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/join.pyi b/contrib/python/pandas/py3/pandas/_libs/join.pyi
new file mode 100644
index 0000000000..11b65b8590
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/join.pyi
@@ -0,0 +1,78 @@
+import numpy as np
+
+from pandas._typing import npt
+
+def inner_join(
+ left: np.ndarray, # const intp_t[:]
+ right: np.ndarray, # const intp_t[:]
+ max_groups: int,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+def left_outer_join(
+ left: np.ndarray, # const intp_t[:]
+ right: np.ndarray, # const intp_t[:]
+ max_groups: int,
+ sort: bool = ...,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+def full_outer_join(
+ left: np.ndarray, # const intp_t[:]
+ right: np.ndarray, # const intp_t[:]
+ max_groups: int,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+def ffill_indexer(
+ indexer: np.ndarray, # const intp_t[:]
+) -> npt.NDArray[np.intp]: ...
+def left_join_indexer_unique(
+ left: np.ndarray, # ndarray[join_t]
+ right: np.ndarray, # ndarray[join_t]
+) -> npt.NDArray[np.intp]: ...
+def left_join_indexer(
+ left: np.ndarray, # ndarray[join_t]
+ right: np.ndarray, # ndarray[join_t]
+) -> tuple[
+ np.ndarray, # np.ndarray[join_t]
+ npt.NDArray[np.intp],
+ npt.NDArray[np.intp],
+]: ...
+def inner_join_indexer(
+ left: np.ndarray, # ndarray[join_t]
+ right: np.ndarray, # ndarray[join_t]
+) -> tuple[
+ np.ndarray, # np.ndarray[join_t]
+ npt.NDArray[np.intp],
+ npt.NDArray[np.intp],
+]: ...
+def outer_join_indexer(
+ left: np.ndarray, # ndarray[join_t]
+ right: np.ndarray, # ndarray[join_t]
+) -> tuple[
+ np.ndarray, # np.ndarray[join_t]
+ npt.NDArray[np.intp],
+ npt.NDArray[np.intp],
+]: ...
+def asof_join_backward_on_X_by_Y(
+ left_values: np.ndarray, # asof_t[:]
+ right_values: np.ndarray, # asof_t[:]
+ left_by_values: np.ndarray, # by_t[:]
+ right_by_values: np.ndarray, # by_t[:]
+ allow_exact_matches: bool = ...,
+ tolerance: np.number | float | None = ...,
+ use_hashtable: bool = ...,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+def asof_join_forward_on_X_by_Y(
+ left_values: np.ndarray, # asof_t[:]
+ right_values: np.ndarray, # asof_t[:]
+ left_by_values: np.ndarray, # by_t[:]
+ right_by_values: np.ndarray, # by_t[:]
+ allow_exact_matches: bool = ...,
+ tolerance: np.number | float | None = ...,
+ use_hashtable: bool = ...,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
+def asof_join_nearest_on_X_by_Y(
+ left_values: np.ndarray, # asof_t[:]
+ right_values: np.ndarray, # asof_t[:]
+ left_by_values: np.ndarray, # by_t[:]
+ right_by_values: np.ndarray, # by_t[:]
+ allow_exact_matches: bool = ...,
+ tolerance: np.number | float | None = ...,
+ use_hashtable: bool = ...,
+) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/json.pyi b/contrib/python/pandas/py3/pandas/_libs/json.pyi
new file mode 100644
index 0000000000..8e7ba60ccc
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/json.pyi
@@ -0,0 +1,23 @@
+from typing import (
+ Any,
+ Callable,
+)
+
+def dumps(
+ obj: Any,
+ ensure_ascii: bool = ...,
+ double_precision: int = ...,
+ indent: int = ...,
+ orient: str = ...,
+ date_unit: str = ...,
+ iso_dates: bool = ...,
+ default_handler: None
+ | Callable[[Any], str | float | bool | list | dict | None] = ...,
+) -> str: ...
+def loads(
+ s: str,
+ precise_float: bool = ...,
+ numpy: bool = ...,
+ dtype: None = ...,
+ labelled: bool = ...,
+) -> Any: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/lib.pyi b/contrib/python/pandas/py3/pandas/_libs/lib.pyi
new file mode 100644
index 0000000000..fbc577712d
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/lib.pyi
@@ -0,0 +1,250 @@
+# TODO(npdtypes): Many types specified here can be made more specific/accurate;
+# the more specific versions are specified in comments
+
+from typing import (
+ Any,
+ Callable,
+ Final,
+ Generator,
+ Hashable,
+ Literal,
+ overload,
+)
+
+import numpy as np
+
+from pandas._typing import (
+ ArrayLike,
+ DtypeObj,
+ npt,
+)
+
+# placeholder until we can specify np.ndarray[object, ndim=2]
+ndarray_obj_2d = np.ndarray
+
+from enum import Enum
+
+class _NoDefault(Enum):
+ no_default = ...
+
+no_default: Final = _NoDefault.no_default
+NoDefault = Literal[_NoDefault.no_default]
+
+i8max: int
+u8max: int
+
+def item_from_zerodim(val: object) -> object: ...
+def infer_dtype(value: object, skipna: bool = ...) -> str: ...
+def is_iterator(obj: object) -> bool: ...
+def is_scalar(val: object) -> bool: ...
+def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ...
+def is_period(val: object) -> bool: ...
+def is_interval(val: object) -> bool: ...
+def is_decimal(val: object) -> bool: ...
+def is_complex(val: object) -> bool: ...
+def is_bool(val: object) -> bool: ...
+def is_integer(val: object) -> bool: ...
+def is_float(val: object) -> bool: ...
+def is_interval_array(values: np.ndarray) -> bool: ...
+def is_datetime64_array(values: np.ndarray) -> bool: ...
+def is_timedelta_or_timedelta64_array(values: np.ndarray) -> bool: ...
+def is_datetime_with_singletz_array(values: np.ndarray) -> bool: ...
+def is_time_array(values: np.ndarray, skipna: bool = ...): ...
+def is_date_array(values: np.ndarray, skipna: bool = ...): ...
+def is_datetime_array(values: np.ndarray, skipna: bool = ...): ...
+def is_string_array(values: np.ndarray, skipna: bool = ...): ...
+def is_float_array(values: np.ndarray, skipna: bool = ...): ...
+def is_integer_array(values: np.ndarray, skipna: bool = ...): ...
+def is_bool_array(values: np.ndarray, skipna: bool = ...): ...
+def fast_multiget(mapping: dict, keys: np.ndarray, default=...) -> np.ndarray: ...
+def fast_unique_multiple_list_gen(gen: Generator, sort: bool = ...) -> list: ...
+def fast_unique_multiple_list(lists: list, sort: bool | None = ...) -> list: ...
+def map_infer(
+ arr: np.ndarray,
+ f: Callable[[Any], Any],
+ convert: bool = ...,
+ ignore_na: bool = ...,
+) -> np.ndarray: ...
+@overload # all convert_foo False -> only convert numeric
+def maybe_convert_objects(
+ objects: npt.NDArray[np.object_],
+ *,
+ try_float: bool = ...,
+ safe: bool = ...,
+ convert_numeric: bool = ...,
+ convert_datetime: Literal[False] = ...,
+ convert_timedelta: Literal[False] = ...,
+ convert_period: Literal[False] = ...,
+ convert_interval: Literal[False] = ...,
+ convert_to_nullable_dtype: Literal[False] = ...,
+ dtype_if_all_nat: DtypeObj | None = ...,
+) -> npt.NDArray[np.object_ | np.number]: ...
+@overload # both convert_datetime and convert_to_nullable_integer False -> np.ndarray
+def maybe_convert_objects(
+ objects: npt.NDArray[np.object_],
+ *,
+ try_float: bool = ...,
+ safe: bool = ...,
+ convert_numeric: bool = ...,
+ convert_datetime: Literal[False] = ...,
+ convert_timedelta: bool = ...,
+ convert_period: Literal[False] = ...,
+ convert_interval: Literal[False] = ...,
+ convert_to_nullable_dtype: Literal[False] = ...,
+ dtype_if_all_nat: DtypeObj | None = ...,
+) -> np.ndarray: ...
+@overload
+def maybe_convert_objects(
+ objects: npt.NDArray[np.object_],
+ *,
+ try_float: bool = ...,
+ safe: bool = ...,
+ convert_numeric: bool = ...,
+ convert_datetime: bool = ...,
+ convert_timedelta: bool = ...,
+ convert_period: bool = ...,
+ convert_interval: bool = ...,
+ convert_to_nullable_dtype: Literal[True] = ...,
+ dtype_if_all_nat: DtypeObj | None = ...,
+) -> ArrayLike: ...
+@overload
+def maybe_convert_objects(
+ objects: npt.NDArray[np.object_],
+ *,
+ try_float: bool = ...,
+ safe: bool = ...,
+ convert_numeric: bool = ...,
+ convert_datetime: Literal[True] = ...,
+ convert_timedelta: bool = ...,
+ convert_period: bool = ...,
+ convert_interval: bool = ...,
+ convert_to_nullable_dtype: bool = ...,
+ dtype_if_all_nat: DtypeObj | None = ...,
+) -> ArrayLike: ...
+@overload
+def maybe_convert_objects(
+ objects: npt.NDArray[np.object_],
+ *,
+ try_float: bool = ...,
+ safe: bool = ...,
+ convert_numeric: bool = ...,
+ convert_datetime: bool = ...,
+ convert_timedelta: bool = ...,
+ convert_period: Literal[True] = ...,
+ convert_interval: bool = ...,
+ convert_to_nullable_dtype: bool = ...,
+ dtype_if_all_nat: DtypeObj | None = ...,
+) -> ArrayLike: ...
+@overload
+def maybe_convert_objects(
+ objects: npt.NDArray[np.object_],
+ *,
+ try_float: bool = ...,
+ safe: bool = ...,
+ convert_numeric: bool = ...,
+ convert_datetime: bool = ...,
+ convert_timedelta: bool = ...,
+ convert_period: bool = ...,
+ convert_interval: bool = ...,
+ convert_to_nullable_dtype: bool = ...,
+ dtype_if_all_nat: DtypeObj | None = ...,
+) -> ArrayLike: ...
+@overload
+def maybe_convert_numeric(
+ values: npt.NDArray[np.object_],
+ na_values: set,
+ convert_empty: bool = ...,
+ coerce_numeric: bool = ...,
+ convert_to_masked_nullable: Literal[False] = ...,
+) -> tuple[np.ndarray, None]: ...
+@overload
+def maybe_convert_numeric(
+ values: npt.NDArray[np.object_],
+ na_values: set,
+ convert_empty: bool = ...,
+ coerce_numeric: bool = ...,
+ *,
+ convert_to_masked_nullable: Literal[True],
+) -> tuple[np.ndarray, np.ndarray]: ...
+
+# TODO: restrict `arr`?
+def ensure_string_array(
+ arr,
+ na_value: object = ...,
+ convert_na_value: bool = ...,
+ copy: bool = ...,
+ skipna: bool = ...,
+) -> npt.NDArray[np.object_]: ...
+def convert_nans_to_NA(
+ arr: npt.NDArray[np.object_],
+) -> npt.NDArray[np.object_]: ...
+def fast_zip(ndarrays: list) -> npt.NDArray[np.object_]: ...
+
+# TODO: can we be more specific about rows?
+def to_object_array_tuples(rows: object) -> ndarray_obj_2d: ...
+def tuples_to_object_array(
+ tuples: npt.NDArray[np.object_],
+) -> ndarray_obj_2d: ...
+
+# TODO: can we be more specific about rows?
+def to_object_array(rows: object, min_width: int = ...) -> ndarray_obj_2d: ...
+def dicts_to_array(dicts: list, columns: list) -> ndarray_obj_2d: ...
+def maybe_booleans_to_slice(
+ mask: npt.NDArray[np.uint8],
+) -> slice | npt.NDArray[np.uint8]: ...
+def maybe_indices_to_slice(
+ indices: npt.NDArray[np.intp],
+ max_len: int,
+) -> slice | npt.NDArray[np.intp]: ...
+def is_all_arraylike(obj: list) -> bool: ...
+
+# -----------------------------------------------------------------
+# Functions which in reality take memoryviews
+
+def memory_usage_of_objects(arr: np.ndarray) -> int: ... # object[:] # np.int64
+def map_infer_mask(
+ arr: np.ndarray,
+ f: Callable[[Any], Any],
+ mask: np.ndarray, # const uint8_t[:]
+ convert: bool = ...,
+ na_value: Any = ...,
+ dtype: np.dtype = ...,
+) -> np.ndarray: ...
+def indices_fast(
+ index: npt.NDArray[np.intp],
+ labels: np.ndarray, # const int64_t[:]
+ keys: list,
+ sorted_labels: list[npt.NDArray[np.int64]],
+) -> dict[Hashable, npt.NDArray[np.intp]]: ...
+def generate_slices(
+ labels: np.ndarray, ngroups: int # const intp_t[:]
+) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.int64]]: ...
+def count_level_2d(
+ mask: np.ndarray, # ndarray[uint8_t, ndim=2, cast=True],
+ labels: np.ndarray, # const intp_t[:]
+ max_bin: int,
+) -> np.ndarray: ... # np.ndarray[np.int64, ndim=2]
+def get_level_sorter(
+ label: np.ndarray, # const int64_t[:]
+ starts: np.ndarray, # const intp_t[:]
+) -> np.ndarray: ... # np.ndarray[np.intp, ndim=1]
+def generate_bins_dt64(
+ values: npt.NDArray[np.int64],
+ binner: np.ndarray, # const int64_t[:]
+ closed: object = ...,
+ hasnans: bool = ...,
+) -> np.ndarray: ... # np.ndarray[np.int64, ndim=1]
+def array_equivalent_object(
+ left: npt.NDArray[np.object_],
+ right: npt.NDArray[np.object_],
+) -> bool: ...
+def has_infs(arr: np.ndarray) -> bool: ... # const floating[:]
+def get_reverse_indexer(
+ indexer: np.ndarray, # const intp_t[:]
+ length: int,
+) -> npt.NDArray[np.intp]: ...
+def is_bool_list(obj: list) -> bool: ...
+def dtypes_all_equal(types: list[DtypeObj]) -> bool: ...
+def is_range_indexer(
+ left: np.ndarray, n: int # np.ndarray[np.int64, ndim=1]
+) -> bool: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/missing.pyi b/contrib/python/pandas/py3/pandas/_libs/missing.pyi
new file mode 100644
index 0000000000..d5c9f1342a
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/missing.pyi
@@ -0,0 +1,17 @@
+import numpy as np
+from numpy import typing as npt
+
+class NAType:
+ def __new__(cls, *args, **kwargs): ...
+
+NA: NAType
+
+def is_matching_na(
+ left: object, right: object, nan_matches_none: bool = ...
+) -> bool: ...
+def isposinf_scalar(val: object) -> bool: ...
+def isneginf_scalar(val: object) -> bool: ...
+def checknull(val: object, inf_as_na: bool = ...) -> bool: ...
+def isnaobj(arr: np.ndarray, inf_as_na: bool = ...) -> npt.NDArray[np.bool_]: ...
+def is_numeric_na(values: np.ndarray) -> npt.NDArray[np.bool_]: ...
+def is_float_nan(values: np.ndarray) -> npt.NDArray[np.bool_]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/ops.pyi b/contrib/python/pandas/py3/pandas/_libs/ops.pyi
new file mode 100644
index 0000000000..74a6ad87cd
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/ops.pyi
@@ -0,0 +1,50 @@
+from typing import (
+ Any,
+ Callable,
+ Iterable,
+ Literal,
+ overload,
+)
+
+import numpy as np
+
+from pandas._typing import npt
+
+_BinOp = Callable[[Any, Any], Any]
+_BoolOp = Callable[[Any, Any], bool]
+
+def scalar_compare(
+ values: np.ndarray, # object[:]
+ val: object,
+ op: _BoolOp, # {operator.eq, operator.ne, ...}
+) -> npt.NDArray[np.bool_]: ...
+def vec_compare(
+ left: npt.NDArray[np.object_],
+ right: npt.NDArray[np.object_],
+ op: _BoolOp, # {operator.eq, operator.ne, ...}
+) -> npt.NDArray[np.bool_]: ...
+def scalar_binop(
+ values: np.ndarray, # object[:]
+ val: object,
+ op: _BinOp, # binary operator
+) -> np.ndarray: ...
+def vec_binop(
+ left: np.ndarray, # object[:]
+ right: np.ndarray, # object[:]
+ op: _BinOp, # binary operator
+) -> np.ndarray: ...
+@overload
+def maybe_convert_bool(
+ arr: npt.NDArray[np.object_],
+ true_values: Iterable = ...,
+ false_values: Iterable = ...,
+ convert_to_masked_nullable: Literal[False] = ...,
+) -> tuple[np.ndarray, None]: ...
+@overload
+def maybe_convert_bool(
+ arr: npt.NDArray[np.object_],
+ true_values: Iterable = ...,
+ false_values: Iterable = ...,
+ *,
+ convert_to_masked_nullable: Literal[True],
+) -> tuple[np.ndarray, np.ndarray]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/ops_dispatch.pyi b/contrib/python/pandas/py3/pandas/_libs/ops_dispatch.pyi
new file mode 100644
index 0000000000..91b5a4dbaa
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/ops_dispatch.pyi
@@ -0,0 +1,5 @@
+import numpy as np
+
+def maybe_dispatch_ufunc_to_dunder_op(
+ self, ufunc: np.ufunc, method: str, *inputs, **kwargs
+): ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/parsers.pyi b/contrib/python/pandas/py3/pandas/_libs/parsers.pyi
new file mode 100644
index 0000000000..ec5244469c
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/parsers.pyi
@@ -0,0 +1,75 @@
+from typing import (
+ Hashable,
+ Literal,
+)
+
+import numpy as np
+
+from pandas._typing import (
+ ArrayLike,
+ Dtype,
+ npt,
+)
+
+STR_NA_VALUES: set[str]
+
+def sanitize_objects(
+ values: npt.NDArray[np.object_],
+ na_values: set,
+) -> int: ...
+
+class TextReader:
+ unnamed_cols: set[str]
+ table_width: int # int64_t
+ leading_cols: int # int64_t
+ header: list[list[int]] # non-negative integers
+ def __init__(
+ self,
+ source,
+ delimiter: bytes | str = ..., # single-character only
+ header=...,
+ header_start: int = ..., # int64_t
+ header_end: int = ..., # uint64_t
+ index_col=...,
+ names=...,
+ tokenize_chunksize: int = ..., # int64_t
+ delim_whitespace: bool = ...,
+ converters=...,
+ skipinitialspace: bool = ...,
+ escapechar: bytes | str | None = ..., # single-character only
+ doublequote: bool = ...,
+ quotechar: str | bytes | None = ..., # at most 1 character
+ quoting: int = ...,
+ lineterminator: bytes | str | None = ..., # at most 1 character
+ comment=...,
+ decimal: bytes | str = ..., # single-character only
+ thousands: bytes | str | None = ..., # single-character only
+ dtype: Dtype | dict[Hashable, Dtype] = ...,
+ usecols=...,
+ error_bad_lines: bool = ...,
+ warn_bad_lines: bool = ...,
+ na_filter: bool = ...,
+ na_values=...,
+ na_fvalues=...,
+ keep_default_na: bool = ...,
+ true_values=...,
+ false_values=...,
+ allow_leading_cols: bool = ...,
+ skiprows=...,
+ skipfooter: int = ..., # int64_t
+ verbose: bool = ...,
+ float_precision: Literal["round_trip", "legacy", "high"] | None = ...,
+ skip_blank_lines: bool = ...,
+ encoding_errors: bytes | str = ...,
+ ) -> None: ...
+ def set_noconvert(self, i: int) -> None: ...
+ def remove_noconvert(self, i: int) -> None: ...
+ def close(self) -> None: ...
+ def read(self, rows: int | None = ...) -> dict[int, ArrayLike]: ...
+ def read_low_memory(self, rows: int | None) -> list[dict[int, ArrayLike]]: ...
+
+# _maybe_upcast, na_values are only exposed for testing
+
+def _maybe_upcast(
+ arr, use_dtype_backend: bool = ..., dtype_backend: str = ...
+) -> np.ndarray: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/properties.pyi b/contrib/python/pandas/py3/pandas/_libs/properties.pyi
new file mode 100644
index 0000000000..aaa44a0cf4
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/properties.pyi
@@ -0,0 +1,27 @@
+from typing import (
+ Sequence,
+ overload,
+)
+
+from pandas._typing import (
+ AnyArrayLike,
+ DataFrame,
+ Index,
+ Series,
+)
+
+# note: this is a lie to make type checkers happy (they special
+# case property). cache_readonly uses attribute names similar to
+# property (fget) but it does not provide fset and fdel.
+cache_readonly = property
+
+class AxisProperty:
+ axis: int
+ def __init__(self, axis: int = ..., doc: str = ...) -> None: ...
+ @overload
+ def __get__(self, obj: DataFrame | Series, type) -> Index: ...
+ @overload
+ def __get__(self, obj: None, type) -> AxisProperty: ...
+ def __set__(
+ self, obj: DataFrame | Series, value: AnyArrayLike | Sequence
+ ) -> None: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/reduction.pyi b/contrib/python/pandas/py3/pandas/_libs/reduction.pyi
new file mode 100644
index 0000000000..525546f26c
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/reduction.pyi
@@ -0,0 +1,6 @@
+from typing import Any
+
+from pandas._typing import DtypeObj
+
+def check_result_array(obj: object, dtype: DtypeObj) -> None: ...
+def extract_result(res: object) -> Any: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/reshape.pyi b/contrib/python/pandas/py3/pandas/_libs/reshape.pyi
new file mode 100644
index 0000000000..110687fcd0
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/reshape.pyi
@@ -0,0 +1,16 @@
+import numpy as np
+
+from pandas._typing import npt
+
+def unstack(
+ values: np.ndarray, # reshape_t[:, :]
+ mask: np.ndarray, # const uint8_t[:]
+ stride: int,
+ length: int,
+ width: int,
+ new_values: np.ndarray, # reshape_t[:, :]
+ new_mask: np.ndarray, # uint8_t[:, :]
+) -> None: ...
+def explode(
+ values: npt.NDArray[np.object_],
+) -> tuple[npt.NDArray[np.object_], npt.NDArray[np.int64]]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/sparse.pyi b/contrib/python/pandas/py3/pandas/_libs/sparse.pyi
new file mode 100644
index 0000000000..8c3989b818
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/sparse.pyi
@@ -0,0 +1,49 @@
+from typing import (
+ Sequence,
+ TypeVar,
+)
+
+import numpy as np
+
+from pandas._typing import npt
+
+_SparseIndexT = TypeVar("_SparseIndexT", bound=SparseIndex)
+
+class SparseIndex:
+ length: int
+ npoints: int
+ def __init__(self) -> None: ...
+ @property
+ def ngaps(self) -> int: ...
+ @property
+ def nbytes(self) -> int: ...
+ @property
+ def indices(self) -> npt.NDArray[np.int32]: ...
+ def equals(self, other) -> bool: ...
+ def lookup(self, index: int) -> np.int32: ...
+ def lookup_array(self, indexer: npt.NDArray[np.int32]) -> npt.NDArray[np.int32]: ...
+ def to_int_index(self) -> IntIndex: ...
+ def to_block_index(self) -> BlockIndex: ...
+ def intersect(self: _SparseIndexT, y_: SparseIndex) -> _SparseIndexT: ...
+ def make_union(self: _SparseIndexT, y_: SparseIndex) -> _SparseIndexT: ...
+
+class IntIndex(SparseIndex):
+ indices: npt.NDArray[np.int32]
+ def __init__(
+ self, length: int, indices: Sequence[int], check_integrity: bool = ...
+ ) -> None: ...
+
+class BlockIndex(SparseIndex):
+ nblocks: int
+ blocs: np.ndarray
+ blengths: np.ndarray
+ def __init__(
+ self, length: int, blocs: np.ndarray, blengths: np.ndarray
+ ) -> None: ...
+
+def make_mask_object_ndarray(
+ arr: npt.NDArray[np.object_], fill_value
+) -> npt.NDArray[np.bool_]: ...
+def get_blocks(
+ indices: npt.NDArray[np.int32],
+) -> tuple[npt.NDArray[np.int32], npt.NDArray[np.int32]]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/testing.pyi b/contrib/python/pandas/py3/pandas/_libs/testing.pyi
new file mode 100644
index 0000000000..01da496975
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/testing.pyi
@@ -0,0 +1,12 @@
+def assert_dict_equal(a, b, compare_keys: bool = ...): ...
+def assert_almost_equal(
+ a,
+ b,
+ rtol: float = ...,
+ atol: float = ...,
+ check_dtype: bool = ...,
+ obj=...,
+ lobj=...,
+ robj=...,
+ index_values=...,
+): ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslib.pyi b/contrib/python/pandas/py3/pandas/_libs/tslib.pyi
new file mode 100644
index 0000000000..9819b5173d
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslib.pyi
@@ -0,0 +1,32 @@
+from datetime import tzinfo
+
+import numpy as np
+
+from pandas._typing import npt
+
+def format_array_from_datetime(
+ values: npt.NDArray[np.int64],
+ tz: tzinfo | None = ...,
+ format: str | None = ...,
+ na_rep: str | float = ...,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.object_]: ...
+def array_with_unit_to_datetime(
+ values: npt.NDArray[np.object_],
+ unit: str,
+ errors: str = ...,
+) -> tuple[np.ndarray, tzinfo | None]: ...
+def first_non_null(values: np.ndarray) -> int: ...
+def array_to_datetime(
+ values: npt.NDArray[np.object_],
+ errors: str = ...,
+ dayfirst: bool = ...,
+ yearfirst: bool = ...,
+ utc: bool = ...,
+) -> tuple[np.ndarray, tzinfo | None]: ...
+
+# returned ndarray may be object dtype or datetime64[ns]
+
+def array_to_datetime_with_tz(
+ values: npt.NDArray[np.object_], tz: tzinfo
+) -> npt.NDArray[np.int64]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/ccalendar.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/ccalendar.pyi
new file mode 100644
index 0000000000..993f18a61d
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/ccalendar.pyi
@@ -0,0 +1,12 @@
+DAYS: list[str]
+MONTH_ALIASES: dict[int, str]
+MONTH_NUMBERS: dict[str, int]
+MONTHS: list[str]
+int_to_weekday: dict[int, str]
+
+def get_firstbday(year: int, month: int) -> int: ...
+def get_lastbday(year: int, month: int) -> int: ...
+def get_day_of_year(year: int, month: int, day: int) -> int: ...
+def get_iso_calendar(year: int, month: int, day: int) -> tuple[int, int, int]: ...
+def get_week_of_year(year: int, month: int, day: int) -> int: ...
+def get_days_in_month(year: int, month: int) -> int: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/conversion.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/conversion.pyi
new file mode 100644
index 0000000000..d564d767f7
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/conversion.pyi
@@ -0,0 +1,14 @@
+from datetime import (
+ datetime,
+ tzinfo,
+)
+
+import numpy as np
+
+DT64NS_DTYPE: np.dtype
+TD64NS_DTYPE: np.dtype
+
+def precision_from_unit(
+ unit: str,
+) -> tuple[int, int]: ... # (int64_t, _)
+def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/dtypes.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/dtypes.pyi
new file mode 100644
index 0000000000..b872241d79
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/dtypes.pyi
@@ -0,0 +1,81 @@
+from enum import Enum
+
+# These are not public API, but are exposed in the .pyi file because they
+# are imported in tests.
+_attrname_to_abbrevs: dict[str, str]
+_period_code_map: dict[str, int]
+
+def periods_per_day(reso: int) -> int: ...
+def periods_per_second(reso: int) -> int: ...
+def is_supported_unit(reso: int) -> bool: ...
+def npy_unit_to_abbrev(reso: int) -> str: ...
+def get_supported_reso(reso: int) -> int: ...
+def abbrev_to_npy_unit(abbrev: str) -> int: ...
+
+class PeriodDtypeBase:
+ _dtype_code: int # PeriodDtypeCode
+
+ # actually __cinit__
+ def __new__(cls, code: int): ...
+ @property
+ def _freq_group_code(self) -> int: ...
+ @property
+ def _resolution_obj(self) -> Resolution: ...
+ def _get_to_timestamp_base(self) -> int: ...
+ @property
+ def _freqstr(self) -> str: ...
+
+class FreqGroup(Enum):
+ FR_ANN: int
+ FR_QTR: int
+ FR_MTH: int
+ FR_WK: int
+ FR_BUS: int
+ FR_DAY: int
+ FR_HR: int
+ FR_MIN: int
+ FR_SEC: int
+ FR_MS: int
+ FR_US: int
+ FR_NS: int
+ FR_UND: int
+ @staticmethod
+ def from_period_dtype_code(code: int) -> FreqGroup: ...
+
+class Resolution(Enum):
+ RESO_NS: int
+ RESO_US: int
+ RESO_MS: int
+ RESO_SEC: int
+ RESO_MIN: int
+ RESO_HR: int
+ RESO_DAY: int
+ RESO_MTH: int
+ RESO_QTR: int
+ RESO_YR: int
+ def __lt__(self, other: Resolution) -> bool: ...
+ def __ge__(self, other: Resolution) -> bool: ...
+ @property
+ def attrname(self) -> str: ...
+ @classmethod
+ def from_attrname(cls, attrname: str) -> Resolution: ...
+ @classmethod
+ def get_reso_from_freqstr(cls, freq: str) -> Resolution: ...
+ @property
+ def attr_abbrev(self) -> str: ...
+
+class NpyDatetimeUnit(Enum):
+ NPY_FR_Y: int
+ NPY_FR_M: int
+ NPY_FR_W: int
+ NPY_FR_D: int
+ NPY_FR_h: int
+ NPY_FR_m: int
+ NPY_FR_s: int
+ NPY_FR_ms: int
+ NPY_FR_us: int
+ NPY_FR_ns: int
+ NPY_FR_ps: int
+ NPY_FR_fs: int
+ NPY_FR_as: int
+ NPY_FR_GENERIC: int
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/fields.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/fields.pyi
new file mode 100644
index 0000000000..c6cfd44e9f
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/fields.pyi
@@ -0,0 +1,62 @@
+import numpy as np
+
+from pandas._typing import npt
+
+def build_field_sarray(
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
+ reso: int, # NPY_DATETIMEUNIT
+) -> np.ndarray: ...
+def month_position_check(fields, weekdays) -> str | None: ...
+def get_date_name_field(
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
+ field: str,
+ locale: str | None = ...,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.object_]: ...
+def get_start_end_field(
+ dtindex: npt.NDArray[np.int64],
+ field: str,
+ freqstr: str | None = ...,
+ month_kw: int = ...,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.bool_]: ...
+def get_date_field(
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
+ field: str,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int32]: ...
+def get_timedelta_field(
+ tdindex: npt.NDArray[np.int64], # const int64_t[:]
+ field: str,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int32]: ...
+def get_timedelta_days(
+ tdindex: npt.NDArray[np.int64], # const int64_t[:]
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int64]: ...
+def isleapyear_arr(
+ years: np.ndarray,
+) -> npt.NDArray[np.bool_]: ...
+def build_isocalendar_sarray(
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
+ reso: int, # NPY_DATETIMEUNIT
+) -> np.ndarray: ...
+def _get_locale_names(name_type: str, locale: str | None = ...): ...
+
+class RoundTo:
+ @property
+ def MINUS_INFTY(self) -> int: ...
+ @property
+ def PLUS_INFTY(self) -> int: ...
+ @property
+ def NEAREST_HALF_EVEN(self) -> int: ...
+ @property
+ def NEAREST_HALF_PLUS_INFTY(self) -> int: ...
+ @property
+ def NEAREST_HALF_MINUS_INFTY(self) -> int: ...
+
+def round_nsint64(
+ values: npt.NDArray[np.int64],
+ mode: RoundTo,
+ nanos: int,
+) -> npt.NDArray[np.int64]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/nattype.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/nattype.pyi
new file mode 100644
index 0000000000..04f8943710
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/nattype.pyi
@@ -0,0 +1,132 @@
+from datetime import (
+ datetime,
+ timedelta,
+ tzinfo as _tzinfo,
+)
+
+import numpy as np
+
+from pandas._libs.tslibs.period import Period
+
+NaT: NaTType
+iNaT: int
+nat_strings: set[str]
+
+_NaTComparisonTypes = datetime | timedelta | Period | np.datetime64 | np.timedelta64
+
+class _NatComparison:
+ def __call__(self, other: _NaTComparisonTypes) -> bool: ...
+
+class NaTType:
+ _value: np.int64
+ @property
+ def value(self) -> int: ...
+ @property
+ def asm8(self) -> np.datetime64: ...
+ def to_datetime64(self) -> np.datetime64: ...
+ def to_numpy(
+ self, dtype: np.dtype | str | None = ..., copy: bool = ...
+ ) -> np.datetime64 | np.timedelta64: ...
+ @property
+ def is_leap_year(self) -> bool: ...
+ @property
+ def is_month_start(self) -> bool: ...
+ @property
+ def is_quarter_start(self) -> bool: ...
+ @property
+ def is_year_start(self) -> bool: ...
+ @property
+ def is_month_end(self) -> bool: ...
+ @property
+ def is_quarter_end(self) -> bool: ...
+ @property
+ def is_year_end(self) -> bool: ...
+ @property
+ def day_of_year(self) -> float: ...
+ @property
+ def dayofyear(self) -> float: ...
+ @property
+ def days_in_month(self) -> float: ...
+ @property
+ def daysinmonth(self) -> float: ...
+ @property
+ def day_of_week(self) -> float: ...
+ @property
+ def dayofweek(self) -> float: ...
+ @property
+ def week(self) -> float: ...
+ @property
+ def weekofyear(self) -> float: ...
+ def day_name(self) -> float: ...
+ def month_name(self) -> float: ...
+ def weekday(self) -> float: ...
+ def isoweekday(self) -> float: ...
+ def total_seconds(self) -> float: ...
+ def today(self, *args, **kwargs) -> NaTType: ...
+ def now(self, *args, **kwargs) -> NaTType: ...
+ def to_pydatetime(self) -> NaTType: ...
+ def date(self) -> NaTType: ...
+ def round(self) -> NaTType: ...
+ def floor(self) -> NaTType: ...
+ def ceil(self) -> NaTType: ...
+ @property
+ def tzinfo(self) -> None: ...
+ @property
+ def tz(self) -> None: ...
+ def tz_convert(self, tz: _tzinfo | str | None) -> NaTType: ...
+ def tz_localize(
+ self,
+ tz: _tzinfo | str | None,
+ ambiguous: str = ...,
+ nonexistent: str = ...,
+ ) -> NaTType: ...
+ def replace(
+ self,
+ year: int | None = ...,
+ month: int | None = ...,
+ day: int | None = ...,
+ hour: int | None = ...,
+ minute: int | None = ...,
+ second: int | None = ...,
+ microsecond: int | None = ...,
+ nanosecond: int | None = ...,
+ tzinfo: _tzinfo | None = ...,
+ fold: int | None = ...,
+ ) -> NaTType: ...
+ @property
+ def year(self) -> float: ...
+ @property
+ def quarter(self) -> float: ...
+ @property
+ def month(self) -> float: ...
+ @property
+ def day(self) -> float: ...
+ @property
+ def hour(self) -> float: ...
+ @property
+ def minute(self) -> float: ...
+ @property
+ def second(self) -> float: ...
+ @property
+ def millisecond(self) -> float: ...
+ @property
+ def microsecond(self) -> float: ...
+ @property
+ def nanosecond(self) -> float: ...
+ # inject Timedelta properties
+ @property
+ def days(self) -> float: ...
+ @property
+ def microseconds(self) -> float: ...
+ @property
+ def nanoseconds(self) -> float: ...
+ # inject Period properties
+ @property
+ def qyear(self) -> float: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __ne__(self, other: object) -> bool: ...
+ __lt__: _NatComparison
+ __le__: _NatComparison
+ __gt__: _NatComparison
+ __ge__: _NatComparison
+ def as_unit(self, unit: str, round_ok: bool = ...) -> NaTType: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/np_datetime.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/np_datetime.pyi
new file mode 100644
index 0000000000..0cb0e3b023
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/np_datetime.pyi
@@ -0,0 +1,21 @@
+import numpy as np
+
+from pandas._typing import npt
+
+class OutOfBoundsDatetime(ValueError): ...
+class OutOfBoundsTimedelta(ValueError): ...
+
+# only exposed for testing
+def py_get_unit_from_dtype(dtype: np.dtype): ...
+def py_td64_to_tdstruct(td64: int, unit: int) -> dict: ...
+def astype_overflowsafe(
+ arr: np.ndarray,
+ dtype: np.dtype,
+ copy: bool = ...,
+ round_ok: bool = ...,
+ is_coerce: bool = ...,
+) -> np.ndarray: ...
+def is_unitless(dtype: np.dtype) -> bool: ...
+def compare_mismatched_resolutions(
+ left: np.ndarray, right: np.ndarray, op
+) -> npt.NDArray[np.bool_]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/offsets.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/offsets.pyi
new file mode 100644
index 0000000000..f1aca47176
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/offsets.pyi
@@ -0,0 +1,279 @@
+from datetime import (
+ datetime,
+ timedelta,
+)
+from typing import (
+ Any,
+ Collection,
+ Literal,
+ TypeVar,
+ overload,
+)
+
+import numpy as np
+
+from pandas._libs.tslibs.nattype import NaTType
+from pandas._typing import npt
+
+from .timedeltas import Timedelta
+
+_BaseOffsetT = TypeVar("_BaseOffsetT", bound=BaseOffset)
+_DatetimeT = TypeVar("_DatetimeT", bound=datetime)
+_TimedeltaT = TypeVar("_TimedeltaT", bound=timedelta)
+
+_relativedelta_kwds: set[str]
+prefix_mapping: dict[str, type]
+
+class ApplyTypeError(TypeError): ...
+
+class BaseOffset:
+ n: int
+ def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
+ def __eq__(self, other) -> bool: ...
+ def __ne__(self, other) -> bool: ...
+ def __hash__(self) -> int: ...
+ @property
+ def kwds(self) -> dict: ...
+ @property
+ def base(self) -> BaseOffset: ...
+ @overload
+ def __add__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ...
+ @overload
+ def __add__(self: _BaseOffsetT, other: BaseOffset) -> _BaseOffsetT: ...
+ @overload
+ def __add__(self, other: _DatetimeT) -> _DatetimeT: ...
+ @overload
+ def __add__(self, other: _TimedeltaT) -> _TimedeltaT: ...
+ @overload
+ def __radd__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ...
+ @overload
+ def __radd__(self: _BaseOffsetT, other: BaseOffset) -> _BaseOffsetT: ...
+ @overload
+ def __radd__(self, other: _DatetimeT) -> _DatetimeT: ...
+ @overload
+ def __radd__(self, other: _TimedeltaT) -> _TimedeltaT: ...
+ @overload
+ def __radd__(self, other: NaTType) -> NaTType: ...
+ def __sub__(self: _BaseOffsetT, other: BaseOffset) -> _BaseOffsetT: ...
+ @overload
+ def __rsub__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ...
+ @overload
+ def __rsub__(self: _BaseOffsetT, other: BaseOffset) -> _BaseOffsetT: ...
+ @overload
+ def __rsub__(self, other: _DatetimeT) -> _DatetimeT: ...
+ @overload
+ def __rsub__(self, other: _TimedeltaT) -> _TimedeltaT: ...
+ @overload
+ def __mul__(self, other: np.ndarray) -> np.ndarray: ...
+ @overload
+ def __mul__(self: _BaseOffsetT, other: int) -> _BaseOffsetT: ...
+ @overload
+ def __rmul__(self, other: np.ndarray) -> np.ndarray: ...
+ @overload
+ def __rmul__(self: _BaseOffsetT, other: int) -> _BaseOffsetT: ...
+ def __neg__(self: _BaseOffsetT) -> _BaseOffsetT: ...
+ def copy(self: _BaseOffsetT) -> _BaseOffsetT: ...
+ @property
+ def name(self) -> str: ...
+ @property
+ def rule_code(self) -> str: ...
+ @property
+ def freqstr(self) -> str: ...
+ def _apply(self, other): ...
+ def _apply_array(self, dtarr) -> None: ...
+ def rollback(self, dt: datetime) -> datetime: ...
+ def rollforward(self, dt: datetime) -> datetime: ...
+ def is_on_offset(self, dt: datetime) -> bool: ...
+ def __setstate__(self, state) -> None: ...
+ def __getstate__(self): ...
+ @property
+ def nanos(self) -> int: ...
+ def is_anchored(self) -> bool: ...
+
+def _get_offset(name: str) -> BaseOffset: ...
+
+class SingleConstructorOffset(BaseOffset):
+ @classmethod
+ def _from_name(cls, suffix: None = ...): ...
+ def __reduce__(self): ...
+
+@overload
+def to_offset(freq: None) -> None: ...
+@overload
+def to_offset(freq: _BaseOffsetT) -> _BaseOffsetT: ...
+@overload
+def to_offset(freq: timedelta | str) -> BaseOffset: ...
+
+class Tick(SingleConstructorOffset):
+ _creso: int
+ _prefix: str
+ _td64_unit: str
+ def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
+ @property
+ def delta(self) -> Timedelta: ...
+ @property
+ def nanos(self) -> int: ...
+
+def delta_to_tick(delta: timedelta) -> Tick: ...
+
+class Day(Tick): ...
+class Hour(Tick): ...
+class Minute(Tick): ...
+class Second(Tick): ...
+class Milli(Tick): ...
+class Micro(Tick): ...
+class Nano(Tick): ...
+
+class RelativeDeltaOffset(BaseOffset):
+ def __init__(self, n: int = ..., normalize: bool = ..., **kwds: Any) -> None: ...
+
+class BusinessMixin(SingleConstructorOffset):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., offset: timedelta = ...
+ ) -> None: ...
+
+class BusinessDay(BusinessMixin): ...
+
+class BusinessHour(BusinessMixin):
+ def __init__(
+ self,
+ n: int = ...,
+ normalize: bool = ...,
+ start: str | Collection[str] = ...,
+ end: str | Collection[str] = ...,
+ offset: timedelta = ...,
+ ) -> None: ...
+
+class WeekOfMonthMixin(SingleConstructorOffset):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., weekday: int = ...
+ ) -> None: ...
+
+class YearOffset(SingleConstructorOffset):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., month: int | None = ...
+ ) -> None: ...
+
+class BYearEnd(YearOffset): ...
+class BYearBegin(YearOffset): ...
+class YearEnd(YearOffset): ...
+class YearBegin(YearOffset): ...
+
+class QuarterOffset(SingleConstructorOffset):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., startingMonth: int | None = ...
+ ) -> None: ...
+
+class BQuarterEnd(QuarterOffset): ...
+class BQuarterBegin(QuarterOffset): ...
+class QuarterEnd(QuarterOffset): ...
+class QuarterBegin(QuarterOffset): ...
+class MonthOffset(SingleConstructorOffset): ...
+class MonthEnd(MonthOffset): ...
+class MonthBegin(MonthOffset): ...
+class BusinessMonthEnd(MonthOffset): ...
+class BusinessMonthBegin(MonthOffset): ...
+
+class SemiMonthOffset(SingleConstructorOffset):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., day_of_month: int | None = ...
+ ) -> None: ...
+
+class SemiMonthEnd(SemiMonthOffset): ...
+class SemiMonthBegin(SemiMonthOffset): ...
+
+class Week(SingleConstructorOffset):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., weekday: int | None = ...
+ ) -> None: ...
+
+class WeekOfMonth(WeekOfMonthMixin):
+ def __init__(
+ self, n: int = ..., normalize: bool = ..., week: int = ..., weekday: int = ...
+ ) -> None: ...
+
+class LastWeekOfMonth(WeekOfMonthMixin): ...
+
+class FY5253Mixin(SingleConstructorOffset):
+ def __init__(
+ self,
+ n: int = ...,
+ normalize: bool = ...,
+ weekday: int = ...,
+ startingMonth: int = ...,
+ variation: Literal["nearest", "last"] = ...,
+ ) -> None: ...
+
+class FY5253(FY5253Mixin): ...
+
+class FY5253Quarter(FY5253Mixin):
+ def __init__(
+ self,
+ n: int = ...,
+ normalize: bool = ...,
+ weekday: int = ...,
+ startingMonth: int = ...,
+ qtr_with_extra_week: int = ...,
+ variation: Literal["nearest", "last"] = ...,
+ ) -> None: ...
+
+class Easter(SingleConstructorOffset): ...
+
+class _CustomBusinessMonth(BusinessMixin):
+ def __init__(
+ self,
+ n: int = ...,
+ normalize: bool = ...,
+ weekmask: str = ...,
+ holidays: list | None = ...,
+ calendar: np.busdaycalendar | None = ...,
+ offset: timedelta = ...,
+ ) -> None: ...
+
+class CustomBusinessDay(BusinessDay):
+ def __init__(
+ self,
+ n: int = ...,
+ normalize: bool = ...,
+ weekmask: str = ...,
+ holidays: list | None = ...,
+ calendar: np.busdaycalendar | None = ...,
+ offset: timedelta = ...,
+ ) -> None: ...
+
+class CustomBusinessHour(BusinessHour):
+ def __init__(
+ self,
+ n: int = ...,
+ normalize: bool = ...,
+ weekmask: str = ...,
+ holidays: list | None = ...,
+ calendar: np.busdaycalendar | None = ...,
+ start: str = ...,
+ end: str = ...,
+ offset: timedelta = ...,
+ ) -> None: ...
+
+class CustomBusinessMonthEnd(_CustomBusinessMonth): ...
+class CustomBusinessMonthBegin(_CustomBusinessMonth): ...
+class OffsetMeta(type): ...
+class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): ...
+
+BDay = BusinessDay
+BMonthEnd = BusinessMonthEnd
+BMonthBegin = BusinessMonthBegin
+CBMonthEnd = CustomBusinessMonthEnd
+CBMonthBegin = CustomBusinessMonthBegin
+CDay = CustomBusinessDay
+
+def roll_qtrday(
+ other: datetime, n: int, month: int, day_opt: str, modby: int
+) -> int: ...
+
+INVALID_FREQ_ERR_MSG: Literal["Invalid frequency: {0}"]
+
+def shift_months(
+ dtindex: npt.NDArray[np.int64], months: int, day_opt: str | None = ...
+) -> npt.NDArray[np.int64]: ...
+
+_offset_map: dict[str, BaseOffset]
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/parsing.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/parsing.pyi
new file mode 100644
index 0000000000..83a5b0085f
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/parsing.pyi
@@ -0,0 +1,38 @@
+from datetime import datetime
+
+import numpy as np
+
+from pandas._typing import npt
+
+class DateParseError(ValueError): ...
+
+def py_parse_datetime_string(
+ date_string: str,
+ dayfirst: bool = ...,
+ yearfirst: bool = ...,
+) -> datetime: ...
+def parse_datetime_string_with_reso(
+ date_string: str,
+ freq: str | None = ...,
+ dayfirst: bool | None = ...,
+ yearfirst: bool | None = ...,
+) -> tuple[datetime, str]: ...
+def _does_string_look_like_datetime(py_string: str) -> bool: ...
+def quarter_to_myear(year: int, quarter: int, freq: str) -> tuple[int, int]: ...
+def try_parse_dates(
+ values: npt.NDArray[np.object_], # object[:]
+ parser,
+) -> npt.NDArray[np.object_]: ...
+def try_parse_year_month_day(
+ years: npt.NDArray[np.object_], # object[:]
+ months: npt.NDArray[np.object_], # object[:]
+ days: npt.NDArray[np.object_], # object[:]
+) -> npt.NDArray[np.object_]: ...
+def guess_datetime_format(
+ dt_str,
+ dayfirst: bool | None = ...,
+) -> str | None: ...
+def concat_date_cols(
+ date_cols: tuple,
+) -> npt.NDArray[np.object_]: ...
+def get_rule_month(source: str) -> str: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/period.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/period.pyi
new file mode 100644
index 0000000000..946ae1215f
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/period.pyi
@@ -0,0 +1,127 @@
+from datetime import timedelta
+from typing import Literal
+
+import numpy as np
+
+from pandas._libs.tslibs.nattype import NaTType
+from pandas._libs.tslibs.offsets import BaseOffset
+from pandas._libs.tslibs.timestamps import Timestamp
+from pandas._typing import (
+ Frequency,
+ npt,
+)
+
+INVALID_FREQ_ERR_MSG: str
+DIFFERENT_FREQ: str
+
+class IncompatibleFrequency(ValueError): ...
+
+def periodarr_to_dt64arr(
+ periodarr: npt.NDArray[np.int64], # const int64_t[:]
+ freq: int,
+) -> npt.NDArray[np.int64]: ...
+def period_asfreq_arr(
+ arr: npt.NDArray[np.int64],
+ freq1: int,
+ freq2: int,
+ end: bool,
+) -> npt.NDArray[np.int64]: ...
+def get_period_field_arr(
+ field: str,
+ arr: npt.NDArray[np.int64], # const int64_t[:]
+ freq: int,
+) -> npt.NDArray[np.int64]: ...
+def from_ordinals(
+ values: npt.NDArray[np.int64], # const int64_t[:]
+ freq: timedelta | BaseOffset | str,
+) -> npt.NDArray[np.int64]: ...
+def extract_ordinals(
+ values: npt.NDArray[np.object_],
+ freq: Frequency | int,
+) -> npt.NDArray[np.int64]: ...
+def extract_freq(
+ values: npt.NDArray[np.object_],
+) -> BaseOffset: ...
+
+# exposed for tests
+def period_asfreq(ordinal: int, freq1: int, freq2: int, end: bool) -> int: ...
+def period_ordinal(
+ y: int, m: int, d: int, h: int, min: int, s: int, us: int, ps: int, freq: int
+) -> int: ...
+def freq_to_dtype_code(freq: BaseOffset) -> int: ...
+def validate_end_alias(how: str) -> Literal["E", "S"]: ...
+
+class PeriodMixin:
+ @property
+ def end_time(self) -> Timestamp: ...
+ @property
+ def start_time(self) -> Timestamp: ...
+ def _require_matching_freq(self, other, base: bool = ...) -> None: ...
+
+class Period(PeriodMixin):
+ ordinal: int # int64_t
+ freq: BaseOffset
+
+ # error: "__new__" must return a class instance (got "Union[Period, NaTType]")
+ def __new__( # type: ignore[misc]
+ cls,
+ value=...,
+ freq: int | str | BaseOffset | None = ...,
+ ordinal: int | None = ...,
+ year: int | None = ...,
+ month: int | None = ...,
+ quarter: int | None = ...,
+ day: int | None = ...,
+ hour: int | None = ...,
+ minute: int | None = ...,
+ second: int | None = ...,
+ ) -> Period | NaTType: ...
+ @classmethod
+ def _maybe_convert_freq(cls, freq) -> BaseOffset: ...
+ @classmethod
+ def _from_ordinal(cls, ordinal: int, freq) -> Period: ...
+ @classmethod
+ def now(cls, freq: BaseOffset = ...) -> Period: ...
+ def strftime(self, fmt: str) -> str: ...
+ def to_timestamp(
+ self,
+ freq: str | BaseOffset | None = ...,
+ how: str = ...,
+ ) -> Timestamp: ...
+ def asfreq(self, freq: str | BaseOffset, how: str = ...) -> Period: ...
+ @property
+ def freqstr(self) -> str: ...
+ @property
+ def is_leap_year(self) -> bool: ...
+ @property
+ def daysinmonth(self) -> int: ...
+ @property
+ def days_in_month(self) -> int: ...
+ @property
+ def qyear(self) -> int: ...
+ @property
+ def quarter(self) -> int: ...
+ @property
+ def day_of_year(self) -> int: ...
+ @property
+ def weekday(self) -> int: ...
+ @property
+ def day_of_week(self) -> int: ...
+ @property
+ def week(self) -> int: ...
+ @property
+ def weekofyear(self) -> int: ...
+ @property
+ def second(self) -> int: ...
+ @property
+ def minute(self) -> int: ...
+ @property
+ def hour(self) -> int: ...
+ @property
+ def day(self) -> int: ...
+ @property
+ def month(self) -> int: ...
+ @property
+ def year(self) -> int: ...
+ def __sub__(self, other) -> Period | BaseOffset: ...
+ def __add__(self, other) -> Period: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/strptime.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/strptime.pyi
new file mode 100644
index 0000000000..4565bb7ecf
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/strptime.pyi
@@ -0,0 +1,13 @@
+import numpy as np
+
+from pandas._typing import npt
+
+def array_strptime(
+ values: npt.NDArray[np.object_],
+ fmt: str | None,
+ exact: bool = ...,
+ errors: str = ...,
+ utc: bool = ...,
+) -> tuple[np.ndarray, np.ndarray]: ...
+
+# first ndarray is M8[ns], second is object ndarray of tzinfo | None
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/timedeltas.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/timedeltas.pyi
new file mode 100644
index 0000000000..d67a330e0b
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/timedeltas.pyi
@@ -0,0 +1,163 @@
+from datetime import timedelta
+from typing import (
+ ClassVar,
+ Literal,
+ TypeVar,
+ overload,
+)
+
+import numpy as np
+
+from pandas._libs.tslibs import (
+ NaTType,
+ Tick,
+)
+from pandas._typing import npt
+
+# This should be kept consistent with the keys in the dict timedelta_abbrevs
+# in pandas/_libs/tslibs/timedeltas.pyx
+UnitChoices = Literal[
+ "Y",
+ "y",
+ "M",
+ "W",
+ "w",
+ "D",
+ "d",
+ "days",
+ "day",
+ "hours",
+ "hour",
+ "hr",
+ "h",
+ "m",
+ "minute",
+ "min",
+ "minutes",
+ "t",
+ "s",
+ "seconds",
+ "sec",
+ "second",
+ "ms",
+ "milliseconds",
+ "millisecond",
+ "milli",
+ "millis",
+ "l",
+ "us",
+ "microseconds",
+ "microsecond",
+ "µs",
+ "micro",
+ "micros",
+ "u",
+ "ns",
+ "nanoseconds",
+ "nano",
+ "nanos",
+ "nanosecond",
+ "n",
+]
+_S = TypeVar("_S", bound=timedelta)
+
+def ints_to_pytimedelta(
+ arr: npt.NDArray[np.timedelta64],
+ box: bool = ...,
+) -> npt.NDArray[np.object_]: ...
+def array_to_timedelta64(
+ values: npt.NDArray[np.object_],
+ unit: str | None = ...,
+ errors: str = ...,
+) -> np.ndarray: ... # np.ndarray[m8ns]
+def parse_timedelta_unit(unit: str | None) -> UnitChoices: ...
+def delta_to_nanoseconds(
+ delta: np.timedelta64 | timedelta | Tick,
+ reso: int = ..., # NPY_DATETIMEUNIT
+ round_ok: bool = ...,
+) -> int: ...
+def floordiv_object_array(
+ left: np.ndarray, right: npt.NDArray[np.object_]
+) -> np.ndarray: ...
+def truediv_object_array(
+ left: np.ndarray, right: npt.NDArray[np.object_]
+) -> np.ndarray: ...
+
+class Timedelta(timedelta):
+ _creso: int
+ min: ClassVar[Timedelta]
+ max: ClassVar[Timedelta]
+ resolution: ClassVar[Timedelta]
+ value: int # np.int64
+ _value: int # np.int64
+ # error: "__new__" must return a class instance (got "Union[Timestamp, NaTType]")
+ def __new__( # type: ignore[misc]
+ cls: type[_S],
+ value=...,
+ unit: str | None = ...,
+ **kwargs: float | np.integer | np.floating,
+ ) -> _S | NaTType: ...
+ @classmethod
+ def _from_value_and_reso(cls, value: np.int64, reso: int) -> Timedelta: ...
+ @property
+ def days(self) -> int: ...
+ @property
+ def seconds(self) -> int: ...
+ @property
+ def microseconds(self) -> int: ...
+ def total_seconds(self) -> float: ...
+ def to_pytimedelta(self) -> timedelta: ...
+ def to_timedelta64(self) -> np.timedelta64: ...
+ @property
+ def asm8(self) -> np.timedelta64: ...
+ # TODO: round/floor/ceil could return NaT?
+ def round(self: _S, freq: str) -> _S: ...
+ def floor(self: _S, freq: str) -> _S: ...
+ def ceil(self: _S, freq: str) -> _S: ...
+ @property
+ def resolution_string(self) -> str: ...
+ def __add__(self, other: timedelta) -> Timedelta: ...
+ def __radd__(self, other: timedelta) -> Timedelta: ...
+ def __sub__(self, other: timedelta) -> Timedelta: ...
+ def __rsub__(self, other: timedelta) -> Timedelta: ...
+ def __neg__(self) -> Timedelta: ...
+ def __pos__(self) -> Timedelta: ...
+ def __abs__(self) -> Timedelta: ...
+ def __mul__(self, other: float) -> Timedelta: ...
+ def __rmul__(self, other: float) -> Timedelta: ...
+ # error: Signature of "__floordiv__" incompatible with supertype "timedelta"
+ @overload # type: ignore[override]
+ def __floordiv__(self, other: timedelta) -> int: ...
+ @overload
+ def __floordiv__(self, other: float) -> Timedelta: ...
+ @overload
+ def __floordiv__(
+ self, other: npt.NDArray[np.timedelta64]
+ ) -> npt.NDArray[np.intp]: ...
+ @overload
+ def __floordiv__(
+ self, other: npt.NDArray[np.number]
+ ) -> npt.NDArray[np.timedelta64] | Timedelta: ...
+ @overload
+ def __rfloordiv__(self, other: timedelta | str) -> int: ...
+ @overload
+ def __rfloordiv__(self, other: None | NaTType) -> NaTType: ...
+ @overload
+ def __rfloordiv__(self, other: np.ndarray) -> npt.NDArray[np.timedelta64]: ...
+ @overload
+ def __truediv__(self, other: timedelta) -> float: ...
+ @overload
+ def __truediv__(self, other: float) -> Timedelta: ...
+ def __mod__(self, other: timedelta) -> Timedelta: ...
+ def __divmod__(self, other: timedelta) -> tuple[int, Timedelta]: ...
+ def __le__(self, other: timedelta) -> bool: ...
+ def __lt__(self, other: timedelta) -> bool: ...
+ def __ge__(self, other: timedelta) -> bool: ...
+ def __gt__(self, other: timedelta) -> bool: ...
+ def __hash__(self) -> int: ...
+ def isoformat(self) -> str: ...
+ def to_numpy(self) -> np.timedelta64: ...
+ def view(self, dtype: npt.DTypeLike = ...) -> object: ...
+ @property
+ def unit(self) -> str: ...
+ def as_unit(self, unit: str, round_ok: bool = ...) -> Timedelta: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/timestamps.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/timestamps.pyi
new file mode 100644
index 0000000000..26b0c9170a
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/timestamps.pyi
@@ -0,0 +1,228 @@
+from datetime import (
+ date as _date,
+ datetime,
+ time as _time,
+ timedelta,
+ tzinfo as _tzinfo,
+)
+from time import struct_time
+from typing import (
+ ClassVar,
+ TypeVar,
+ overload,
+)
+
+import numpy as np
+
+from pandas._libs.tslibs import (
+ BaseOffset,
+ NaTType,
+ Period,
+ Tick,
+ Timedelta,
+)
+
+_DatetimeT = TypeVar("_DatetimeT", bound=datetime)
+
+def integer_op_not_supported(obj: object) -> TypeError: ...
+
+class Timestamp(datetime):
+ _creso: int
+ min: ClassVar[Timestamp]
+ max: ClassVar[Timestamp]
+
+ resolution: ClassVar[Timedelta]
+ _value: int # np.int64
+ # error: "__new__" must return a class instance (got "Union[Timestamp, NaTType]")
+ def __new__( # type: ignore[misc]
+ cls: type[_DatetimeT],
+ ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ...,
+ year: int | None = ...,
+ month: int | None = ...,
+ day: int | None = ...,
+ hour: int | None = ...,
+ minute: int | None = ...,
+ second: int | None = ...,
+ microsecond: int | None = ...,
+ tzinfo: _tzinfo | None = ...,
+ *,
+ nanosecond: int | None = ...,
+ tz: str | _tzinfo | None | int = ...,
+ unit: str | int | None = ...,
+ fold: int | None = ...,
+ ) -> _DatetimeT | NaTType: ...
+ @classmethod
+ def _from_value_and_reso(
+ cls, value: int, reso: int, tz: _tzinfo | None
+ ) -> Timestamp: ...
+ @property
+ def value(self) -> int: ... # np.int64
+ @property
+ def year(self) -> int: ...
+ @property
+ def month(self) -> int: ...
+ @property
+ def day(self) -> int: ...
+ @property
+ def hour(self) -> int: ...
+ @property
+ def minute(self) -> int: ...
+ @property
+ def second(self) -> int: ...
+ @property
+ def microsecond(self) -> int: ...
+ @property
+ def nanosecond(self) -> int: ...
+ @property
+ def tzinfo(self) -> _tzinfo | None: ...
+ @property
+ def tz(self) -> _tzinfo | None: ...
+ @property
+ def fold(self) -> int: ...
+ @classmethod
+ def fromtimestamp(
+ cls: type[_DatetimeT], ts: float, tz: _tzinfo | None = ...
+ ) -> _DatetimeT: ...
+ @classmethod
+ def utcfromtimestamp(cls: type[_DatetimeT], ts: float) -> _DatetimeT: ...
+ @classmethod
+ def today(cls: type[_DatetimeT], tz: _tzinfo | str | None = ...) -> _DatetimeT: ...
+ @classmethod
+ def fromordinal(
+ cls: type[_DatetimeT],
+ ordinal: int,
+ tz: _tzinfo | str | None = ...,
+ ) -> _DatetimeT: ...
+ @classmethod
+ def now(cls: type[_DatetimeT], tz: _tzinfo | str | None = ...) -> _DatetimeT: ...
+ @classmethod
+ def utcnow(cls: type[_DatetimeT]) -> _DatetimeT: ...
+ # error: Signature of "combine" incompatible with supertype "datetime"
+ @classmethod
+ def combine( # type: ignore[override]
+ cls, date: _date, time: _time
+ ) -> datetime: ...
+ @classmethod
+ def fromisoformat(cls: type[_DatetimeT], date_string: str) -> _DatetimeT: ...
+ def strftime(self, format: str) -> str: ...
+ def __format__(self, fmt: str) -> str: ...
+ def toordinal(self) -> int: ...
+ def timetuple(self) -> struct_time: ...
+ def timestamp(self) -> float: ...
+ def utctimetuple(self) -> struct_time: ...
+ def date(self) -> _date: ...
+ def time(self) -> _time: ...
+ def timetz(self) -> _time: ...
+ # LSP violation: nanosecond is not present in datetime.datetime.replace
+ # and has positional args following it
+ def replace( # type: ignore[override]
+ self: _DatetimeT,
+ year: int | None = ...,
+ month: int | None = ...,
+ day: int | None = ...,
+ hour: int | None = ...,
+ minute: int | None = ...,
+ second: int | None = ...,
+ microsecond: int | None = ...,
+ nanosecond: int | None = ...,
+ tzinfo: _tzinfo | type[object] | None = ...,
+ fold: int | None = ...,
+ ) -> _DatetimeT: ...
+ # LSP violation: datetime.datetime.astimezone has a default value for tz
+ def astimezone( # type: ignore[override]
+ self: _DatetimeT, tz: _tzinfo | None
+ ) -> _DatetimeT: ...
+ def ctime(self) -> str: ...
+ def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
+ @classmethod
+ def strptime(cls, date_string: str, format: str) -> datetime: ...
+ def utcoffset(self) -> timedelta | None: ...
+ def tzname(self) -> str | None: ...
+ def dst(self) -> timedelta | None: ...
+ def __le__(self, other: datetime) -> bool: ... # type: ignore[override]
+ def __lt__(self, other: datetime) -> bool: ... # type: ignore[override]
+ def __ge__(self, other: datetime) -> bool: ... # type: ignore[override]
+ def __gt__(self, other: datetime) -> bool: ... # type: ignore[override]
+ # error: Signature of "__add__" incompatible with supertype "date"/"datetime"
+ @overload # type: ignore[override]
+ def __add__(self, other: np.ndarray) -> np.ndarray: ...
+ @overload
+ def __add__(
+ self: _DatetimeT, other: timedelta | np.timedelta64 | Tick
+ ) -> _DatetimeT: ...
+ def __radd__(self: _DatetimeT, other: timedelta) -> _DatetimeT: ...
+ @overload # type: ignore[override]
+ def __sub__(self, other: datetime) -> Timedelta: ...
+ @overload
+ def __sub__(
+ self: _DatetimeT, other: timedelta | np.timedelta64 | Tick
+ ) -> _DatetimeT: ...
+ def __hash__(self) -> int: ...
+ def weekday(self) -> int: ...
+ def isoweekday(self) -> int: ...
+ def isocalendar(self) -> tuple[int, int, int]: ...
+ @property
+ def is_leap_year(self) -> bool: ...
+ @property
+ def is_month_start(self) -> bool: ...
+ @property
+ def is_quarter_start(self) -> bool: ...
+ @property
+ def is_year_start(self) -> bool: ...
+ @property
+ def is_month_end(self) -> bool: ...
+ @property
+ def is_quarter_end(self) -> bool: ...
+ @property
+ def is_year_end(self) -> bool: ...
+ def to_pydatetime(self, warn: bool = ...) -> datetime: ...
+ def to_datetime64(self) -> np.datetime64: ...
+ def to_period(self, freq: BaseOffset | str = ...) -> Period: ...
+ def to_julian_date(self) -> np.float64: ...
+ @property
+ def asm8(self) -> np.datetime64: ...
+ def tz_convert(self: _DatetimeT, tz: _tzinfo | str | None) -> _DatetimeT: ...
+ # TODO: could return NaT?
+ def tz_localize(
+ self: _DatetimeT,
+ tz: _tzinfo | str | None,
+ ambiguous: str = ...,
+ nonexistent: str = ...,
+ ) -> _DatetimeT: ...
+ def normalize(self: _DatetimeT) -> _DatetimeT: ...
+ # TODO: round/floor/ceil could return NaT?
+ def round(
+ self: _DatetimeT, freq: str, ambiguous: bool | str = ..., nonexistent: str = ...
+ ) -> _DatetimeT: ...
+ def floor(
+ self: _DatetimeT, freq: str, ambiguous: bool | str = ..., nonexistent: str = ...
+ ) -> _DatetimeT: ...
+ def ceil(
+ self: _DatetimeT, freq: str, ambiguous: bool | str = ..., nonexistent: str = ...
+ ) -> _DatetimeT: ...
+ def day_name(self, locale: str | None = ...) -> str: ...
+ def month_name(self, locale: str | None = ...) -> str: ...
+ @property
+ def day_of_week(self) -> int: ...
+ @property
+ def dayofweek(self) -> int: ...
+ @property
+ def day_of_year(self) -> int: ...
+ @property
+ def dayofyear(self) -> int: ...
+ @property
+ def quarter(self) -> int: ...
+ @property
+ def week(self) -> int: ...
+ def to_numpy(
+ self, dtype: np.dtype | None = ..., copy: bool = ...
+ ) -> np.datetime64: ...
+ @property
+ def _date_repr(self) -> str: ...
+ @property
+ def days_in_month(self) -> int: ...
+ @property
+ def daysinmonth(self) -> int: ...
+ @property
+ def unit(self) -> str: ...
+ def as_unit(self, unit: str, round_ok: bool = ...) -> Timestamp: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/timezones.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/timezones.pyi
new file mode 100644
index 0000000000..4e9f0c6ae6
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/timezones.pyi
@@ -0,0 +1,21 @@
+from datetime import (
+ datetime,
+ tzinfo,
+)
+from typing import Callable
+
+import numpy as np
+
+# imported from dateutil.tz
+dateutil_gettz: Callable[[str], tzinfo]
+
+def tz_standardize(tz: tzinfo) -> tzinfo: ...
+def tz_compare(start: tzinfo | None, end: tzinfo | None) -> bool: ...
+def infer_tzinfo(
+ start: datetime | None,
+ end: datetime | None,
+) -> tzinfo | None: ...
+def maybe_get_tz(tz: str | int | np.int64 | tzinfo | None) -> tzinfo | None: ...
+def get_timezone(tz: tzinfo) -> tzinfo | str: ...
+def is_utc(tz: tzinfo | None) -> bool: ...
+def is_fixed_offset(tz: tzinfo) -> bool: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/tzconversion.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/tzconversion.pyi
new file mode 100644
index 0000000000..a354765a34
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/tzconversion.pyi
@@ -0,0 +1,21 @@
+from datetime import (
+ timedelta,
+ tzinfo,
+)
+from typing import Iterable
+
+import numpy as np
+
+from pandas._typing import npt
+
+# tz_convert_from_utc_single exposed for testing
+def tz_convert_from_utc_single(
+ val: np.int64, tz: tzinfo, creso: int = ...
+) -> np.int64: ...
+def tz_localize_to_utc(
+ vals: npt.NDArray[np.int64],
+ tz: tzinfo | None,
+ ambiguous: str | bool | Iterable[bool] | None = ...,
+ nonexistent: str | timedelta | np.timedelta64 | None = ...,
+ creso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int64]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/tslibs/vectorized.pyi b/contrib/python/pandas/py3/pandas/_libs/tslibs/vectorized.pyi
new file mode 100644
index 0000000000..3fd9e2501e
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/tslibs/vectorized.pyi
@@ -0,0 +1,43 @@
+"""
+For cython types that cannot be represented precisely, closest-available
+python equivalents are used, and the precise types kept as adjacent comments.
+"""
+from datetime import tzinfo
+
+import numpy as np
+
+from pandas._libs.tslibs.dtypes import Resolution
+from pandas._typing import npt
+
+def dt64arr_to_periodarr(
+ stamps: npt.NDArray[np.int64],
+ freq: int,
+ tz: tzinfo | None,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int64]: ...
+def is_date_array_normalized(
+ stamps: npt.NDArray[np.int64],
+ tz: tzinfo | None,
+ reso: int, # NPY_DATETIMEUNIT
+) -> bool: ...
+def normalize_i8_timestamps(
+ stamps: npt.NDArray[np.int64],
+ tz: tzinfo | None,
+ reso: int, # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int64]: ...
+def get_resolution(
+ stamps: npt.NDArray[np.int64],
+ tz: tzinfo | None = ...,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> Resolution: ...
+def ints_to_pydatetime(
+ arr: npt.NDArray[np.int64],
+ tz: tzinfo | None = ...,
+ box: str = ...,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.object_]: ...
+def tz_convert_from_utc(
+ stamps: npt.NDArray[np.int64],
+ tz: tzinfo | None,
+ reso: int = ..., # NPY_DATETIMEUNIT
+) -> npt.NDArray[np.int64]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/window/aggregations.pyi b/contrib/python/pandas/py3/pandas/_libs/window/aggregations.pyi
new file mode 100644
index 0000000000..b926a7cb73
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/window/aggregations.pyi
@@ -0,0 +1,127 @@
+from typing import (
+ Any,
+ Callable,
+ Literal,
+)
+
+import numpy as np
+
+from pandas._typing import (
+ WindowingRankType,
+ npt,
+)
+
+def roll_sum(
+ values: np.ndarray, # const float64_t[:]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_mean(
+ values: np.ndarray, # const float64_t[:]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_var(
+ values: np.ndarray, # const float64_t[:]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+ ddof: int = ...,
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_skew(
+ values: np.ndarray, # np.ndarray[np.float64]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_kurt(
+ values: np.ndarray, # np.ndarray[np.float64]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_median_c(
+ values: np.ndarray, # np.ndarray[np.float64]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_max(
+ values: np.ndarray, # np.ndarray[np.float64]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_min(
+ values: np.ndarray, # np.ndarray[np.float64]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_quantile(
+ values: np.ndarray, # const float64_t[:]
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+ quantile: float, # float64_t
+ interpolation: Literal["linear", "lower", "higher", "nearest", "midpoint"],
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_rank(
+ values: np.ndarray,
+ start: np.ndarray,
+ end: np.ndarray,
+ minp: int,
+ percentile: bool,
+ method: WindowingRankType,
+ ascending: bool,
+) -> np.ndarray: ... # np.ndarray[float]
+def roll_apply(
+ obj: object,
+ start: np.ndarray, # np.ndarray[np.int64]
+ end: np.ndarray, # np.ndarray[np.int64]
+ minp: int, # int64_t
+ function: Callable[..., Any],
+ raw: bool,
+ args: tuple[Any, ...],
+ kwargs: dict[str, Any],
+) -> npt.NDArray[np.float64]: ...
+def roll_weighted_sum(
+ values: np.ndarray, # const float64_t[:]
+ weights: np.ndarray, # const float64_t[:]
+ minp: int,
+) -> np.ndarray: ... # np.ndarray[np.float64]
+def roll_weighted_mean(
+ values: np.ndarray, # const float64_t[:]
+ weights: np.ndarray, # const float64_t[:]
+ minp: int,
+) -> np.ndarray: ... # np.ndarray[np.float64]
+def roll_weighted_var(
+ values: np.ndarray, # const float64_t[:]
+ weights: np.ndarray, # const float64_t[:]
+ minp: int, # int64_t
+ ddof: int, # unsigned int
+) -> np.ndarray: ... # np.ndarray[np.float64]
+def ewm(
+ vals: np.ndarray, # const float64_t[:]
+ start: np.ndarray, # const int64_t[:]
+ end: np.ndarray, # const int64_t[:]
+ minp: int,
+ com: float, # float64_t
+ adjust: bool,
+ ignore_na: bool,
+ deltas: np.ndarray, # const float64_t[:]
+ normalize: bool,
+) -> np.ndarray: ... # np.ndarray[np.float64]
+def ewmcov(
+ input_x: np.ndarray, # const float64_t[:]
+ start: np.ndarray, # const int64_t[:]
+ end: np.ndarray, # const int64_t[:]
+ minp: int,
+ input_y: np.ndarray, # const float64_t[:]
+ com: float, # float64_t
+ adjust: bool,
+ ignore_na: bool,
+ bias: bool,
+) -> np.ndarray: ... # np.ndarray[np.float64]
diff --git a/contrib/python/pandas/py3/pandas/_libs/window/indexers.pyi b/contrib/python/pandas/py3/pandas/_libs/window/indexers.pyi
new file mode 100644
index 0000000000..c9bc64be34
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/window/indexers.pyi
@@ -0,0 +1,12 @@
+import numpy as np
+
+from pandas._typing import npt
+
+def calculate_variable_window_bounds(
+ num_values: int, # int64_t
+ window_size: int, # int64_t
+ min_periods,
+ center: bool,
+ closed: str | None,
+ index: np.ndarray, # const int64_t[:]
+) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.int64]]: ...
diff --git a/contrib/python/pandas/py3/pandas/_libs/writers.pyi b/contrib/python/pandas/py3/pandas/_libs/writers.pyi
new file mode 100644
index 0000000000..7b41856525
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/_libs/writers.pyi
@@ -0,0 +1,20 @@
+import numpy as np
+
+from pandas._typing import ArrayLike
+
+def write_csv_rows(
+ data: list[ArrayLike],
+ data_index: np.ndarray,
+ nlevels: int,
+ cols: np.ndarray,
+ writer: object, # _csv.writer
+) -> None: ...
+def convert_json_to_lines(arr: str) -> str: ...
+def max_len_string_array(
+ arr: np.ndarray, # pandas_string[:]
+) -> int: ...
+def word_len(val: object) -> int: ...
+def string_array_replace_from_nan_rep(
+ arr: np.ndarray, # np.ndarray[object, ndim=1]
+ nan_rep: object,
+) -> None: ...
diff --git a/contrib/python/pandas/py3/pandas/io/sas/_byteswap.pyi b/contrib/python/pandas/py3/pandas/io/sas/_byteswap.pyi
new file mode 100644
index 0000000000..bb0dbfc6a5
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/io/sas/_byteswap.pyi
@@ -0,0 +1,5 @@
+def read_float_with_byteswap(data: bytes, offset: int, byteswap: bool) -> float: ...
+def read_double_with_byteswap(data: bytes, offset: int, byteswap: bool) -> float: ...
+def read_uint16_with_byteswap(data: bytes, offset: int, byteswap: bool) -> int: ...
+def read_uint32_with_byteswap(data: bytes, offset: int, byteswap: bool) -> int: ...
+def read_uint64_with_byteswap(data: bytes, offset: int, byteswap: bool) -> int: ...
diff --git a/contrib/python/pandas/py3/pandas/io/sas/_sas.pyi b/contrib/python/pandas/py3/pandas/io/sas/_sas.pyi
new file mode 100644
index 0000000000..5d65e2b56b
--- /dev/null
+++ b/contrib/python/pandas/py3/pandas/io/sas/_sas.pyi
@@ -0,0 +1,7 @@
+from pandas.io.sas.sas7bdat import SAS7BDATReader
+
+class Parser:
+ def __init__(self, parser: SAS7BDATReader) -> None: ...
+ def read(self, nrows: int) -> None: ...
+
+def get_subheader_index(signature: bytes) -> int: ...
diff --git a/contrib/python/parso/py2/parso/__init__.pyi b/contrib/python/parso/py2/parso/__init__.pyi
new file mode 100644
index 0000000000..5f72f07aab
--- /dev/null
+++ b/contrib/python/parso/py2/parso/__init__.pyi
@@ -0,0 +1,19 @@
+from typing import Any, Optional, Union
+
+from parso.grammar import Grammar as Grammar, load_grammar as load_grammar
+from parso.parser import ParserSyntaxError as ParserSyntaxError
+from parso.utils import python_bytes_to_unicode as python_bytes_to_unicode, split_lines as split_lines
+
+__version__: str = ...
+
+def parse(
+ code: Optional[Union[str, bytes]],
+ *,
+ version: Optional[str] = None,
+ error_recovery: bool = True,
+ path: Optional[str] = None,
+ start_symbol: Optional[str] = None,
+ cache: bool = False,
+ diff_cache: bool = False,
+ cache_path: Optional[str] = None,
+) -> Any: ...
diff --git a/contrib/python/parso/py2/parso/grammar.pyi b/contrib/python/parso/py2/parso/grammar.pyi
new file mode 100644
index 0000000000..e5cd2eabd1
--- /dev/null
+++ b/contrib/python/parso/py2/parso/grammar.pyi
@@ -0,0 +1,38 @@
+from typing import Any, Callable, Generic, Optional, Sequence, TypeVar, Union
+from typing_extensions import Literal
+
+from parso.utils import PythonVersionInfo
+
+_Token = Any
+_NodeT = TypeVar("_NodeT")
+
+class Grammar(Generic[_NodeT]):
+ _default_normalizer_config: Optional[Any] = ...
+ _error_normalizer_config: Optional[Any] = None
+ _start_nonterminal: str = ...
+ _token_namespace: Optional[str] = None
+ def __init__(
+ self,
+ text: str,
+ tokenizer: Callable[[Sequence[str], int], Sequence[_Token]],
+ parser: Any = ...,
+ diff_parser: Any = ...,
+ ) -> None: ...
+ def parse(
+ self,
+ code: Union[str, bytes] = ...,
+ error_recovery: bool = ...,
+ path: Optional[str] = ...,
+ start_symbol: Optional[str] = ...,
+ cache: bool = ...,
+ diff_cache: bool = ...,
+ cache_path: Optional[str] = ...,
+ ) -> _NodeT: ...
+
+class PythonGrammar(Grammar):
+ version_info: PythonVersionInfo
+ def __init__(self, version_info: PythonVersionInfo, bnf_text: str) -> None: ...
+
+def load_grammar(
+ language: Literal["python"] = "python", version: Optional[str] = ..., path: str = ...
+) -> Grammar: ...
diff --git a/contrib/python/parso/py2/parso/pgen2/__init__.pyi b/contrib/python/parso/py2/parso/pgen2/__init__.pyi
new file mode 100644
index 0000000000..46c149f136
--- /dev/null
+++ b/contrib/python/parso/py2/parso/pgen2/__init__.pyi
@@ -0,0 +1 @@
+from parso.pgen2.generator import generate_grammar as generate_grammar
diff --git a/contrib/python/parso/py2/parso/pgen2/generator.pyi b/contrib/python/parso/py2/parso/pgen2/generator.pyi
new file mode 100644
index 0000000000..0d67a18423
--- /dev/null
+++ b/contrib/python/parso/py2/parso/pgen2/generator.pyi
@@ -0,0 +1,38 @@
+from typing import Any, Generic, Mapping, Sequence, Set, TypeVar, Union
+
+from parso.pgen2.grammar_parser import NFAState
+
+_TokenTypeT = TypeVar("_TokenTypeT")
+
+class Grammar(Generic[_TokenTypeT]):
+ nonterminal_to_dfas: Mapping[str, Sequence[DFAState[_TokenTypeT]]]
+ reserved_syntax_strings: Mapping[str, ReservedString]
+ start_nonterminal: str
+ def __init__(
+ self,
+ start_nonterminal: str,
+ rule_to_dfas: Mapping[str, Sequence[DFAState]],
+ reserved_syntax_strings: Mapping[str, ReservedString],
+ ) -> None: ...
+
+class DFAPlan:
+ next_dfa: DFAState
+ dfa_pushes: Sequence[DFAState]
+
+class DFAState(Generic[_TokenTypeT]):
+ from_rule: str
+ nfa_set: Set[NFAState]
+ is_final: bool
+ arcs: Mapping[str, DFAState] # map from all terminals/nonterminals to DFAState
+ nonterminal_arcs: Mapping[str, DFAState]
+ transitions: Mapping[Union[_TokenTypeT, ReservedString], DFAPlan]
+ def __init__(
+ self, from_rule: str, nfa_set: Set[NFAState], final: NFAState
+ ) -> None: ...
+
+class ReservedString:
+ value: str
+ def __init__(self, value: str) -> None: ...
+ def __repr__(self) -> str: ...
+
+def generate_grammar(bnf_grammar: str, token_namespace: Any) -> Grammar[Any]: ...
diff --git a/contrib/python/parso/py2/parso/pgen2/grammar_parser.pyi b/contrib/python/parso/py2/parso/pgen2/grammar_parser.pyi
new file mode 100644
index 0000000000..b73a5a6c72
--- /dev/null
+++ b/contrib/python/parso/py2/parso/pgen2/grammar_parser.pyi
@@ -0,0 +1,20 @@
+from typing import Generator, List, Optional, Tuple
+
+from parso.python.token import TokenType
+
+class GrammarParser:
+ generator: Generator[TokenType, None, None]
+ def __init__(self, bnf_grammar: str) -> None: ...
+ def parse(self) -> Generator[Tuple[NFAState, NFAState], None, None]: ...
+
+class NFAArc:
+ next: NFAState
+ nonterminal_or_string: Optional[str]
+ def __init__(
+ self, next_: NFAState, nonterminal_or_string: Optional[str]
+ ) -> None: ...
+
+class NFAState:
+ from_rule: str
+ arcs: List[NFAArc]
+ def __init__(self, from_rule: str) -> None: ...
diff --git a/contrib/python/parso/py2/parso/python/token.pyi b/contrib/python/parso/py2/parso/python/token.pyi
new file mode 100644
index 0000000000..48e8dac8f9
--- /dev/null
+++ b/contrib/python/parso/py2/parso/python/token.pyi
@@ -0,0 +1,30 @@
+from typing import Container, Iterable
+
+class TokenType:
+ name: str
+ contains_syntax: bool
+ def __init__(self, name: str, contains_syntax: bool) -> None: ...
+
+class TokenTypes:
+ def __init__(
+ self, names: Iterable[str], contains_syntax: Container[str]
+ ) -> None: ...
+
+# not an actual class in the source code, but we need this class to type the fields of
+# PythonTokenTypes
+class _FakePythonTokenTypesClass(TokenTypes):
+ STRING: TokenType
+ NUMBER: TokenType
+ NAME: TokenType
+ ERRORTOKEN: TokenType
+ NEWLINE: TokenType
+ INDENT: TokenType
+ DEDENT: TokenType
+ ERROR_DEDENT: TokenType
+ FSTRING_STRING: TokenType
+ FSTRING_START: TokenType
+ FSTRING_END: TokenType
+ OP: TokenType
+ ENDMARKER: TokenType
+
+PythonTokenTypes: _FakePythonTokenTypesClass = ...
diff --git a/contrib/python/parso/py2/parso/python/tokenize.pyi b/contrib/python/parso/py2/parso/python/tokenize.pyi
new file mode 100644
index 0000000000..1870bc2a7b
--- /dev/null
+++ b/contrib/python/parso/py2/parso/python/tokenize.pyi
@@ -0,0 +1,24 @@
+from typing import Generator, Iterable, NamedTuple, Tuple
+
+from parso.python.token import TokenType
+from parso.utils import PythonVersionInfo
+
+class Token(NamedTuple):
+ type: TokenType
+ string: str
+ start_pos: Tuple[int, int]
+ prefix: str
+ @property
+ def end_pos(self) -> Tuple[int, int]: ...
+
+class PythonToken(Token):
+ def __repr__(self) -> str: ...
+
+def tokenize(
+ code: str, version_info: PythonVersionInfo, start_pos: Tuple[int, int] = (1, 0)
+) -> Generator[PythonToken, None, None]: ...
+def tokenize_lines(
+ lines: Iterable[str],
+ version_info: PythonVersionInfo,
+ start_pos: Tuple[int, int] = (1, 0),
+) -> Generator[PythonToken, None, None]: ...
diff --git a/contrib/python/parso/py2/parso/utils.pyi b/contrib/python/parso/py2/parso/utils.pyi
new file mode 100644
index 0000000000..12c77dab83
--- /dev/null
+++ b/contrib/python/parso/py2/parso/utils.pyi
@@ -0,0 +1,29 @@
+from typing import NamedTuple, Optional, Sequence, Union
+
+class Version(NamedTuple):
+ major: int
+ minor: int
+ micro: int
+
+def split_lines(string: str, keepends: bool = ...) -> Sequence[str]: ...
+def python_bytes_to_unicode(
+ source: Union[str, bytes], encoding: str = ..., errors: str = ...
+) -> str: ...
+def version_info() -> Version:
+ """
+ Returns a namedtuple of parso's version, similar to Python's
+ ``sys.version_info``.
+ """
+ ...
+
+class PythonVersionInfo(NamedTuple):
+ major: int
+ minor: int
+
+def parse_version_string(version: Optional[str]) -> PythonVersionInfo:
+ """
+ Checks for a valid version number (e.g. `3.2` or `2.7.1` or `3`) and
+ returns a corresponding version info that is always two characters long in
+ decimal.
+ """
+ ...
diff --git a/contrib/python/py/py2/py/__init__.pyi b/contrib/python/py/py2/py/__init__.pyi
new file mode 100644
index 0000000000..96859e310f
--- /dev/null
+++ b/contrib/python/py/py2/py/__init__.pyi
@@ -0,0 +1,20 @@
+from typing import Any
+
+# py allows to use e.g. py.path.local even without importing py.path.
+# So import implicitly.
+from . import error
+from . import iniconfig
+from . import path
+from . import io
+from . import xml
+
+__version__: str
+
+# Untyped modules below here.
+std: Any
+test: Any
+process: Any
+apipkg: Any
+code: Any
+builtin: Any
+log: Any
diff --git a/contrib/python/py/py2/py/_vendored_packages/iniconfig/__init__.pyi b/contrib/python/py/py2/py/_vendored_packages/iniconfig/__init__.pyi
new file mode 100644
index 0000000000..b6284bec3f
--- /dev/null
+++ b/contrib/python/py/py2/py/_vendored_packages/iniconfig/__init__.pyi
@@ -0,0 +1,31 @@
+from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union
+from typing_extensions import Final
+
+_D = TypeVar('_D')
+_T = TypeVar('_T')
+
+class ParseError(Exception):
+ # Private __init__.
+ path: Final[str]
+ lineno: Final[int]
+ msg: Final[str]
+
+class SectionWrapper:
+ # Private __init__.
+ config: Final[IniConfig]
+ name: Final[str]
+ def __getitem__(self, key: str) -> str: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def items(self) -> Iterator[Tuple[str, str]]: ...
+ def lineof(self, name: str) -> Optional[int]: ...
+
+class IniConfig:
+ path: Final[str]
+ sections: Final[Mapping[str, Mapping[str, str]]]
+ def __init__(self, path: str, data: Optional[str] = None): ...
+ def __contains__(self, arg: str) -> bool: ...
+ def __getitem__(self, name: str) -> SectionWrapper: ...
+ def __iter__(self) -> Iterator[SectionWrapper]: ...
+ def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ...
diff --git a/contrib/python/py/py2/py/error.pyi b/contrib/python/py/py2/py/error.pyi
new file mode 100644
index 0000000000..034eba609f
--- /dev/null
+++ b/contrib/python/py/py2/py/error.pyi
@@ -0,0 +1,129 @@
+from typing import Any, Callable, TypeVar
+
+_T = TypeVar('_T')
+
+def checked_call(func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
+class Error(EnvironmentError): ...
+class EPERM(Error): ...
+class ENOENT(Error): ...
+class ESRCH(Error): ...
+class EINTR(Error): ...
+class EIO(Error): ...
+class ENXIO(Error): ...
+class E2BIG(Error): ...
+class ENOEXEC(Error): ...
+class EBADF(Error): ...
+class ECHILD(Error): ...
+class EAGAIN(Error): ...
+class ENOMEM(Error): ...
+class EACCES(Error): ...
+class EFAULT(Error): ...
+class ENOTBLK(Error): ...
+class EBUSY(Error): ...
+class EEXIST(Error): ...
+class EXDEV(Error): ...
+class ENODEV(Error): ...
+class ENOTDIR(Error): ...
+class EISDIR(Error): ...
+class EINVAL(Error): ...
+class ENFILE(Error): ...
+class EMFILE(Error): ...
+class ENOTTY(Error): ...
+class ETXTBSY(Error): ...
+class EFBIG(Error): ...
+class ENOSPC(Error): ...
+class ESPIPE(Error): ...
+class EROFS(Error): ...
+class EMLINK(Error): ...
+class EPIPE(Error): ...
+class EDOM(Error): ...
+class ERANGE(Error): ...
+class EDEADLCK(Error): ...
+class ENAMETOOLONG(Error): ...
+class ENOLCK(Error): ...
+class ENOSYS(Error): ...
+class ENOTEMPTY(Error): ...
+class ELOOP(Error): ...
+class EWOULDBLOCK(Error): ...
+class ENOMSG(Error): ...
+class EIDRM(Error): ...
+class ECHRNG(Error): ...
+class EL2NSYNC(Error): ...
+class EL3HLT(Error): ...
+class EL3RST(Error): ...
+class ELNRNG(Error): ...
+class EUNATCH(Error): ...
+class ENOCSI(Error): ...
+class EL2HLT(Error): ...
+class EBADE(Error): ...
+class EBADR(Error): ...
+class EXFULL(Error): ...
+class ENOANO(Error): ...
+class EBADRQC(Error): ...
+class EBADSLT(Error): ...
+class EDEADLOCK(Error): ...
+class EBFONT(Error): ...
+class ENOSTR(Error): ...
+class ENODATA(Error): ...
+class ETIME(Error): ...
+class ENOSR(Error): ...
+class ENONET(Error): ...
+class ENOPKG(Error): ...
+class EREMOTE(Error): ...
+class ENOLINK(Error): ...
+class EADV(Error): ...
+class ESRMNT(Error): ...
+class ECOMM(Error): ...
+class EPROTO(Error): ...
+class EMULTIHOP(Error): ...
+class EDOTDOT(Error): ...
+class EBADMSG(Error): ...
+class EOVERFLOW(Error): ...
+class ENOTUNIQ(Error): ...
+class EBADFD(Error): ...
+class EREMCHG(Error): ...
+class ELIBACC(Error): ...
+class ELIBBAD(Error): ...
+class ELIBSCN(Error): ...
+class ELIBMAX(Error): ...
+class ELIBEXEC(Error): ...
+class EILSEQ(Error): ...
+class ERESTART(Error): ...
+class ESTRPIPE(Error): ...
+class EUSERS(Error): ...
+class ENOTSOCK(Error): ...
+class EDESTADDRREQ(Error): ...
+class EMSGSIZE(Error): ...
+class EPROTOTYPE(Error): ...
+class ENOPROTOOPT(Error): ...
+class EPROTONOSUPPORT(Error): ...
+class ESOCKTNOSUPPORT(Error): ...
+class ENOTSUP(Error): ...
+class EOPNOTSUPP(Error): ...
+class EPFNOSUPPORT(Error): ...
+class EAFNOSUPPORT(Error): ...
+class EADDRINUSE(Error): ...
+class EADDRNOTAVAIL(Error): ...
+class ENETDOWN(Error): ...
+class ENETUNREACH(Error): ...
+class ENETRESET(Error): ...
+class ECONNABORTED(Error): ...
+class ECONNRESET(Error): ...
+class ENOBUFS(Error): ...
+class EISCONN(Error): ...
+class ENOTCONN(Error): ...
+class ESHUTDOWN(Error): ...
+class ETOOMANYREFS(Error): ...
+class ETIMEDOUT(Error): ...
+class ECONNREFUSED(Error): ...
+class EHOSTDOWN(Error): ...
+class EHOSTUNREACH(Error): ...
+class EALREADY(Error): ...
+class EINPROGRESS(Error): ...
+class ESTALE(Error): ...
+class EUCLEAN(Error): ...
+class ENOTNAM(Error): ...
+class ENAVAIL(Error): ...
+class EISNAM(Error): ...
+class EREMOTEIO(Error): ...
+class EDQUOT(Error): ...
diff --git a/contrib/python/py/py2/py/iniconfig.pyi b/contrib/python/py/py2/py/iniconfig.pyi
new file mode 100644
index 0000000000..b6284bec3f
--- /dev/null
+++ b/contrib/python/py/py2/py/iniconfig.pyi
@@ -0,0 +1,31 @@
+from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union
+from typing_extensions import Final
+
+_D = TypeVar('_D')
+_T = TypeVar('_T')
+
+class ParseError(Exception):
+ # Private __init__.
+ path: Final[str]
+ lineno: Final[int]
+ msg: Final[str]
+
+class SectionWrapper:
+ # Private __init__.
+ config: Final[IniConfig]
+ name: Final[str]
+ def __getitem__(self, key: str) -> str: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def items(self) -> Iterator[Tuple[str, str]]: ...
+ def lineof(self, name: str) -> Optional[int]: ...
+
+class IniConfig:
+ path: Final[str]
+ sections: Final[Mapping[str, Mapping[str, str]]]
+ def __init__(self, path: str, data: Optional[str] = None): ...
+ def __contains__(self, arg: str) -> bool: ...
+ def __getitem__(self, name: str) -> SectionWrapper: ...
+ def __iter__(self) -> Iterator[SectionWrapper]: ...
+ def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ...
diff --git a/contrib/python/py/py2/py/io.pyi b/contrib/python/py/py2/py/io.pyi
new file mode 100644
index 0000000000..d377e2405d
--- /dev/null
+++ b/contrib/python/py/py2/py/io.pyi
@@ -0,0 +1,130 @@
+from io import StringIO as TextIO
+from io import BytesIO as BytesIO
+from typing import Any, AnyStr, Callable, Generic, IO, List, Optional, Text, Tuple, TypeVar, Union, overload
+from typing_extensions import Final
+import sys
+
+_T = TypeVar("_T")
+
+class FDCapture(Generic[AnyStr]):
+ def __init__(self, targetfd: int, tmpfile: Optional[IO[AnyStr]] = ..., now: bool = ..., patchsys: bool = ...) -> None: ...
+ def start(self) -> None: ...
+ def done(self) -> IO[AnyStr]: ...
+ def writeorg(self, data: AnyStr) -> None: ...
+
+class StdCaptureFD:
+ def __init__(
+ self,
+ out: Union[bool, IO[str]] = ...,
+ err: Union[bool, IO[str]] = ...,
+ mixed: bool = ...,
+ in_: bool = ...,
+ patchsys: bool = ...,
+ now: bool = ...,
+ ) -> None: ...
+ @classmethod
+ def call(cls, func: Callable[..., _T], *args: Any, **kwargs: Any) -> Tuple[_T, str, str]: ...
+ def reset(self) -> Tuple[str, str]: ...
+ def suspend(self) -> Tuple[str, str]: ...
+ def startall(self) -> None: ...
+ def resume(self) -> None: ...
+ def done(self, save: bool = ...) -> Tuple[IO[str], IO[str]]: ...
+ def readouterr(self) -> Tuple[str, str]: ...
+
+class StdCapture:
+ def __init__(
+ self,
+ out: Union[bool, IO[str]] = ...,
+ err: Union[bool, IO[str]] = ...,
+ in_: bool = ...,
+ mixed: bool = ...,
+ now: bool = ...,
+ ) -> None: ...
+ @classmethod
+ def call(cls, func: Callable[..., _T], *args: Any, **kwargs: Any) -> Tuple[_T, str, str]: ...
+ def reset(self) -> Tuple[str, str]: ...
+ def suspend(self) -> Tuple[str, str]: ...
+ def startall(self) -> None: ...
+ def resume(self) -> None: ...
+ def done(self, save: bool = ...) -> Tuple[IO[str], IO[str]]: ...
+ def readouterr(self) -> Tuple[IO[str], IO[str]]: ...
+
+# XXX: The type here is not exactly right. If f is IO[bytes] and
+# encoding is not None, returns some weird hybrid, not exactly IO[bytes].
+def dupfile(
+ f: IO[AnyStr],
+ mode: Optional[str] = ...,
+ buffering: int = ...,
+ raising: bool = ...,
+ encoding: Optional[str] = ...,
+) -> IO[AnyStr]: ...
+def get_terminal_width() -> int: ...
+def ansi_print(
+ text: Union[str, Text],
+ esc: Union[Union[str, Text], Tuple[Union[str, Text], ...]],
+ file: Optional[IO[Any]] = ...,
+ newline: bool = ...,
+ flush: bool = ...,
+) -> None: ...
+def saferepr(obj, maxsize: int = ...) -> str: ...
+
+class TerminalWriter:
+ stringio: TextIO
+ encoding: Final[str]
+ hasmarkup: bool
+ def __init__(self, file: Optional[IO[str]] = ..., stringio: bool = ..., encoding: Optional[str] = ...) -> None: ...
+ @property
+ def fullwidth(self) -> int: ...
+ @fullwidth.setter
+ def fullwidth(self, value: int) -> None: ...
+ @property
+ def chars_on_current_line(self) -> int: ...
+ @property
+ def width_of_current_line(self) -> int: ...
+ def markup(
+ self,
+ text: str,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> str: ...
+ def sep(
+ self,
+ sepchar: str,
+ title: Optional[str] = ...,
+ fullwidth: Optional[int] = ...,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
+ def write(
+ self,
+ msg: str,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
+ def line(
+ self,
+ s: str = ...,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
+ def reline(
+ self,
+ line: str,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
diff --git a/contrib/python/py/py2/py/path.pyi b/contrib/python/py/py2/py/path.pyi
new file mode 100644
index 0000000000..1ddab9601e
--- /dev/null
+++ b/contrib/python/py/py2/py/path.pyi
@@ -0,0 +1,197 @@
+from typing import Any, AnyStr, Callable, ContextManager, Generic, IO, Iterable, Iterator, List, Optional, Text, Type, Union
+from typing_extensions import Final, Literal
+import os
+import sys
+
+class _FNMatcher(Generic[AnyStr]):
+ pattern: AnyStr = ...
+ def __init__(self, pattern: AnyStr) -> None: ...
+ def __call__(self, path: local) -> bool: ...
+
+class _Stat:
+ path: Final[local] = ...
+ mode: Final[int]
+ ino: Final[int]
+ dev: Final[int]
+ nlink: Final[int]
+ uid: Final[int]
+ gid: Final[int]
+ size: Final[int]
+ atime: Final[float]
+ mtime: Final[float]
+ ctime: Final[float]
+ atime_ns: Final[int]
+ mtime_ns: Final[int]
+ ctime_ns: Final[int]
+ if sys.version_info >= (3, 8) and sys.platform == "win32":
+ reparse_tag: Final[int]
+ blocks: Final[int]
+ blksize: Final[int]
+ rdev: Final[int]
+ flags: Final[int]
+ gen: Final[int]
+ birthtime: Final[int]
+ rsize: Final[int]
+ creator: Final[int]
+ type: Final[int]
+ if sys.platform != 'win32':
+ @property
+ def owner(self) -> str: ...
+ @property
+ def group(self) -> str: ...
+ def isdir(self) -> bool: ...
+ def isfile(self) -> bool: ...
+ def islink(self) -> bool: ...
+
+
+if sys.version_info >= (3, 6):
+ _PathLike = os.PathLike
+else:
+ class _PathLike(Generic[AnyStr]):
+ def __fspath__(self) -> AnyStr: ...
+_PathType = Union[bytes, Text, _PathLike[str], _PathLike[bytes], local]
+
+class local(_PathLike[str]):
+ class ImportMismatchError(ImportError): ...
+
+ sep: Final[str]
+ strpath: Final[str]
+
+ def __init__(self, path: _PathType = ..., expanduser: bool = ...) -> None: ...
+ def __hash__(self) -> int: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __lt__(self, other: object) -> bool: ...
+ def __gt__(self, other: object) -> bool: ...
+ def __add__(self, other: object) -> local: ...
+ def __cmp__(self, other: object) -> int: ...
+ def __div__(self, other: _PathType) -> local: ...
+ def __truediv__(self, other: _PathType) -> local: ...
+ def __fspath__(self) -> str: ...
+
+ @classmethod
+ def get_temproot(cls) -> local: ...
+ @classmethod
+ def make_numbered_dir(
+ cls,
+ prefix: str = ...,
+ rootdir: Optional[local] = ...,
+ keep: Optional[int] = ...,
+ lock_timeout: int = ...,
+ ) -> local: ...
+ @classmethod
+ def mkdtemp(cls, rootdir: Optional[local] = ...) -> local: ...
+ @classmethod
+ def sysfind(
+ cls,
+ name: _PathType,
+ checker: Optional[Callable[[local], bool]] = ...,
+ paths: Optional[Iterable[_PathType]] = ...,
+ ) -> Optional[local]: ...
+
+ @property
+ def basename(self) -> str: ...
+ @property
+ def dirname(self) -> str: ...
+ @property
+ def purebasename(self) -> str: ...
+ @property
+ def ext(self) -> str: ...
+
+ def as_cwd(self) -> ContextManager[Optional[local]]: ...
+ def atime(self) -> float: ...
+ def bestrelpath(self, dest: local) -> str: ...
+ def chdir(self) -> local: ...
+ def check(
+ self,
+ *,
+ basename: int = ..., notbasename: int = ...,
+ basestarts: int = ..., notbasestarts: int = ...,
+ dir: int = ..., notdir: int = ...,
+ dotfile: int = ..., notdotfile: int = ...,
+ endswith: int = ..., notendswith: int = ...,
+ exists: int = ..., notexists: int = ...,
+ ext: int = ..., notext: int = ...,
+ file: int = ..., notfile: int = ...,
+ fnmatch: int = ..., notfnmatch: int = ...,
+ link: int = ..., notlink: int = ...,
+ relto: int = ..., notrelto: int = ...,
+ ) -> bool: ...
+ def chmod(self, mode: int, rec: Union[int, str, Text, Callable[[local], bool]] = ...) -> None: ...
+ if sys.platform != 'win32':
+ def chown(self, user: Union[int, str], group: Union[int, str], rec: int = ...) -> None: ...
+ def common(self, other: local) -> Optional[local]: ...
+ def computehash(self, hashtype: str = ..., chunksize: int = ...) -> str: ...
+ def copy(self, target: local, mode: bool = ..., stat: bool = ...) -> None: ...
+ def dirpath(self, *args: _PathType, abs: int = ...) -> local: ...
+ def dump(self, obj: Any, bin: Optional[int] = ...) -> None: ...
+ def ensure(self, *args: _PathType, dir: int = ...) -> local: ...
+ def ensure_dir(self, *args: _PathType) -> local: ...
+ def exists(self) -> bool: ...
+ def fnmatch(self, pattern: str): _FNMatcher
+ def isdir(self) -> bool: ...
+ def isfile(self) -> bool: ...
+ def islink(self) -> bool: ...
+ def join(self, *args: _PathType, abs: int = ...) -> local: ...
+ def listdir(
+ self,
+ fil: Optional[Union[str, Text, Callable[[local], bool]]] = ...,
+ sort: Optional[bool] = ...,
+ ) -> List[local]: ...
+ def load(self) -> Any: ...
+ def lstat(self) -> _Stat: ...
+ def mkdir(self, *args: _PathType) -> local: ...
+ if sys.platform != 'win32':
+ def mklinkto(self, oldname: Union[str, local]) -> None: ...
+ def mksymlinkto(self, value: local, absolute: int = ...) -> None: ...
+ def move(self, target: local) -> None: ...
+ def mtime(self) -> float: ...
+ def new(
+ self,
+ *,
+ drive: str = ...,
+ dirname: str = ...,
+ basename: str = ...,
+ purebasename: str = ...,
+ ext: str = ...,
+ ) -> local: ...
+ def open(self, mode: str = ..., ensure: bool = ..., encoding: Optional[str] = ...) -> IO[Any]: ...
+ def parts(self, reverse: bool = ...) -> List[local]: ...
+ def pyimport(
+ self,
+ modname: Optional[str] = ...,
+ ensuresyspath: Union[bool, Literal["append", "importlib"]] = ...,
+ ) -> Any: ...
+ def pypkgpath(self) -> Optional[local]: ...
+ def read(self, mode: str = ...) -> Union[Text, bytes]: ...
+ def read_binary(self) -> bytes: ...
+ def read_text(self, encoding: str) -> Text: ...
+ def readlines(self, cr: int = ...) -> List[str]: ...
+ if sys.platform != 'win32':
+ def readlink(self) -> str: ...
+ def realpath(self) -> local: ...
+ def relto(self, relpath: Union[str, local]) -> str: ...
+ def remove(self, rec: int = ..., ignore_errors: bool = ...) -> None: ...
+ def rename(self, target: _PathType) -> None: ...
+ def samefile(self, other: _PathType) -> bool: ...
+ def setmtime(self, mtime: Optional[float] = ...) -> None: ...
+ def size(self) -> int: ...
+ def stat(self, raising: bool = ...) -> _Stat: ...
+ def sysexec(self, *argv: Any, **popen_opts: Any) -> Text: ...
+ def visit(
+ self,
+ fil: Optional[Union[str, Text, Callable[[local], bool]]] = ...,
+ rec: Optional[Union[Literal[1, True], str, Text, Callable[[local], bool]]] = ...,
+ ignore: Type[Exception] = ...,
+ bf: bool = ...,
+ sort: bool = ...,
+ ) -> Iterator[local]: ...
+ def write(self, data: Any, mode: str = ..., ensure: bool = ...) -> None: ...
+ def write_binary(self, data: bytes, ensure: bool = ...) -> None: ...
+ def write_text(self, data: Union[str, Text], encoding: str, ensure: bool = ...) -> None: ...
+
+
+# Untyped types below here.
+svnwc: Any
+svnurl: Any
+SvnAuth: Any
diff --git a/contrib/python/py/py2/py/xml.pyi b/contrib/python/py/py2/py/xml.pyi
new file mode 100644
index 0000000000..9c44480a5f
--- /dev/null
+++ b/contrib/python/py/py2/py/xml.pyi
@@ -0,0 +1,25 @@
+from typing import ClassVar, Generic, Iterable, Text, Type, Union
+from typing_extensions import Final
+
+class raw:
+ uniobj: Final[Text]
+ def __init__(self, uniobj: Text) -> None: ...
+
+class _NamespaceMetaclass(type):
+ def __getattr__(self, name: str) -> Type[Tag]: ...
+
+class Namespace(metaclass=_NamespaceMetaclass): ...
+
+class Tag(list):
+ class Attr:
+ def __getattr__(self, attr: str) -> Text: ...
+ attr: Final[Attr]
+ def __init__(self, *args: Union[Text, raw, Tag, Iterable[Tag]], **kwargs: Union[Text, raw]) -> None: ...
+ def unicode(self, indent: int = ...) -> Text: ...
+
+class html(Namespace):
+ class Style:
+ def __init__(self, **kw: Union[str, Text]) -> None: ...
+ style: ClassVar[Style]
+
+def escape(ustring: Union[str, Text]) -> Text: ...
diff --git a/contrib/python/py/py3/py/__init__.pyi b/contrib/python/py/py3/py/__init__.pyi
new file mode 100644
index 0000000000..96859e310f
--- /dev/null
+++ b/contrib/python/py/py3/py/__init__.pyi
@@ -0,0 +1,20 @@
+from typing import Any
+
+# py allows to use e.g. py.path.local even without importing py.path.
+# So import implicitly.
+from . import error
+from . import iniconfig
+from . import path
+from . import io
+from . import xml
+
+__version__: str
+
+# Untyped modules below here.
+std: Any
+test: Any
+process: Any
+apipkg: Any
+code: Any
+builtin: Any
+log: Any
diff --git a/contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.pyi b/contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.pyi
new file mode 100644
index 0000000000..b6284bec3f
--- /dev/null
+++ b/contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.pyi
@@ -0,0 +1,31 @@
+from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union
+from typing_extensions import Final
+
+_D = TypeVar('_D')
+_T = TypeVar('_T')
+
+class ParseError(Exception):
+ # Private __init__.
+ path: Final[str]
+ lineno: Final[int]
+ msg: Final[str]
+
+class SectionWrapper:
+ # Private __init__.
+ config: Final[IniConfig]
+ name: Final[str]
+ def __getitem__(self, key: str) -> str: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def items(self) -> Iterator[Tuple[str, str]]: ...
+ def lineof(self, name: str) -> Optional[int]: ...
+
+class IniConfig:
+ path: Final[str]
+ sections: Final[Mapping[str, Mapping[str, str]]]
+ def __init__(self, path: str, data: Optional[str] = None): ...
+ def __contains__(self, arg: str) -> bool: ...
+ def __getitem__(self, name: str) -> SectionWrapper: ...
+ def __iter__(self) -> Iterator[SectionWrapper]: ...
+ def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ...
diff --git a/contrib/python/py/py3/py/error.pyi b/contrib/python/py/py3/py/error.pyi
new file mode 100644
index 0000000000..034eba609f
--- /dev/null
+++ b/contrib/python/py/py3/py/error.pyi
@@ -0,0 +1,129 @@
+from typing import Any, Callable, TypeVar
+
+_T = TypeVar('_T')
+
+def checked_call(func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
+class Error(EnvironmentError): ...
+class EPERM(Error): ...
+class ENOENT(Error): ...
+class ESRCH(Error): ...
+class EINTR(Error): ...
+class EIO(Error): ...
+class ENXIO(Error): ...
+class E2BIG(Error): ...
+class ENOEXEC(Error): ...
+class EBADF(Error): ...
+class ECHILD(Error): ...
+class EAGAIN(Error): ...
+class ENOMEM(Error): ...
+class EACCES(Error): ...
+class EFAULT(Error): ...
+class ENOTBLK(Error): ...
+class EBUSY(Error): ...
+class EEXIST(Error): ...
+class EXDEV(Error): ...
+class ENODEV(Error): ...
+class ENOTDIR(Error): ...
+class EISDIR(Error): ...
+class EINVAL(Error): ...
+class ENFILE(Error): ...
+class EMFILE(Error): ...
+class ENOTTY(Error): ...
+class ETXTBSY(Error): ...
+class EFBIG(Error): ...
+class ENOSPC(Error): ...
+class ESPIPE(Error): ...
+class EROFS(Error): ...
+class EMLINK(Error): ...
+class EPIPE(Error): ...
+class EDOM(Error): ...
+class ERANGE(Error): ...
+class EDEADLCK(Error): ...
+class ENAMETOOLONG(Error): ...
+class ENOLCK(Error): ...
+class ENOSYS(Error): ...
+class ENOTEMPTY(Error): ...
+class ELOOP(Error): ...
+class EWOULDBLOCK(Error): ...
+class ENOMSG(Error): ...
+class EIDRM(Error): ...
+class ECHRNG(Error): ...
+class EL2NSYNC(Error): ...
+class EL3HLT(Error): ...
+class EL3RST(Error): ...
+class ELNRNG(Error): ...
+class EUNATCH(Error): ...
+class ENOCSI(Error): ...
+class EL2HLT(Error): ...
+class EBADE(Error): ...
+class EBADR(Error): ...
+class EXFULL(Error): ...
+class ENOANO(Error): ...
+class EBADRQC(Error): ...
+class EBADSLT(Error): ...
+class EDEADLOCK(Error): ...
+class EBFONT(Error): ...
+class ENOSTR(Error): ...
+class ENODATA(Error): ...
+class ETIME(Error): ...
+class ENOSR(Error): ...
+class ENONET(Error): ...
+class ENOPKG(Error): ...
+class EREMOTE(Error): ...
+class ENOLINK(Error): ...
+class EADV(Error): ...
+class ESRMNT(Error): ...
+class ECOMM(Error): ...
+class EPROTO(Error): ...
+class EMULTIHOP(Error): ...
+class EDOTDOT(Error): ...
+class EBADMSG(Error): ...
+class EOVERFLOW(Error): ...
+class ENOTUNIQ(Error): ...
+class EBADFD(Error): ...
+class EREMCHG(Error): ...
+class ELIBACC(Error): ...
+class ELIBBAD(Error): ...
+class ELIBSCN(Error): ...
+class ELIBMAX(Error): ...
+class ELIBEXEC(Error): ...
+class EILSEQ(Error): ...
+class ERESTART(Error): ...
+class ESTRPIPE(Error): ...
+class EUSERS(Error): ...
+class ENOTSOCK(Error): ...
+class EDESTADDRREQ(Error): ...
+class EMSGSIZE(Error): ...
+class EPROTOTYPE(Error): ...
+class ENOPROTOOPT(Error): ...
+class EPROTONOSUPPORT(Error): ...
+class ESOCKTNOSUPPORT(Error): ...
+class ENOTSUP(Error): ...
+class EOPNOTSUPP(Error): ...
+class EPFNOSUPPORT(Error): ...
+class EAFNOSUPPORT(Error): ...
+class EADDRINUSE(Error): ...
+class EADDRNOTAVAIL(Error): ...
+class ENETDOWN(Error): ...
+class ENETUNREACH(Error): ...
+class ENETRESET(Error): ...
+class ECONNABORTED(Error): ...
+class ECONNRESET(Error): ...
+class ENOBUFS(Error): ...
+class EISCONN(Error): ...
+class ENOTCONN(Error): ...
+class ESHUTDOWN(Error): ...
+class ETOOMANYREFS(Error): ...
+class ETIMEDOUT(Error): ...
+class ECONNREFUSED(Error): ...
+class EHOSTDOWN(Error): ...
+class EHOSTUNREACH(Error): ...
+class EALREADY(Error): ...
+class EINPROGRESS(Error): ...
+class ESTALE(Error): ...
+class EUCLEAN(Error): ...
+class ENOTNAM(Error): ...
+class ENAVAIL(Error): ...
+class EISNAM(Error): ...
+class EREMOTEIO(Error): ...
+class EDQUOT(Error): ...
diff --git a/contrib/python/py/py3/py/iniconfig.pyi b/contrib/python/py/py3/py/iniconfig.pyi
new file mode 100644
index 0000000000..b6284bec3f
--- /dev/null
+++ b/contrib/python/py/py3/py/iniconfig.pyi
@@ -0,0 +1,31 @@
+from typing import Callable, Iterator, Mapping, Optional, Tuple, TypeVar, Union
+from typing_extensions import Final
+
+_D = TypeVar('_D')
+_T = TypeVar('_T')
+
+class ParseError(Exception):
+ # Private __init__.
+ path: Final[str]
+ lineno: Final[int]
+ msg: Final[str]
+
+class SectionWrapper:
+ # Private __init__.
+ config: Final[IniConfig]
+ name: Final[str]
+ def __getitem__(self, key: str) -> str: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def get(self, key: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def items(self) -> Iterator[Tuple[str, str]]: ...
+ def lineof(self, name: str) -> Optional[int]: ...
+
+class IniConfig:
+ path: Final[str]
+ sections: Final[Mapping[str, Mapping[str, str]]]
+ def __init__(self, path: str, data: Optional[str] = None): ...
+ def __contains__(self, arg: str) -> bool: ...
+ def __getitem__(self, name: str) -> SectionWrapper: ...
+ def __iter__(self) -> Iterator[SectionWrapper]: ...
+ def get(self, section: str, name: str, default: _D = ..., convert: Callable[[str], _T] = ...) -> Union[_T, _D]: ...
+ def lineof(self, section: str, name: Optional[str] = ...) -> Optional[int]: ...
diff --git a/contrib/python/py/py3/py/io.pyi b/contrib/python/py/py3/py/io.pyi
new file mode 100644
index 0000000000..d377e2405d
--- /dev/null
+++ b/contrib/python/py/py3/py/io.pyi
@@ -0,0 +1,130 @@
+from io import StringIO as TextIO
+from io import BytesIO as BytesIO
+from typing import Any, AnyStr, Callable, Generic, IO, List, Optional, Text, Tuple, TypeVar, Union, overload
+from typing_extensions import Final
+import sys
+
+_T = TypeVar("_T")
+
+class FDCapture(Generic[AnyStr]):
+ def __init__(self, targetfd: int, tmpfile: Optional[IO[AnyStr]] = ..., now: bool = ..., patchsys: bool = ...) -> None: ...
+ def start(self) -> None: ...
+ def done(self) -> IO[AnyStr]: ...
+ def writeorg(self, data: AnyStr) -> None: ...
+
+class StdCaptureFD:
+ def __init__(
+ self,
+ out: Union[bool, IO[str]] = ...,
+ err: Union[bool, IO[str]] = ...,
+ mixed: bool = ...,
+ in_: bool = ...,
+ patchsys: bool = ...,
+ now: bool = ...,
+ ) -> None: ...
+ @classmethod
+ def call(cls, func: Callable[..., _T], *args: Any, **kwargs: Any) -> Tuple[_T, str, str]: ...
+ def reset(self) -> Tuple[str, str]: ...
+ def suspend(self) -> Tuple[str, str]: ...
+ def startall(self) -> None: ...
+ def resume(self) -> None: ...
+ def done(self, save: bool = ...) -> Tuple[IO[str], IO[str]]: ...
+ def readouterr(self) -> Tuple[str, str]: ...
+
+class StdCapture:
+ def __init__(
+ self,
+ out: Union[bool, IO[str]] = ...,
+ err: Union[bool, IO[str]] = ...,
+ in_: bool = ...,
+ mixed: bool = ...,
+ now: bool = ...,
+ ) -> None: ...
+ @classmethod
+ def call(cls, func: Callable[..., _T], *args: Any, **kwargs: Any) -> Tuple[_T, str, str]: ...
+ def reset(self) -> Tuple[str, str]: ...
+ def suspend(self) -> Tuple[str, str]: ...
+ def startall(self) -> None: ...
+ def resume(self) -> None: ...
+ def done(self, save: bool = ...) -> Tuple[IO[str], IO[str]]: ...
+ def readouterr(self) -> Tuple[IO[str], IO[str]]: ...
+
+# XXX: The type here is not exactly right. If f is IO[bytes] and
+# encoding is not None, returns some weird hybrid, not exactly IO[bytes].
+def dupfile(
+ f: IO[AnyStr],
+ mode: Optional[str] = ...,
+ buffering: int = ...,
+ raising: bool = ...,
+ encoding: Optional[str] = ...,
+) -> IO[AnyStr]: ...
+def get_terminal_width() -> int: ...
+def ansi_print(
+ text: Union[str, Text],
+ esc: Union[Union[str, Text], Tuple[Union[str, Text], ...]],
+ file: Optional[IO[Any]] = ...,
+ newline: bool = ...,
+ flush: bool = ...,
+) -> None: ...
+def saferepr(obj, maxsize: int = ...) -> str: ...
+
+class TerminalWriter:
+ stringio: TextIO
+ encoding: Final[str]
+ hasmarkup: bool
+ def __init__(self, file: Optional[IO[str]] = ..., stringio: bool = ..., encoding: Optional[str] = ...) -> None: ...
+ @property
+ def fullwidth(self) -> int: ...
+ @fullwidth.setter
+ def fullwidth(self, value: int) -> None: ...
+ @property
+ def chars_on_current_line(self) -> int: ...
+ @property
+ def width_of_current_line(self) -> int: ...
+ def markup(
+ self,
+ text: str,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> str: ...
+ def sep(
+ self,
+ sepchar: str,
+ title: Optional[str] = ...,
+ fullwidth: Optional[int] = ...,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
+ def write(
+ self,
+ msg: str,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
+ def line(
+ self,
+ s: str = ...,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
+ def reline(
+ self,
+ line: str,
+ *,
+ black: int = ..., red: int = ..., green: int = ..., yellow: int = ..., blue: int = ..., purple: int = ...,
+ cyan: int = ..., white: int = ..., Black: int = ..., Red: int = ..., Green: int = ..., Yellow: int = ...,
+ Blue: int = ..., Purple: int = ..., Cyan: int = ..., White: int = ..., bold: int = ..., light: int = ...,
+ blink: int = ..., invert: int = ...,
+ ) -> None: ...
diff --git a/contrib/python/py/py3/py/path.pyi b/contrib/python/py/py3/py/path.pyi
new file mode 100644
index 0000000000..1ddab9601e
--- /dev/null
+++ b/contrib/python/py/py3/py/path.pyi
@@ -0,0 +1,197 @@
+from typing import Any, AnyStr, Callable, ContextManager, Generic, IO, Iterable, Iterator, List, Optional, Text, Type, Union
+from typing_extensions import Final, Literal
+import os
+import sys
+
+class _FNMatcher(Generic[AnyStr]):
+ pattern: AnyStr = ...
+ def __init__(self, pattern: AnyStr) -> None: ...
+ def __call__(self, path: local) -> bool: ...
+
+class _Stat:
+ path: Final[local] = ...
+ mode: Final[int]
+ ino: Final[int]
+ dev: Final[int]
+ nlink: Final[int]
+ uid: Final[int]
+ gid: Final[int]
+ size: Final[int]
+ atime: Final[float]
+ mtime: Final[float]
+ ctime: Final[float]
+ atime_ns: Final[int]
+ mtime_ns: Final[int]
+ ctime_ns: Final[int]
+ if sys.version_info >= (3, 8) and sys.platform == "win32":
+ reparse_tag: Final[int]
+ blocks: Final[int]
+ blksize: Final[int]
+ rdev: Final[int]
+ flags: Final[int]
+ gen: Final[int]
+ birthtime: Final[int]
+ rsize: Final[int]
+ creator: Final[int]
+ type: Final[int]
+ if sys.platform != 'win32':
+ @property
+ def owner(self) -> str: ...
+ @property
+ def group(self) -> str: ...
+ def isdir(self) -> bool: ...
+ def isfile(self) -> bool: ...
+ def islink(self) -> bool: ...
+
+
+if sys.version_info >= (3, 6):
+ _PathLike = os.PathLike
+else:
+ class _PathLike(Generic[AnyStr]):
+ def __fspath__(self) -> AnyStr: ...
+_PathType = Union[bytes, Text, _PathLike[str], _PathLike[bytes], local]
+
+class local(_PathLike[str]):
+ class ImportMismatchError(ImportError): ...
+
+ sep: Final[str]
+ strpath: Final[str]
+
+ def __init__(self, path: _PathType = ..., expanduser: bool = ...) -> None: ...
+ def __hash__(self) -> int: ...
+ def __eq__(self, other: object) -> bool: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __lt__(self, other: object) -> bool: ...
+ def __gt__(self, other: object) -> bool: ...
+ def __add__(self, other: object) -> local: ...
+ def __cmp__(self, other: object) -> int: ...
+ def __div__(self, other: _PathType) -> local: ...
+ def __truediv__(self, other: _PathType) -> local: ...
+ def __fspath__(self) -> str: ...
+
+ @classmethod
+ def get_temproot(cls) -> local: ...
+ @classmethod
+ def make_numbered_dir(
+ cls,
+ prefix: str = ...,
+ rootdir: Optional[local] = ...,
+ keep: Optional[int] = ...,
+ lock_timeout: int = ...,
+ ) -> local: ...
+ @classmethod
+ def mkdtemp(cls, rootdir: Optional[local] = ...) -> local: ...
+ @classmethod
+ def sysfind(
+ cls,
+ name: _PathType,
+ checker: Optional[Callable[[local], bool]] = ...,
+ paths: Optional[Iterable[_PathType]] = ...,
+ ) -> Optional[local]: ...
+
+ @property
+ def basename(self) -> str: ...
+ @property
+ def dirname(self) -> str: ...
+ @property
+ def purebasename(self) -> str: ...
+ @property
+ def ext(self) -> str: ...
+
+ def as_cwd(self) -> ContextManager[Optional[local]]: ...
+ def atime(self) -> float: ...
+ def bestrelpath(self, dest: local) -> str: ...
+ def chdir(self) -> local: ...
+ def check(
+ self,
+ *,
+ basename: int = ..., notbasename: int = ...,
+ basestarts: int = ..., notbasestarts: int = ...,
+ dir: int = ..., notdir: int = ...,
+ dotfile: int = ..., notdotfile: int = ...,
+ endswith: int = ..., notendswith: int = ...,
+ exists: int = ..., notexists: int = ...,
+ ext: int = ..., notext: int = ...,
+ file: int = ..., notfile: int = ...,
+ fnmatch: int = ..., notfnmatch: int = ...,
+ link: int = ..., notlink: int = ...,
+ relto: int = ..., notrelto: int = ...,
+ ) -> bool: ...
+ def chmod(self, mode: int, rec: Union[int, str, Text, Callable[[local], bool]] = ...) -> None: ...
+ if sys.platform != 'win32':
+ def chown(self, user: Union[int, str], group: Union[int, str], rec: int = ...) -> None: ...
+ def common(self, other: local) -> Optional[local]: ...
+ def computehash(self, hashtype: str = ..., chunksize: int = ...) -> str: ...
+ def copy(self, target: local, mode: bool = ..., stat: bool = ...) -> None: ...
+ def dirpath(self, *args: _PathType, abs: int = ...) -> local: ...
+ def dump(self, obj: Any, bin: Optional[int] = ...) -> None: ...
+ def ensure(self, *args: _PathType, dir: int = ...) -> local: ...
+ def ensure_dir(self, *args: _PathType) -> local: ...
+ def exists(self) -> bool: ...
+ def fnmatch(self, pattern: str): _FNMatcher
+ def isdir(self) -> bool: ...
+ def isfile(self) -> bool: ...
+ def islink(self) -> bool: ...
+ def join(self, *args: _PathType, abs: int = ...) -> local: ...
+ def listdir(
+ self,
+ fil: Optional[Union[str, Text, Callable[[local], bool]]] = ...,
+ sort: Optional[bool] = ...,
+ ) -> List[local]: ...
+ def load(self) -> Any: ...
+ def lstat(self) -> _Stat: ...
+ def mkdir(self, *args: _PathType) -> local: ...
+ if sys.platform != 'win32':
+ def mklinkto(self, oldname: Union[str, local]) -> None: ...
+ def mksymlinkto(self, value: local, absolute: int = ...) -> None: ...
+ def move(self, target: local) -> None: ...
+ def mtime(self) -> float: ...
+ def new(
+ self,
+ *,
+ drive: str = ...,
+ dirname: str = ...,
+ basename: str = ...,
+ purebasename: str = ...,
+ ext: str = ...,
+ ) -> local: ...
+ def open(self, mode: str = ..., ensure: bool = ..., encoding: Optional[str] = ...) -> IO[Any]: ...
+ def parts(self, reverse: bool = ...) -> List[local]: ...
+ def pyimport(
+ self,
+ modname: Optional[str] = ...,
+ ensuresyspath: Union[bool, Literal["append", "importlib"]] = ...,
+ ) -> Any: ...
+ def pypkgpath(self) -> Optional[local]: ...
+ def read(self, mode: str = ...) -> Union[Text, bytes]: ...
+ def read_binary(self) -> bytes: ...
+ def read_text(self, encoding: str) -> Text: ...
+ def readlines(self, cr: int = ...) -> List[str]: ...
+ if sys.platform != 'win32':
+ def readlink(self) -> str: ...
+ def realpath(self) -> local: ...
+ def relto(self, relpath: Union[str, local]) -> str: ...
+ def remove(self, rec: int = ..., ignore_errors: bool = ...) -> None: ...
+ def rename(self, target: _PathType) -> None: ...
+ def samefile(self, other: _PathType) -> bool: ...
+ def setmtime(self, mtime: Optional[float] = ...) -> None: ...
+ def size(self) -> int: ...
+ def stat(self, raising: bool = ...) -> _Stat: ...
+ def sysexec(self, *argv: Any, **popen_opts: Any) -> Text: ...
+ def visit(
+ self,
+ fil: Optional[Union[str, Text, Callable[[local], bool]]] = ...,
+ rec: Optional[Union[Literal[1, True], str, Text, Callable[[local], bool]]] = ...,
+ ignore: Type[Exception] = ...,
+ bf: bool = ...,
+ sort: bool = ...,
+ ) -> Iterator[local]: ...
+ def write(self, data: Any, mode: str = ..., ensure: bool = ...) -> None: ...
+ def write_binary(self, data: bytes, ensure: bool = ...) -> None: ...
+ def write_text(self, data: Union[str, Text], encoding: str, ensure: bool = ...) -> None: ...
+
+
+# Untyped types below here.
+svnwc: Any
+svnurl: Any
+SvnAuth: Any
diff --git a/contrib/python/py/py3/py/xml.pyi b/contrib/python/py/py3/py/xml.pyi
new file mode 100644
index 0000000000..9c44480a5f
--- /dev/null
+++ b/contrib/python/py/py3/py/xml.pyi
@@ -0,0 +1,25 @@
+from typing import ClassVar, Generic, Iterable, Text, Type, Union
+from typing_extensions import Final
+
+class raw:
+ uniobj: Final[Text]
+ def __init__(self, uniobj: Text) -> None: ...
+
+class _NamespaceMetaclass(type):
+ def __getattr__(self, name: str) -> Type[Tag]: ...
+
+class Namespace(metaclass=_NamespaceMetaclass): ...
+
+class Tag(list):
+ class Attr:
+ def __getattr__(self, attr: str) -> Text: ...
+ attr: Final[Attr]
+ def __init__(self, *args: Union[Text, raw, Tag, Iterable[Tag]], **kwargs: Union[Text, raw]) -> None: ...
+ def unicode(self, indent: int = ...) -> Text: ...
+
+class html(Namespace):
+ class Style:
+ def __init__(self, **kw: Union[str, Text]) -> None: ...
+ style: ClassVar[Style]
+
+def escape(ustring: Union[str, Text]) -> Text: ...
diff --git a/contrib/python/pyrsistent/py2/pyrsistent/__init__.pyi b/contrib/python/pyrsistent/py2/pyrsistent/__init__.pyi
new file mode 100644
index 0000000000..5909f7991a
--- /dev/null
+++ b/contrib/python/pyrsistent/py2/pyrsistent/__init__.pyi
@@ -0,0 +1,213 @@
+# flake8: noqa: E704
+# from https://gist.github.com/WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09
+# Stubs for pyrsistent (Python 3.6)
+
+from typing import Any
+from typing import AnyStr
+from typing import Callable
+from typing import Iterable
+from typing import Iterator
+from typing import List
+from typing import Optional
+from typing import Mapping
+from typing import MutableMapping
+from typing import Sequence
+from typing import Set
+from typing import Union
+from typing import Tuple
+from typing import Type
+from typing import TypeVar
+from typing import overload
+
+# see commit 08519aa for explanation of the re-export
+from pyrsistent.typing import CheckedKeyTypeError as CheckedKeyTypeError
+from pyrsistent.typing import CheckedPMap as CheckedPMap
+from pyrsistent.typing import CheckedPSet as CheckedPSet
+from pyrsistent.typing import CheckedPVector as CheckedPVector
+from pyrsistent.typing import CheckedType as CheckedType
+from pyrsistent.typing import CheckedValueTypeError as CheckedValueTypeError
+from pyrsistent.typing import InvariantException as InvariantException
+from pyrsistent.typing import PClass as PClass
+from pyrsistent.typing import PBag as PBag
+from pyrsistent.typing import PDeque as PDeque
+from pyrsistent.typing import PList as PList
+from pyrsistent.typing import PMap as PMap
+from pyrsistent.typing import PMapEvolver as PMapEvolver
+from pyrsistent.typing import PSet as PSet
+from pyrsistent.typing import PSetEvolver as PSetEvolver
+from pyrsistent.typing import PTypeError as PTypeError
+from pyrsistent.typing import PVector as PVector
+from pyrsistent.typing import PVectorEvolver as PVectorEvolver
+
+T = TypeVar('T')
+KT = TypeVar('KT')
+VT = TypeVar('VT')
+
+def pmap(initial: Union[Mapping[KT, VT], Iterable[Tuple[KT, VT]]] = {}, pre_size: int = 0) -> PMap[KT, VT]: ...
+def m(**kwargs: VT) -> PMap[str, VT]: ...
+
+def pvector(iterable: Iterable[T] = ...) -> PVector[T]: ...
+def v(*iterable: T) -> PVector[T]: ...
+
+def pset(iterable: Iterable[T] = (), pre_size: int = 8) -> PSet[T]: ...
+def s(*iterable: T) -> PSet[T]: ...
+
+# see class_test.py for use cases
+Invariant = Tuple[bool, Optional[Union[str, Callable[[], str]]]]
+
+@overload
+def field(
+ type: Union[Type[T], Sequence[Type[T]]] = ...,
+ invariant: Callable[[Any], Union[Invariant, Iterable[Invariant]]] = lambda _: (True, None),
+ initial: Any = object(),
+ mandatory: bool = False,
+ factory: Callable[[Any], T] = lambda x: x,
+ serializer: Callable[[Any, T], Any] = lambda _, value: value,
+) -> T: ...
+# The actual return value (_PField) is irrelevant after a PRecord has been instantiated,
+# see https://github.com/tobgu/pyrsistent/blob/master/pyrsistent/_precord.py#L10
+@overload
+def field(
+ type: Any = ...,
+ invariant: Callable[[Any], Union[Invariant, Iterable[Invariant]]] = lambda _: (True, None),
+ initial: Any = object(),
+ mandatory: bool = False,
+ factory: Callable[[Any], Any] = lambda x: x,
+ serializer: Callable[[Any, Any], Any] = lambda _, value: value,
+) -> Any: ...
+
+# Use precise types for the simplest use cases, but fall back to Any for
+# everything else. See record_test.py for the wide range of possible types for
+# item_type
+@overload
+def pset_field(
+ item_type: Type[T],
+ optional: bool = False,
+ initial: Iterable[T] = ...,
+) -> PSet[T]: ...
+@overload
+def pset_field(
+ item_type: Any,
+ optional: bool = False,
+ initial: Any = (),
+) -> PSet[Any]: ...
+
+@overload
+def pmap_field(
+ key_type: Type[KT],
+ value_type: Type[VT],
+ optional: bool = False,
+ invariant: Callable[[Any], Tuple[bool, Optional[str]]] = lambda _: (True, None),
+) -> PMap[KT, VT]: ...
+@overload
+def pmap_field(
+ key_type: Any,
+ value_type: Any,
+ optional: bool = False,
+ invariant: Callable[[Any], Tuple[bool, Optional[str]]] = lambda _: (True, None),
+) -> PMap[Any, Any]: ...
+
+@overload
+def pvector_field(
+ item_type: Type[T],
+ optional: bool = False,
+ initial: Iterable[T] = ...,
+) -> PVector[T]: ...
+@overload
+def pvector_field(
+ item_type: Any,
+ optional: bool = False,
+ initial: Any = (),
+) -> PVector[Any]: ...
+
+def pbag(elements: Iterable[T]) -> PBag[T]: ...
+def b(*elements: T) -> PBag[T]: ...
+
+def plist(iterable: Iterable[T] = (), reverse: bool = False) -> PList[T]: ...
+def l(*elements: T) -> PList[T]: ...
+
+def pdeque(iterable: Optional[Iterable[T]] = None, maxlen: Optional[int] = None) -> PDeque[T]: ...
+def dq(*iterable: T) -> PDeque[T]: ...
+
+@overload
+def optional(type: T) -> Tuple[T, Type[None]]: ...
+@overload
+def optional(*typs: Any) -> Tuple[Any, ...]: ...
+
+T_PRecord = TypeVar('T_PRecord', bound='PRecord')
+class PRecord(PMap[AnyStr, Any]):
+ _precord_fields: Mapping
+ _precord_initial_values: Mapping
+
+ def __hash__(self) -> int: ...
+ def __init__(self, **kwargs: Any) -> None: ...
+ def __iter__(self) -> Iterator[Any]: ...
+ def __len__(self) -> int: ...
+ @classmethod
+ def create(
+ cls: Type[T_PRecord],
+ kwargs: Mapping,
+ _factory_fields: Optional[Iterable] = None,
+ ignore_extra: bool = False,
+ ) -> T_PRecord: ...
+ # This is OK because T_PRecord is a concrete type
+ def discard(self: T_PRecord, key: KT) -> T_PRecord: ...
+ def remove(self: T_PRecord, key: KT) -> T_PRecord: ...
+
+ def serialize(self, format: Optional[Any] = ...) -> MutableMapping: ...
+
+ # From pyrsistent documentation:
+ # This set function differs slightly from that in the PMap
+ # class. First of all it accepts key-value pairs. Second it accepts multiple key-value
+ # pairs to perform one, atomic, update of multiple fields.
+ @overload
+ def set(self, key: KT, val: VT) -> Any: ...
+ @overload
+ def set(self, **kwargs: VT) -> Any: ...
+
+def immutable(
+ members: Union[str, Iterable[str]] = '',
+ name: str = 'Immutable',
+ verbose: bool = False,
+) -> Tuple: ... # actually a namedtuple
+
+# ignore mypy warning "Overloaded function signatures 1 and 5 overlap with
+# incompatible return types"
+@overload
+def freeze(o: Mapping[KT, VT]) -> PMap[KT, VT]: ... # type: ignore
+@overload
+def freeze(o: List[T]) -> PVector[T]: ... # type: ignore
+@overload
+def freeze(o: Tuple[T, ...]) -> Tuple[T, ...]: ...
+@overload
+def freeze(o: Set[T]) -> PSet[T]: ... # type: ignore
+@overload
+def freeze(o: T) -> T: ...
+
+
+@overload
+def thaw(o: PMap[KT, VT]) -> MutableMapping[KT, VT]: ... # type: ignore
+@overload
+def thaw(o: PVector[T]) -> List[T]: ... # type: ignore
+@overload
+def thaw(o: Tuple[T, ...]) -> Tuple[T, ...]: ...
+# collections.abc.MutableSet is kind of garbage:
+# https://stackoverflow.com/questions/24977898/why-does-collections-mutableset-not-bestow-an-update-method
+@overload
+def thaw(o: PSet[T]) -> Set[T]: ... # type: ignore
+@overload
+def thaw(o: T) -> T: ...
+
+def mutant(fn: Callable) -> Callable: ...
+
+def inc(x: int) -> int: ...
+@overload
+def discard(evolver: PMapEvolver[KT, VT], key: KT) -> None: ...
+@overload
+def discard(evolver: PVectorEvolver[T], key: int) -> None: ...
+@overload
+def discard(evolver: PSetEvolver[T], key: T) -> None: ...
+def rex(expr: str) -> Callable[[Any], bool]: ...
+def ny(_: Any) -> bool: ...
+
+def get_in(keys: Iterable, coll: Mapping, default: Optional[Any] = None, no_default: bool = False) -> Any: ...
diff --git a/contrib/python/pyrsistent/py2/pyrsistent/typing.pyi b/contrib/python/pyrsistent/py2/pyrsistent/typing.pyi
new file mode 100644
index 0000000000..0221c48cc9
--- /dev/null
+++ b/contrib/python/pyrsistent/py2/pyrsistent/typing.pyi
@@ -0,0 +1,292 @@
+# flake8: noqa: E704
+# from https://gist.github.com/WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09
+# Stubs for pyrsistent (Python 3.6)
+#
+from typing import Any
+from typing import Callable
+from typing import Dict
+from typing import Generic
+from typing import Hashable
+from typing import Iterator
+from typing import Iterable
+from typing import List
+from typing import Mapping
+from typing import Optional
+from typing import Sequence
+from typing import AbstractSet
+from typing import Sized
+from typing import Set
+from typing import Tuple
+from typing import TypeVar
+from typing import Type
+from typing import Union
+from typing import overload
+
+T = TypeVar('T')
+KT = TypeVar('KT')
+VT = TypeVar('VT')
+
+
+class PMap(Mapping[KT, VT], Hashable):
+ def __add__(self, other: PMap[KT, VT]) -> PMap[KT, VT]: ...
+ def __getitem__(self, key: KT) -> VT: ...
+ def __getattr__(self, key: str) -> VT: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[KT]: ...
+ def __len__(self) -> int: ...
+ def copy(self) -> PMap[KT, VT]: ...
+ def discard(self, key: KT) -> PMap[KT, VT]: ...
+ def evolver(self) -> PMapEvolver[KT, VT]: ...
+ def iteritems(self) -> Iterable[Tuple[KT, VT]]: ...
+ def iterkeys(self) -> Iterable[KT]: ...
+ def itervalues(self) -> Iterable[VT]: ...
+ def remove(self, key: KT) -> PMap[KT, VT]: ...
+ def set(self, key: KT, val: VT) -> PMap[KT, VT]: ...
+ def transform(self, *transformations: Any) -> PMap[KT, VT]: ...
+ def update(self, *args: Mapping): ...
+ def update_with(self, update_fn: Callable[[VT, VT], VT], *args: Mapping) -> Any: ...
+
+
+class PMapEvolver(Generic[KT, VT]):
+ def __delitem__(self, key: KT) -> None: ...
+ def __getitem__(self, key: KT) -> VT: ...
+ def __len__(self) -> int: ...
+ def __setitem__(self, key: KT, val: VT) -> None: ...
+ def is_dirty(self) -> bool: ...
+ def persistent(self) -> PMap[KT, VT]: ...
+ def remove(self, key: KT) -> PMapEvolver[KT, VT]: ...
+ def set(self, key: KT, val: VT) -> PMapEvolver[KT, VT]: ...
+
+
+class PVector(Sequence[T], Hashable):
+ def __add__(self, other: PVector[T]) -> PVector[T]: ...
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ @overload
+ def __getitem__(self, index: slice) -> PVector[T]: ...
+ def __hash__(self) -> int: ...
+ def __len__(self) -> int: ...
+ def __mul__(self, other: PVector[T]) -> PVector[T]: ...
+ def append(self, val: T) -> PVector[T]: ...
+ def delete(self, index: int, stop: Optional[int]) -> PVector[T]: ...
+ def evolver(self) -> PVectorEvolver[T]: ...
+ def extend(self, obj: Iterable[T]) -> PVector[T]: ...
+ def tolist(self) -> List[T]: ...
+ def mset(self, *args: Iterable[Union[T, int]]) -> PVector[T]: ...
+ def remove(self, value: T) -> PVector[T]: ...
+ # Not compatible with MutableSequence
+ def set(self, i: int, val: T) -> PVector[T]: ...
+ def transform(self, *transformations: Any) -> PVector[T]: ...
+
+
+class PVectorEvolver(Sequence[T], Sized):
+ def __delitem__(self, i: Union[int, slice]) -> None: ...
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ # Not actually supported
+ @overload
+ def __getitem__(self, index: slice) -> PVectorEvolver[T]: ...
+ def __len__(self) -> int: ...
+ def __setitem__(self, index: int, val: T) -> None: ...
+ def append(self, val: T) -> PVectorEvolver[T]: ...
+ def delete(self, value: T) -> PVectorEvolver[T]: ...
+ def extend(self, obj: Iterable[T]) -> PVectorEvolver[T]: ...
+ def is_dirty(self) -> bool: ...
+ def persistent(self) -> PVector[T]: ...
+ def set(self, i: int, val: T) -> PVectorEvolver[T]: ...
+
+
+class PSet(AbstractSet[T], Hashable):
+ def __contains__(self, element: object) -> bool: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[T]: ...
+ def __len__(self) -> int: ...
+ def add(self, element: T) -> PSet[T]: ...
+ def copy(self) -> PSet[T]: ...
+ def difference(self, iterable: Iterable) -> PSet[T]: ...
+ def discard(self, element: T) -> PSet[T]: ...
+ def evolver(self) -> PSetEvolver[T]: ...
+ def intersection(self, iterable: Iterable) -> PSet[T]: ...
+ def issubset(self, iterable: Iterable) -> bool: ...
+ def issuperset(self, iterable: Iterable) -> bool: ...
+ def remove(self, element: T) -> PSet[T]: ...
+ def symmetric_difference(self, iterable: Iterable[T]) -> PSet[T]: ...
+ def union(self, iterable: Iterable[T]) -> PSet[T]: ...
+ def update(self, iterable: Iterable[T]) -> PSet[T]: ...
+
+
+class PSetEvolver(Generic[T], Sized):
+ def __len__(self) -> int: ...
+ def add(self, element: T) -> PSetEvolver[T]: ...
+ def is_dirty(self) -> bool: ...
+ def persistent(self) -> PSet[T]: ...
+ def remove(self, element: T) -> PSetEvolver[T]: ...
+
+
+class PBag(Generic[T], Sized, Hashable):
+ def __add__(self, other: PBag[T]) -> PBag[T]: ...
+ def __and__(self, other: PBag[T]) -> PBag[T]: ...
+ def __contains__(self, elem: object) -> bool: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[T]: ...
+ def __len__(self) -> int: ...
+ def __or__(self, other: PBag[T]) -> PBag[T]: ...
+ def __sub__(self, other: PBag[T]) -> PBag[T]: ...
+ def add(self, elem: T) -> PBag[T]: ...
+ def count(self, elem: T) -> int: ...
+ def remove(self, elem: T) -> PBag[T]: ...
+ def update(self, iterable: Iterable[T]) -> PBag[T]: ...
+
+
+class PDeque(Sequence[T], Hashable):
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ @overload
+ def __getitem__(self, index: slice) -> PDeque[T]: ...
+ def __hash__(self) -> int: ...
+ def __len__(self) -> int: ...
+ def __lt__(self, other: PDeque[T]) -> bool: ...
+ def append(self, elem: T) -> PDeque[T]: ...
+ def appendleft(self, elem: T) -> PDeque[T]: ...
+ def extend(self, iterable: Iterable[T]) -> PDeque[T]: ...
+ def extendleft(self, iterable: Iterable[T]) -> PDeque[T]: ...
+ @property
+ def left(self) -> T: ...
+ # The real return type is Integral according to what pyrsistent
+ # checks at runtime but mypy doesn't deal in numeric.*:
+ # https://github.com/python/mypy/issues/2636
+ @property
+ def maxlen(self) -> int: ...
+ def pop(self, count: int = 1) -> PDeque[T]: ...
+ def popleft(self, count: int = 1) -> PDeque[T]: ...
+ def remove(self, elem: T) -> PDeque[T]: ...
+ def reverse(self) -> PDeque[T]: ...
+ @property
+ def right(self) -> T: ...
+ def rotate(self, steps: int) -> PDeque[T]: ...
+
+
+class PList(Sequence[T], Hashable):
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ @overload
+ def __getitem__(self, index: slice) -> PList[T]: ...
+ def __hash__(self) -> int: ...
+ def __len__(self) -> int: ...
+ def __lt__(self, other: PList[T]) -> bool: ...
+ def __gt__(self, other: PList[T]) -> bool: ...
+ def cons(self, elem: T) -> PList[T]: ...
+ @property
+ def first(self) -> T: ...
+ def mcons(self, iterable: Iterable[T]) -> PList[T]: ...
+ def remove(self, elem: T) -> PList[T]: ...
+ @property
+ def rest(self) -> PList[T]: ...
+ def reverse(self) -> PList[T]: ...
+ def split(self, index: int) -> Tuple[PList[T], PList[T]]: ...
+
+T_PClass = TypeVar('T_PClass', bound='PClass')
+
+class PClass(Hashable):
+ def __new__(cls, **kwargs: Any): ...
+ def set(self: T_PClass, *args: Any, **kwargs: Any) -> T_PClass: ...
+ @classmethod
+ def create(
+ cls: Type[T_PClass],
+ kwargs: Any,
+ _factory_fields: Optional[Any] = ...,
+ ignore_extra: bool = ...,
+ ) -> T_PClass: ...
+ def serialize(self, format: Optional[Any] = ...): ...
+ def transform(self, *transformations: Any): ...
+ def __eq__(self, other: object): ...
+ def __ne__(self, other: object): ...
+ def __hash__(self): ...
+ def __reduce__(self): ...
+ def evolver(self) -> PClassEvolver: ...
+ def remove(self: T_PClass, name: Any) -> T_PClass: ...
+
+class PClassEvolver:
+ def __init__(self, original: Any, initial_dict: Any) -> None: ...
+ def __getitem__(self, item: Any): ...
+ def set(self, key: Any, value: Any): ...
+ def __setitem__(self, key: Any, value: Any) -> None: ...
+ def remove(self, item: Any): ...
+ def __delitem__(self, item: Any) -> None: ...
+ def persistent(self) -> PClass: ...
+ def __getattr__(self, item: Any): ...
+
+
+
+class CheckedPMap(PMap[KT, VT]):
+ __key_type__: Type[KT]
+ __value_type__: Type[VT]
+ def __new__(cls, source: Mapping[KT, VT] = ..., size: int = ...) -> CheckedPMap: ...
+ @classmethod
+ def create(cls, source_data: Mapping[KT, VT], _factory_fields: Any = ...) -> CheckedPMap[KT, VT]: ...
+ def serialize(self, format: Optional[Any] = ...) -> Dict[KT, VT]: ...
+
+
+class CheckedPVector(PVector[T]):
+ __type__: Type[T]
+ def __new__(self, initial: Iterable[T] = ...) -> CheckedPVector: ...
+ @classmethod
+ def create(cls, source_data: Iterable[T], _factory_fields: Any = ...) -> CheckedPVector[T]: ...
+ def serialize(self, format: Optional[Any] = ...) -> List[T]: ...
+
+
+class CheckedPSet(PSet[T]):
+ __type__: Type[T]
+ def __new__(cls, initial: Iterable[T] = ...) -> CheckedPSet: ...
+ @classmethod
+ def create(cls, source_data: Iterable[T], _factory_fields: Any = ...) -> CheckedPSet[T]: ...
+ def serialize(self, format: Optional[Any] = ...) -> Set[T]: ...
+
+
+class InvariantException(Exception):
+ invariant_errors: Tuple[Any, ...] = ... # possibly nested tuple
+ missing_fields: Tuple[str, ...] = ...
+ def __init__(
+ self,
+ error_codes: Any = ...,
+ missing_fields: Any = ...,
+ *args: Any,
+ **kwargs: Any
+ ) -> None: ...
+
+
+class CheckedTypeError(TypeError):
+ source_class: Type[Any]
+ expected_types: Tuple[Any, ...]
+ actual_type: Type[Any]
+ actual_value: Any
+ def __init__(
+ self,
+ source_class: Any,
+ expected_types: Any,
+ actual_type: Any,
+ actual_value: Any,
+ *args: Any,
+ **kwargs: Any
+ ) -> None: ...
+
+
+class CheckedKeyTypeError(CheckedTypeError): ...
+class CheckedValueTypeError(CheckedTypeError): ...
+class CheckedType: ...
+
+
+class PTypeError(TypeError):
+ source_class: Type[Any] = ...
+ field: str = ...
+ expected_types: Tuple[Any, ...] = ...
+ actual_type: Type[Any] = ...
+ def __init__(
+ self,
+ source_class: Any,
+ field: Any,
+ expected_types: Any,
+ actual_type: Any,
+ *args: Any,
+ **kwargs: Any
+ ) -> None: ...
diff --git a/contrib/python/pyrsistent/py3/pyrsistent/__init__.pyi b/contrib/python/pyrsistent/py3/pyrsistent/__init__.pyi
new file mode 100644
index 0000000000..5909f7991a
--- /dev/null
+++ b/contrib/python/pyrsistent/py3/pyrsistent/__init__.pyi
@@ -0,0 +1,213 @@
+# flake8: noqa: E704
+# from https://gist.github.com/WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09
+# Stubs for pyrsistent (Python 3.6)
+
+from typing import Any
+from typing import AnyStr
+from typing import Callable
+from typing import Iterable
+from typing import Iterator
+from typing import List
+from typing import Optional
+from typing import Mapping
+from typing import MutableMapping
+from typing import Sequence
+from typing import Set
+from typing import Union
+from typing import Tuple
+from typing import Type
+from typing import TypeVar
+from typing import overload
+
+# see commit 08519aa for explanation of the re-export
+from pyrsistent.typing import CheckedKeyTypeError as CheckedKeyTypeError
+from pyrsistent.typing import CheckedPMap as CheckedPMap
+from pyrsistent.typing import CheckedPSet as CheckedPSet
+from pyrsistent.typing import CheckedPVector as CheckedPVector
+from pyrsistent.typing import CheckedType as CheckedType
+from pyrsistent.typing import CheckedValueTypeError as CheckedValueTypeError
+from pyrsistent.typing import InvariantException as InvariantException
+from pyrsistent.typing import PClass as PClass
+from pyrsistent.typing import PBag as PBag
+from pyrsistent.typing import PDeque as PDeque
+from pyrsistent.typing import PList as PList
+from pyrsistent.typing import PMap as PMap
+from pyrsistent.typing import PMapEvolver as PMapEvolver
+from pyrsistent.typing import PSet as PSet
+from pyrsistent.typing import PSetEvolver as PSetEvolver
+from pyrsistent.typing import PTypeError as PTypeError
+from pyrsistent.typing import PVector as PVector
+from pyrsistent.typing import PVectorEvolver as PVectorEvolver
+
+T = TypeVar('T')
+KT = TypeVar('KT')
+VT = TypeVar('VT')
+
+def pmap(initial: Union[Mapping[KT, VT], Iterable[Tuple[KT, VT]]] = {}, pre_size: int = 0) -> PMap[KT, VT]: ...
+def m(**kwargs: VT) -> PMap[str, VT]: ...
+
+def pvector(iterable: Iterable[T] = ...) -> PVector[T]: ...
+def v(*iterable: T) -> PVector[T]: ...
+
+def pset(iterable: Iterable[T] = (), pre_size: int = 8) -> PSet[T]: ...
+def s(*iterable: T) -> PSet[T]: ...
+
+# see class_test.py for use cases
+Invariant = Tuple[bool, Optional[Union[str, Callable[[], str]]]]
+
+@overload
+def field(
+ type: Union[Type[T], Sequence[Type[T]]] = ...,
+ invariant: Callable[[Any], Union[Invariant, Iterable[Invariant]]] = lambda _: (True, None),
+ initial: Any = object(),
+ mandatory: bool = False,
+ factory: Callable[[Any], T] = lambda x: x,
+ serializer: Callable[[Any, T], Any] = lambda _, value: value,
+) -> T: ...
+# The actual return value (_PField) is irrelevant after a PRecord has been instantiated,
+# see https://github.com/tobgu/pyrsistent/blob/master/pyrsistent/_precord.py#L10
+@overload
+def field(
+ type: Any = ...,
+ invariant: Callable[[Any], Union[Invariant, Iterable[Invariant]]] = lambda _: (True, None),
+ initial: Any = object(),
+ mandatory: bool = False,
+ factory: Callable[[Any], Any] = lambda x: x,
+ serializer: Callable[[Any, Any], Any] = lambda _, value: value,
+) -> Any: ...
+
+# Use precise types for the simplest use cases, but fall back to Any for
+# everything else. See record_test.py for the wide range of possible types for
+# item_type
+@overload
+def pset_field(
+ item_type: Type[T],
+ optional: bool = False,
+ initial: Iterable[T] = ...,
+) -> PSet[T]: ...
+@overload
+def pset_field(
+ item_type: Any,
+ optional: bool = False,
+ initial: Any = (),
+) -> PSet[Any]: ...
+
+@overload
+def pmap_field(
+ key_type: Type[KT],
+ value_type: Type[VT],
+ optional: bool = False,
+ invariant: Callable[[Any], Tuple[bool, Optional[str]]] = lambda _: (True, None),
+) -> PMap[KT, VT]: ...
+@overload
+def pmap_field(
+ key_type: Any,
+ value_type: Any,
+ optional: bool = False,
+ invariant: Callable[[Any], Tuple[bool, Optional[str]]] = lambda _: (True, None),
+) -> PMap[Any, Any]: ...
+
+@overload
+def pvector_field(
+ item_type: Type[T],
+ optional: bool = False,
+ initial: Iterable[T] = ...,
+) -> PVector[T]: ...
+@overload
+def pvector_field(
+ item_type: Any,
+ optional: bool = False,
+ initial: Any = (),
+) -> PVector[Any]: ...
+
+def pbag(elements: Iterable[T]) -> PBag[T]: ...
+def b(*elements: T) -> PBag[T]: ...
+
+def plist(iterable: Iterable[T] = (), reverse: bool = False) -> PList[T]: ...
+def l(*elements: T) -> PList[T]: ...
+
+def pdeque(iterable: Optional[Iterable[T]] = None, maxlen: Optional[int] = None) -> PDeque[T]: ...
+def dq(*iterable: T) -> PDeque[T]: ...
+
+@overload
+def optional(type: T) -> Tuple[T, Type[None]]: ...
+@overload
+def optional(*typs: Any) -> Tuple[Any, ...]: ...
+
+T_PRecord = TypeVar('T_PRecord', bound='PRecord')
+class PRecord(PMap[AnyStr, Any]):
+ _precord_fields: Mapping
+ _precord_initial_values: Mapping
+
+ def __hash__(self) -> int: ...
+ def __init__(self, **kwargs: Any) -> None: ...
+ def __iter__(self) -> Iterator[Any]: ...
+ def __len__(self) -> int: ...
+ @classmethod
+ def create(
+ cls: Type[T_PRecord],
+ kwargs: Mapping,
+ _factory_fields: Optional[Iterable] = None,
+ ignore_extra: bool = False,
+ ) -> T_PRecord: ...
+ # This is OK because T_PRecord is a concrete type
+ def discard(self: T_PRecord, key: KT) -> T_PRecord: ...
+ def remove(self: T_PRecord, key: KT) -> T_PRecord: ...
+
+ def serialize(self, format: Optional[Any] = ...) -> MutableMapping: ...
+
+ # From pyrsistent documentation:
+ # This set function differs slightly from that in the PMap
+ # class. First of all it accepts key-value pairs. Second it accepts multiple key-value
+ # pairs to perform one, atomic, update of multiple fields.
+ @overload
+ def set(self, key: KT, val: VT) -> Any: ...
+ @overload
+ def set(self, **kwargs: VT) -> Any: ...
+
+def immutable(
+ members: Union[str, Iterable[str]] = '',
+ name: str = 'Immutable',
+ verbose: bool = False,
+) -> Tuple: ... # actually a namedtuple
+
+# ignore mypy warning "Overloaded function signatures 1 and 5 overlap with
+# incompatible return types"
+@overload
+def freeze(o: Mapping[KT, VT]) -> PMap[KT, VT]: ... # type: ignore
+@overload
+def freeze(o: List[T]) -> PVector[T]: ... # type: ignore
+@overload
+def freeze(o: Tuple[T, ...]) -> Tuple[T, ...]: ...
+@overload
+def freeze(o: Set[T]) -> PSet[T]: ... # type: ignore
+@overload
+def freeze(o: T) -> T: ...
+
+
+@overload
+def thaw(o: PMap[KT, VT]) -> MutableMapping[KT, VT]: ... # type: ignore
+@overload
+def thaw(o: PVector[T]) -> List[T]: ... # type: ignore
+@overload
+def thaw(o: Tuple[T, ...]) -> Tuple[T, ...]: ...
+# collections.abc.MutableSet is kind of garbage:
+# https://stackoverflow.com/questions/24977898/why-does-collections-mutableset-not-bestow-an-update-method
+@overload
+def thaw(o: PSet[T]) -> Set[T]: ... # type: ignore
+@overload
+def thaw(o: T) -> T: ...
+
+def mutant(fn: Callable) -> Callable: ...
+
+def inc(x: int) -> int: ...
+@overload
+def discard(evolver: PMapEvolver[KT, VT], key: KT) -> None: ...
+@overload
+def discard(evolver: PVectorEvolver[T], key: int) -> None: ...
+@overload
+def discard(evolver: PSetEvolver[T], key: T) -> None: ...
+def rex(expr: str) -> Callable[[Any], bool]: ...
+def ny(_: Any) -> bool: ...
+
+def get_in(keys: Iterable, coll: Mapping, default: Optional[Any] = None, no_default: bool = False) -> Any: ...
diff --git a/contrib/python/pyrsistent/py3/pyrsistent/typing.pyi b/contrib/python/pyrsistent/py3/pyrsistent/typing.pyi
new file mode 100644
index 0000000000..801dc70cc1
--- /dev/null
+++ b/contrib/python/pyrsistent/py3/pyrsistent/typing.pyi
@@ -0,0 +1,292 @@
+# flake8: noqa: E704
+# from https://gist.github.com/WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09
+# Stubs for pyrsistent (Python 3.6)
+#
+from typing import Any
+from typing import Callable
+from typing import Dict
+from typing import Generic
+from typing import Hashable
+from typing import Iterator
+from typing import Iterable
+from typing import List
+from typing import Mapping
+from typing import Optional
+from typing import Sequence
+from typing import AbstractSet
+from typing import Sized
+from typing import Set
+from typing import Tuple
+from typing import TypeVar
+from typing import Type
+from typing import Union
+from typing import overload
+
+T = TypeVar('T')
+KT = TypeVar('KT')
+VT = TypeVar('VT')
+
+
+class PMap(Mapping[KT, VT], Hashable):
+ def __add__(self, other: PMap[KT, VT]) -> PMap[KT, VT]: ...
+ def __getitem__(self, key: KT) -> VT: ...
+ def __getattr__(self, key: str) -> VT: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[KT]: ...
+ def __len__(self) -> int: ...
+ def copy(self) -> PMap[KT, VT]: ...
+ def discard(self, key: KT) -> PMap[KT, VT]: ...
+ def evolver(self) -> PMapEvolver[KT, VT]: ...
+ def iteritems(self) -> Iterable[Tuple[KT, VT]]: ...
+ def iterkeys(self) -> Iterable[KT]: ...
+ def itervalues(self) -> Iterable[VT]: ...
+ def remove(self, key: KT) -> PMap[KT, VT]: ...
+ def set(self, key: KT, val: VT) -> PMap[KT, VT]: ...
+ def transform(self, *transformations: Any) -> PMap[KT, VT]: ...
+ def update(self, *args: Mapping): ...
+ def update_with(self, update_fn: Callable[[VT, VT], VT], *args: Mapping) -> Any: ...
+
+
+class PMapEvolver(Generic[KT, VT]):
+ def __delitem__(self, key: KT) -> None: ...
+ def __getitem__(self, key: KT) -> VT: ...
+ def __len__(self) -> int: ...
+ def __setitem__(self, key: KT, val: VT) -> None: ...
+ def is_dirty(self) -> bool: ...
+ def persistent(self) -> PMap[KT, VT]: ...
+ def remove(self, key: KT) -> PMapEvolver[KT, VT]: ...
+ def set(self, key: KT, val: VT) -> PMapEvolver[KT, VT]: ...
+
+
+class PVector(Sequence[T], Hashable):
+ def __add__(self, other: PVector[T]) -> PVector[T]: ...
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ @overload
+ def __getitem__(self, index: slice) -> PVector[T]: ...
+ def __hash__(self) -> int: ...
+ def __len__(self) -> int: ...
+ def __mul__(self, other: PVector[T]) -> PVector[T]: ...
+ def append(self, val: T) -> PVector[T]: ...
+ def delete(self, index: int, stop: Optional[int] = None) -> PVector[T]: ...
+ def evolver(self) -> PVectorEvolver[T]: ...
+ def extend(self, obj: Iterable[T]) -> PVector[T]: ...
+ def tolist(self) -> List[T]: ...
+ def mset(self, *args: Iterable[Union[T, int]]) -> PVector[T]: ...
+ def remove(self, value: T) -> PVector[T]: ...
+ # Not compatible with MutableSequence
+ def set(self, i: int, val: T) -> PVector[T]: ...
+ def transform(self, *transformations: Any) -> PVector[T]: ...
+
+
+class PVectorEvolver(Sequence[T], Sized):
+ def __delitem__(self, i: Union[int, slice]) -> None: ...
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ # Not actually supported
+ @overload
+ def __getitem__(self, index: slice) -> PVectorEvolver[T]: ...
+ def __len__(self) -> int: ...
+ def __setitem__(self, index: int, val: T) -> None: ...
+ def append(self, val: T) -> PVectorEvolver[T]: ...
+ def delete(self, value: T) -> PVectorEvolver[T]: ...
+ def extend(self, obj: Iterable[T]) -> PVectorEvolver[T]: ...
+ def is_dirty(self) -> bool: ...
+ def persistent(self) -> PVector[T]: ...
+ def set(self, i: int, val: T) -> PVectorEvolver[T]: ...
+
+
+class PSet(AbstractSet[T], Hashable):
+ def __contains__(self, element: object) -> bool: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[T]: ...
+ def __len__(self) -> int: ...
+ def add(self, element: T) -> PSet[T]: ...
+ def copy(self) -> PSet[T]: ...
+ def difference(self, iterable: Iterable) -> PSet[T]: ...
+ def discard(self, element: T) -> PSet[T]: ...
+ def evolver(self) -> PSetEvolver[T]: ...
+ def intersection(self, iterable: Iterable) -> PSet[T]: ...
+ def issubset(self, iterable: Iterable) -> bool: ...
+ def issuperset(self, iterable: Iterable) -> bool: ...
+ def remove(self, element: T) -> PSet[T]: ...
+ def symmetric_difference(self, iterable: Iterable[T]) -> PSet[T]: ...
+ def union(self, iterable: Iterable[T]) -> PSet[T]: ...
+ def update(self, iterable: Iterable[T]) -> PSet[T]: ...
+
+
+class PSetEvolver(Generic[T], Sized):
+ def __len__(self) -> int: ...
+ def add(self, element: T) -> PSetEvolver[T]: ...
+ def is_dirty(self) -> bool: ...
+ def persistent(self) -> PSet[T]: ...
+ def remove(self, element: T) -> PSetEvolver[T]: ...
+
+
+class PBag(Generic[T], Sized, Hashable):
+ def __add__(self, other: PBag[T]) -> PBag[T]: ...
+ def __and__(self, other: PBag[T]) -> PBag[T]: ...
+ def __contains__(self, elem: object) -> bool: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[T]: ...
+ def __len__(self) -> int: ...
+ def __or__(self, other: PBag[T]) -> PBag[T]: ...
+ def __sub__(self, other: PBag[T]) -> PBag[T]: ...
+ def add(self, elem: T) -> PBag[T]: ...
+ def count(self, elem: T) -> int: ...
+ def remove(self, elem: T) -> PBag[T]: ...
+ def update(self, iterable: Iterable[T]) -> PBag[T]: ...
+
+
+class PDeque(Sequence[T], Hashable):
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ @overload
+ def __getitem__(self, index: slice) -> PDeque[T]: ...
+ def __hash__(self) -> int: ...
+ def __len__(self) -> int: ...
+ def __lt__(self, other: PDeque[T]) -> bool: ...
+ def append(self, elem: T) -> PDeque[T]: ...
+ def appendleft(self, elem: T) -> PDeque[T]: ...
+ def extend(self, iterable: Iterable[T]) -> PDeque[T]: ...
+ def extendleft(self, iterable: Iterable[T]) -> PDeque[T]: ...
+ @property
+ def left(self) -> T: ...
+ # The real return type is Integral according to what pyrsistent
+ # checks at runtime but mypy doesn't deal in numeric.*:
+ # https://github.com/python/mypy/issues/2636
+ @property
+ def maxlen(self) -> int: ...
+ def pop(self, count: int = 1) -> PDeque[T]: ...
+ def popleft(self, count: int = 1) -> PDeque[T]: ...
+ def remove(self, elem: T) -> PDeque[T]: ...
+ def reverse(self) -> PDeque[T]: ...
+ @property
+ def right(self) -> T: ...
+ def rotate(self, steps: int) -> PDeque[T]: ...
+
+
+class PList(Sequence[T], Hashable):
+ @overload
+ def __getitem__(self, index: int) -> T: ...
+ @overload
+ def __getitem__(self, index: slice) -> PList[T]: ...
+ def __hash__(self) -> int: ...
+ def __len__(self) -> int: ...
+ def __lt__(self, other: PList[T]) -> bool: ...
+ def __gt__(self, other: PList[T]) -> bool: ...
+ def cons(self, elem: T) -> PList[T]: ...
+ @property
+ def first(self) -> T: ...
+ def mcons(self, iterable: Iterable[T]) -> PList[T]: ...
+ def remove(self, elem: T) -> PList[T]: ...
+ @property
+ def rest(self) -> PList[T]: ...
+ def reverse(self) -> PList[T]: ...
+ def split(self, index: int) -> Tuple[PList[T], PList[T]]: ...
+
+T_PClass = TypeVar('T_PClass', bound='PClass')
+
+class PClass(Hashable):
+ def __new__(cls, **kwargs: Any): ...
+ def set(self: T_PClass, *args: Any, **kwargs: Any) -> T_PClass: ...
+ @classmethod
+ def create(
+ cls: Type[T_PClass],
+ kwargs: Any,
+ _factory_fields: Optional[Any] = ...,
+ ignore_extra: bool = ...,
+ ) -> T_PClass: ...
+ def serialize(self, format: Optional[Any] = ...): ...
+ def transform(self, *transformations: Any): ...
+ def __eq__(self, other: object): ...
+ def __ne__(self, other: object): ...
+ def __hash__(self): ...
+ def __reduce__(self): ...
+ def evolver(self) -> PClassEvolver: ...
+ def remove(self: T_PClass, name: Any) -> T_PClass: ...
+
+class PClassEvolver:
+ def __init__(self, original: Any, initial_dict: Any) -> None: ...
+ def __getitem__(self, item: Any): ...
+ def set(self, key: Any, value: Any): ...
+ def __setitem__(self, key: Any, value: Any) -> None: ...
+ def remove(self, item: Any): ...
+ def __delitem__(self, item: Any) -> None: ...
+ def persistent(self) -> PClass: ...
+ def __getattr__(self, item: Any): ...
+
+
+
+class CheckedPMap(PMap[KT, VT]):
+ __key_type__: Type[KT]
+ __value_type__: Type[VT]
+ def __new__(cls, source: Mapping[KT, VT] = ..., size: int = ...) -> CheckedPMap: ...
+ @classmethod
+ def create(cls, source_data: Mapping[KT, VT], _factory_fields: Any = ...) -> CheckedPMap[KT, VT]: ...
+ def serialize(self, format: Optional[Any] = ...) -> Dict[KT, VT]: ...
+
+
+class CheckedPVector(PVector[T]):
+ __type__: Type[T]
+ def __new__(self, initial: Iterable[T] = ...) -> CheckedPVector: ...
+ @classmethod
+ def create(cls, source_data: Iterable[T], _factory_fields: Any = ...) -> CheckedPVector[T]: ...
+ def serialize(self, format: Optional[Any] = ...) -> List[T]: ...
+
+
+class CheckedPSet(PSet[T]):
+ __type__: Type[T]
+ def __new__(cls, initial: Iterable[T] = ...) -> CheckedPSet: ...
+ @classmethod
+ def create(cls, source_data: Iterable[T], _factory_fields: Any = ...) -> CheckedPSet[T]: ...
+ def serialize(self, format: Optional[Any] = ...) -> Set[T]: ...
+
+
+class InvariantException(Exception):
+ invariant_errors: Tuple[Any, ...] = ... # possibly nested tuple
+ missing_fields: Tuple[str, ...] = ...
+ def __init__(
+ self,
+ error_codes: Any = ...,
+ missing_fields: Any = ...,
+ *args: Any,
+ **kwargs: Any
+ ) -> None: ...
+
+
+class CheckedTypeError(TypeError):
+ source_class: Type[Any]
+ expected_types: Tuple[Any, ...]
+ actual_type: Type[Any]
+ actual_value: Any
+ def __init__(
+ self,
+ source_class: Any,
+ expected_types: Any,
+ actual_type: Any,
+ actual_value: Any,
+ *args: Any,
+ **kwargs: Any
+ ) -> None: ...
+
+
+class CheckedKeyTypeError(CheckedTypeError): ...
+class CheckedValueTypeError(CheckedTypeError): ...
+class CheckedType: ...
+
+
+class PTypeError(TypeError):
+ source_class: Type[Any] = ...
+ field: str = ...
+ expected_types: Tuple[Any, ...] = ...
+ actual_type: Type[Any] = ...
+ def __init__(
+ self,
+ source_class: Any,
+ field: Any,
+ expected_types: Any,
+ actual_type: Any,
+ *args: Any,
+ **kwargs: Any
+ ) -> None: ...
diff --git a/contrib/python/requests-mock/py3/requests_mock/__init__.pyi b/contrib/python/requests-mock/py3/requests_mock/__init__.pyi
new file mode 100644
index 0000000000..9d8dd002e9
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/__init__.pyi
@@ -0,0 +1,33 @@
+# Stubs for requests_mock
+
+from requests_mock.adapter import (
+ ANY as ANY,
+ Adapter as Adapter,
+ Callback as Callback,
+ AdditionalMatcher as AdditionalMatcher,
+)
+from requests_mock.exceptions import (
+ MockException as MockException,
+ NoMockAddress as NoMockAddress,
+)
+from requests_mock.mocker import (
+ DELETE as DELETE,
+ GET as GET,
+ HEAD as HEAD,
+ Mocker as Mocker,
+ MockerCore as MockerCore,
+ OPTIONS as OPTIONS,
+ PATCH as PATCH,
+ POST as POST,
+ PUT as PUT,
+ mock as mock,
+)
+from requests_mock.request import (
+ Request as Request,
+ _RequestObjectProxy as _RequestObjectProxy, # For backward compatibility
+)
+from requests_mock.response import (
+ CookieJar as CookieJar,
+ create_response as create_response,
+ Context as Context,
+)
diff --git a/contrib/python/requests-mock/py3/requests_mock/adapter.pyi b/contrib/python/requests-mock/py3/requests_mock/adapter.pyi
new file mode 100644
index 0000000000..dbeba496ba
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/adapter.pyi
@@ -0,0 +1,75 @@
+# Stubs for requests_mock.adapter
+
+from http.cookiejar import CookieJar
+from io import IOBase
+from typing import Any, Callable, Dict, List, NewType, Optional, Pattern, Type, TypeVar, Union
+
+from requests import Response
+from requests.adapters import BaseAdapter
+from urllib3.response import HTTPResponse
+
+from requests_mock.request import Request
+from requests_mock.response import Context
+
+AnyMatcher = NewType("AnyMatcher", object)
+
+ANY: AnyMatcher = ...
+
+T = TypeVar('T')
+Callback = Callable[[Request, Context], T]
+Matcher = Callable[[Request], Optional[Response]]
+AdditionalMatcher = Callable[[Request], bool]
+
+class _RequestHistoryTracker:
+ request_history: List[Request] = ...
+ def __init__(self) -> None: ...
+ @property
+ def last_request(self) -> Optional[Request]: ...
+ @property
+ def called(self) -> bool: ...
+ @property
+ def called_once(self) -> bool: ...
+ @property
+ def call_count(self) -> int: ...
+
+class _RunRealHTTP(Exception): ...
+
+class _Matcher(_RequestHistoryTracker):
+ def __init__(
+ self,
+ method: Any,
+ url: Any,
+ responses: Any,
+ complete_qs: Any,
+ request_headers: Any,
+ additional_matcher: AdditionalMatcher,
+ real_http: Any,
+ case_sensitive: Any
+ ) -> None: ...
+ def __call__(self, request: Request) -> Optional[Response]: ...
+
+class Adapter(BaseAdapter, _RequestHistoryTracker):
+ def __init__(self, case_sensitive: bool = ...) -> None: ...
+ def register_uri(
+ self,
+ method: Union[str, AnyMatcher],
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ **kwargs: Any
+ ) -> _Matcher: ...
+ def add_matcher(self, matcher: Matcher) -> None: ...
+ def reset(self) -> None: ...
diff --git a/contrib/python/requests-mock/py3/requests_mock/contrib/_pytest_plugin.pyi b/contrib/python/requests-mock/py3/requests_mock/contrib/_pytest_plugin.pyi
new file mode 100644
index 0000000000..3ffb573881
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/contrib/_pytest_plugin.pyi
@@ -0,0 +1,6 @@
+
+from typing import Literal, Optional, Union
+
+
+_case_type = Optional[str]
+_case_default = Union[Literal['false'], Literal[False]]
diff --git a/contrib/python/requests-mock/py3/requests_mock/exceptions.pyi b/contrib/python/requests-mock/py3/requests_mock/exceptions.pyi
new file mode 100644
index 0000000000..eb35447228
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/exceptions.pyi
@@ -0,0 +1,13 @@
+# Stubs for requests_mock.exceptions
+
+from typing import Any
+
+from requests import Request
+
+class MockException(Exception): ...
+
+class NoMockAddress(MockException):
+ request: Any = ...
+ def __init__(self, request: Request) -> None: ...
+
+class InvalidRequest(MockException): ...
diff --git a/contrib/python/requests-mock/py3/requests_mock/mocker.pyi b/contrib/python/requests-mock/py3/requests_mock/mocker.pyi
new file mode 100644
index 0000000000..891e7d6c9a
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/mocker.pyi
@@ -0,0 +1,263 @@
+# Stubs for requests_mock.mocker
+
+from json import JSONEncoder
+from http.cookiejar import CookieJar
+from io import IOBase
+from typing import Any, Callable, Dict, List, Optional, Pattern, Type, TypeVar, Union
+
+from requests import Response, Session
+from urllib3.response import HTTPResponse
+
+from requests_mock.adapter import AnyMatcher, _Matcher, Callback, AdditionalMatcher
+from requests_mock.request import Request
+
+DELETE: str
+GET: str
+HEAD: str
+OPTIONS: str
+PATCH: str
+POST: str
+PUT: str
+
+class MockerCore:
+ case_sensitive: bool = ...
+ def __init__(self, **kwargs: Any) -> None: ...
+ def start(self) -> None: ...
+ def stop(self) -> None: ...
+ def add_matcher(self, matcher: Callable[[Request], Optional[Response]]) -> None: ...
+ @property
+ def request_history(self) -> List[Request]: ...
+ @property
+ def last_request(self) -> Optional[Request]: ...
+ @property
+ def called(self) -> bool: ...
+ @property
+ def called_once(self) -> bool: ...
+ @property
+ def call_count(self) -> int: ...
+ def reset(self) -> None: ...
+ def reset_mock(self) -> None: ...
+
+ def register_uri(
+ self,
+ method: Union[str, AnyMatcher],
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def request(
+ self,
+ method: Union[str, AnyMatcher],
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def get(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def head(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def options(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def post(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def put(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def patch(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+ def delete(
+ self,
+ url: Union[str, Pattern[str], AnyMatcher],
+ response_list: Optional[List[Dict[str, Any]]] = ...,
+ *,
+ request_headers: Dict[str, str] = ...,
+ complete_qs: bool = ...,
+ status_code: int = ...,
+ reason: str = ...,
+ headers: Dict[str, str] = ...,
+ cookies: Union[CookieJar, Dict[str, str]] = ...,
+ json: Union[Any, Callback[Any]] = ...,
+ text: Union[str, Callback[str]] = ...,
+ content: Union[bytes, Callback[bytes]] = ...,
+ body: Union[IOBase, Callback[IOBase]] = ...,
+ raw: HTTPResponse = ...,
+ exc: Union[Exception, Type[Exception]] = ...,
+ additional_matcher: AdditionalMatcher = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ **kwargs: Any,
+ ) -> _Matcher: ...
+
+_T = TypeVar('_T')
+
+class Mocker(MockerCore):
+ TEST_PREFIX: str = ...
+ real_http: bool = ...
+
+ def __init__(
+ self,
+ kw: str = ...,
+ case_sensitive: bool = ...,
+ adapter: Any = ...,
+ session: Optional[Session] = ...,
+ real_http: bool = ...,
+ json_encoder: Optional[Type[JSONEncoder]] = ...,
+ ) -> None: ...
+ def __enter__(self) -> Any: ...
+ def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
+ def __call__(self, obj: Any) -> Any: ...
+ def copy(self) -> Mocker: ...
+ def decorate_callable(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
+ def decorate_class(self, klass: Type[_T]) -> Type[_T]: ...
+
+mock = Mocker
diff --git a/contrib/python/requests-mock/py3/requests_mock/request.pyi b/contrib/python/requests-mock/py3/requests_mock/request.pyi
new file mode 100644
index 0000000000..5e2fb30d20
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/request.pyi
@@ -0,0 +1,41 @@
+# Stubs for requests_mock.request
+
+from typing import Any, Dict, List
+
+class _RequestObjectProxy:
+ def __init__(self, request: Any, **kwargs: Any) -> None: ...
+ def __getattr__(self, name: str) -> Any: ...
+ @property
+ def scheme(self) -> str: ...
+ @property
+ def netloc(self) -> str: ...
+ @property
+ def hostname(self) -> str: ...
+ @property
+ def port(self) -> int: ...
+ @property
+ def path(self) -> str: ...
+ @property
+ def query(self) -> str: ...
+ @property
+ def qs(self) -> Dict[str, List[str]]: ...
+ @property
+ def timeout(self) -> int: ...
+ @property
+ def allow_redirects(self) -> bool: ...
+ @property
+ def verify(self) -> Any: ...
+ @property
+ def stream(self) -> Any: ...
+ @property
+ def cert(self) -> Any: ...
+ @property
+ def proxies(self) -> Any: ...
+ @property
+ def text(self) -> str: ...
+ def json(self, **kwargs: Any) -> Any: ...
+ @property
+ def matcher(self) -> Any: ...
+
+
+Request = _RequestObjectProxy
diff --git a/contrib/python/requests-mock/py3/requests_mock/response.pyi b/contrib/python/requests-mock/py3/requests_mock/response.pyi
new file mode 100644
index 0000000000..e7c8977883
--- /dev/null
+++ b/contrib/python/requests-mock/py3/requests_mock/response.pyi
@@ -0,0 +1,38 @@
+# Stubs for requests_mock.response
+
+from typing import Any, Dict
+
+import six
+
+from requests import Request, Response
+from requests.cookies import RequestsCookieJar
+
+class CookieJar(RequestsCookieJar):
+ def set(self, name: Any, value: Any, **kwargs: Any) -> Any: ...
+
+class _FakeConnection:
+ def send(self, request: Any, **kwargs: Any) -> None: ...
+ def close(self) -> None: ...
+
+class _IOReader(six.BytesIO):
+ def read(self, *args: Any, **kwargs: Any) -> Any: ...
+
+def create_response(request: Any, **kwargs: Any) -> Response: ...
+
+class _Context:
+ headers: Dict[str,str] = ...
+ status_code: int = ...
+ reason: str = ...
+ cookies: Any = ...
+
+ def __init__(self,
+ headers: Dict[str, str],
+ status_code: int,
+ reason: str,
+ cookies: Any) -> None: ...
+
+class _MatcherResponse:
+ def __init__(self, **kwargs: Any) -> None: ...
+ def get_response(self, request: Request) -> Response: ...
+
+Context = _Context
diff --git a/contrib/python/responses/py2/responses/__init__.pyi b/contrib/python/responses/py2/responses/__init__.pyi
new file mode 100644
index 0000000000..a0af8f24d7
--- /dev/null
+++ b/contrib/python/responses/py2/responses/__init__.pyi
@@ -0,0 +1,334 @@
+from collections import Sequence, Sized
+from typing import (
+ Any,
+ Callable,
+ Iterator,
+ Mapping,
+ Optional,
+ NamedTuple,
+ Protocol,
+ TypeVar,
+ Dict,
+ List,
+ Tuple,
+ Union,
+ Iterable
+)
+from io import BufferedReader, BytesIO
+from re import Pattern
+from requests.adapters import HTTPResponse, PreparedRequest
+from requests.cookies import RequestsCookieJar
+from typing_extensions import Literal
+from unittest import mock as std_mock
+from urllib.parse import quote as quote
+from urllib3.response import HTTPHeaderDict
+from .matchers import urlencoded_params_matcher, json_params_matcher
+from .registries import FirstMatchRegistry
+
+
+def _clean_unicode(url: str) -> str: ...
+def _cookies_from_headers(headers: Dict[str, str]) -> RequestsCookieJar: ...
+def _ensure_str(s: str) -> str: ...
+def _ensure_url_default_path(
+ url: Union[Pattern[str], str]
+) -> Union[Pattern[str], str]: ...
+def _get_url_and_path(url: str) -> str: ...
+def _handle_body(
+ body: Optional[Union[bytes, BufferedReader, str]]
+) -> Union[BufferedReader, BytesIO]: ...
+def _has_unicode(s: str) -> bool: ...
+def _is_string(s: Union[Pattern[str], str]) -> bool: ...
+def get_wrapped(
+ func: Callable[..., Any], responses: RequestsMock, registry: Optional[Any]
+) -> Callable[..., Any]: ...
+
+
+class Call(NamedTuple):
+ request: PreparedRequest
+ response: Any
+
+_Body = Union[str, BaseException, "Response", BufferedReader, bytes]
+
+MatcherIterable = Iterable[Callable[[Any], Callable[..., Any]]]
+
+class CallList(Sequence[Call], Sized):
+ def __init__(self) -> None:
+ self._calls = List[Call]
+ ...
+ def __iter__(self) -> Iterator[Call]: ...
+ def __len__(self) -> int: ...
+ def __getitem__(self, idx: int) -> Call: ... # type: ignore [override]
+ def add(self, request: PreparedRequest, response: _Body) -> None: ...
+ def reset(self) -> None: ...
+
+class BaseResponse:
+ passthrough: bool = ...
+ content_type: Optional[str] = ...
+ headers: Optional[Mapping[str, str]] = ...
+ stream: bool = ...
+ method: Any = ...
+ url: Any = ...
+ match_querystring: Any = ...
+ match: MatcherIterable = ...
+ call_count: int = ...
+ def __init__(
+ self,
+ method: str,
+ url: Union[Pattern[str], str],
+ match_querystring: Union[bool, object] = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+ def __eq__(self, other: Any) -> bool: ...
+ def __ne__(self, other: Any) -> bool: ...
+ def _req_attr_matches(
+ self, match: MatcherIterable, request: PreparedRequest
+ ) -> Tuple[bool, str]: ...
+ def _should_match_querystring(
+ self, match_querystring_argument: Union[bool, object]
+ ) -> bool: ...
+ def _url_matches(
+ self, url: Union[Pattern[str], str], other: str, match_querystring: bool = ...
+ ) -> bool: ...
+ def _url_matches_strict(self, url: str, other: str) -> bool: ...
+ def get_headers(self) -> HTTPHeaderDict: ... # type: ignore [no-any-unimported]
+ def get_response(self, request: PreparedRequest) -> None: ...
+ def matches(self, request: PreparedRequest) -> Tuple[bool, str]: ...
+
+class Response(BaseResponse):
+ body: _Body = ...
+ status: int = ...
+ headers: Optional[Mapping[str, str]] = ...
+ stream: bool = ...
+ content_type: Optional[str] = ...
+ auto_calculate_content_length: bool = ...
+ def __init__(
+ self,
+ method: str,
+ url: Union[Pattern[str], str],
+ body: _Body = ...,
+ json: Optional[Any] = ...,
+ status: int = ...,
+ headers: Optional[Mapping[str, str]] = ...,
+ stream: bool = ...,
+ content_type: Optional[str] = ...,
+ auto_calculate_content_length: bool = ...,
+ match_querystring: bool = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+ def get_response( # type: ignore [override]
+ self, request: PreparedRequest
+ ) -> HTTPResponse: ...
+
+class CallbackResponse(BaseResponse):
+ callback: Callable[[Any], Any] = ...
+ stream: bool = ...
+ content_type: Optional[str] = ...
+ def __init__(
+ self,
+ method: str,
+ url: Union[Pattern[str], str],
+ callback: Callable[[Any], Any],
+ stream: bool = ...,
+ content_type: Optional[str] = ...,
+ match_querystring: bool = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+ def get_response( # type: ignore [override]
+ self, request: PreparedRequest
+ ) -> HTTPResponse: ...
+
+class PassthroughResponse(BaseResponse):
+ passthrough: bool = ...
+
+class OriginalResponseShim:
+ msg: Any = ...
+ def __init__( # type: ignore [no-any-unimported]
+ self, headers: HTTPHeaderDict
+ ) -> None: ...
+ def isclosed(self) -> bool: ...
+
+_F = TypeVar("_F", bound=Callable[..., Any])
+
+class RequestsMock:
+ DELETE: Literal["DELETE"]
+ GET: Literal["GET"]
+ HEAD: Literal["HEAD"]
+ OPTIONS: Literal["OPTIONS"]
+ PATCH: Literal["PATCH"]
+ POST: Literal["POST"]
+ PUT: Literal["PUT"]
+ response_callback: Optional[Callable[[Any], Any]] = ...
+ assert_all_requests_are_fired: Any = ...
+ passthru_prefixes: Tuple[Union[str, Pattern[str]], ...] = ...
+ target: Any = ...
+ _matches: List[Any]
+ def __init__(
+ self,
+ assert_all_requests_are_fired: bool = ...,
+ response_callback: Optional[Callable[[Any], Any]] = ...,
+ passthru_prefixes: Tuple[str, ...] = ...,
+ target: str = ...,
+ registry: Any = ...,
+ ) -> None:
+ self._patcher = Callable[[Any], Any]
+ self._calls = CallList
+ ...
+ def reset(self) -> None: ...
+ add: _Add
+ add_passthru: _AddPassthru
+ def remove(
+ self,
+ method_or_response: Optional[Union[str, Response]] = ...,
+ url: Optional[Union[Pattern[str], str]] = ...,
+ ) -> None: ...
+ replace: _Replace
+ upsert: _Upsert
+ add_callback: _AddCallback
+ @property
+ def calls(self) -> CallList: ...
+ def __enter__(self) -> RequestsMock: ...
+ def __exit__(self, type: Any, value: Any, traceback: Any) -> bool: ...
+ def activate(self, func: Optional[_F], registry: Optional[Any]) -> _F: ...
+ def start(self) -> None: ...
+ def stop(self, allow_assert: bool = ...) -> None: ...
+ def assert_call_count(self, url: str, count: int) -> bool: ...
+ def registered(self) -> List[Any]: ...
+ def _set_registry(self, registry: Any) -> None: ...
+ def _get_registry(self) -> Any: ...
+
+
+HeaderSet = Optional[Union[Mapping[str, str], List[Tuple[str, str]]]]
+
+class _Add(Protocol):
+ def __call__(
+ self,
+ method: Optional[Union[str, BaseResponse]] = ...,
+ url: Optional[Union[Pattern[str], str]] = ...,
+ body: _Body = ...,
+ json: Optional[Any] = ...,
+ status: int = ...,
+ headers: HeaderSet = ...,
+ stream: bool = ...,
+ content_type: Optional[str] = ...,
+ auto_calculate_content_length: bool = ...,
+ adding_headers: HeaderSet = ...,
+ match_querystring: bool = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+
+class _AddCallback(Protocol):
+ def __call__(
+ self,
+ method: str,
+ url: Union[Pattern[str], str],
+ callback: Callable[[PreparedRequest], Union[Exception, Tuple[int, Mapping[str, str], _Body]]],
+ match_querystring: bool = ...,
+ content_type: Optional[str] = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+
+class _AddPassthru(Protocol):
+ def __call__(
+ self, prefix: Union[Pattern[str], str]
+ ) -> None: ...
+
+class _Remove(Protocol):
+ def __call__(
+ self,
+ method_or_response: Optional[Union[str, BaseResponse]] = ...,
+ url: Optional[Union[Pattern[str], str]] = ...,
+ ) -> None: ...
+
+class _Replace(Protocol):
+ def __call__(
+ self,
+ method_or_response: Optional[Union[str, BaseResponse]] = ...,
+ url: Optional[Union[Pattern[str], str]] = ...,
+ body: _Body = ...,
+ json: Optional[Any] = ...,
+ status: int = ...,
+ headers: HeaderSet = ...,
+ stream: bool = ...,
+ content_type: Optional[str] = ...,
+ adding_headers: HeaderSet = ...,
+ match_querystring: bool = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+
+class _Upsert(Protocol):
+ def __call__(
+ self,
+ method: Optional[Union[str, BaseResponse]] = ...,
+ url: Optional[Union[Pattern[str], str]] = ...,
+ body: _Body = ...,
+ json: Optional[Any] = ...,
+ status: int = ...,
+ headers: HeaderSet = ...,
+ stream: bool = ...,
+ content_type: Optional[str] = ...,
+ adding_headers: HeaderSet = ...,
+ match_querystring: bool = ...,
+ match: MatcherIterable = ...,
+ ) -> None: ...
+
+class _Registered(Protocol):
+ def __call__(self) -> List[Response]: ...
+
+
+activate: Any
+add: _Add
+add_callback: _AddCallback
+add_passthru: _AddPassthru
+assert_all_requests_are_fired: bool
+assert_call_count: Callable[[str, int], bool]
+calls: CallList
+DELETE: Literal["DELETE"]
+GET: Literal["GET"]
+HEAD: Literal["HEAD"]
+mock: RequestsMock
+_default_mock: RequestsMock
+OPTIONS: Literal["OPTIONS"]
+passthru_prefixes: Tuple[str, ...]
+PATCH: Literal["PATCH"]
+POST: Literal["POST"]
+PUT: Literal["PUT"]
+registered: _Registered
+remove: _Remove
+replace: _Replace
+reset: Callable[[], None]
+response_callback: Callable[[Any], Any]
+start: Callable[[], None]
+stop: Callable[..., None]
+target: Any
+upsert: _Upsert
+
+__all__ = [
+ "CallbackResponse",
+ "Response",
+ "RequestsMock",
+ # Exposed by the RequestsMock class:
+ "activate",
+ "add",
+ "add_callback",
+ "add_passthru",
+ "assert_all_requests_are_fired",
+ "assert_call_count",
+ "calls",
+ "DELETE",
+ "GET",
+ "HEAD",
+ "OPTIONS",
+ "passthru_prefixes",
+ "PATCH",
+ "POST",
+ "PUT",
+ "registered",
+ "remove",
+ "replace",
+ "reset",
+ "response_callback",
+ "start",
+ "stop",
+ "target",
+ "upsert",
+]
diff --git a/contrib/python/responses/py2/responses/matchers.pyi b/contrib/python/responses/py2/responses/matchers.pyi
new file mode 100644
index 0000000000..188de2e348
--- /dev/null
+++ b/contrib/python/responses/py2/responses/matchers.pyi
@@ -0,0 +1,44 @@
+from typing import (
+ Any,
+ Callable,
+ Optional,
+ Dict,
+)
+
+JSONDecodeError = ValueError
+
+
+def _create_key_val_str(input_dict: Dict[Any, Any]) -> str: ...
+
+def json_params_matcher(
+ params: Optional[Dict[str, Any]]
+) -> Callable[..., Any]: ...
+
+def urlencoded_params_matcher(
+ params: Optional[Dict[str, str]]
+) -> Callable[..., Any]: ...
+
+def query_param_matcher(
+ params: Optional[Dict[str, str]]
+) -> Callable[..., Any]: ...
+
+def query_string_matcher(
+ query: Optional[str]
+) -> Callable[..., Any]: ...
+
+def request_kwargs_matcher(
+ kwargs: Optional[Dict[str, Any]]
+) -> Callable[..., Any]: ...
+
+def multipart_matcher(
+ files: Dict[str, Any], data: Optional[Dict[str, str]] = ...
+) -> Callable[..., Any]: ...
+
+def header_matcher(
+ headers: Dict[str, str],
+ strict_match: bool = ...
+) -> Callable[..., Any]: ...
+
+def fragment_identifier_matcher(
+ identifier: Optional[str]
+) -> Callable[..., Any]: ...
diff --git a/contrib/python/responses/py2/responses/registries.pyi b/contrib/python/responses/py2/responses/registries.pyi
new file mode 100644
index 0000000000..7be9294286
--- /dev/null
+++ b/contrib/python/responses/py2/responses/registries.pyi
@@ -0,0 +1,17 @@
+from typing import (
+ List,
+ Tuple,
+)
+from requests.adapters import PreparedRequest
+from responses import BaseResponse
+
+class FirstMatchRegistry:
+ _responses = List[BaseResponse]
+ def __init__(self) -> None: ...
+ @property
+ def registered(self) -> List[BaseResponse]: ...
+ def reset(self) -> None: ...
+ def find(self, request: PreparedRequest) -> Tuple[BaseResponse, List[str]]: ...
+ def add(self, response: BaseResponse) -> None: ...
+ def remove(self, response: BaseResponse) -> None: ...
+ def replace(self, response: BaseResponse) -> None: ...
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/__init__.pyi b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/__init__.pyi
new file mode 100644
index 0000000000..96f6e36c7f
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/__init__.pyi
@@ -0,0 +1,2 @@
+from .more import *
+from .recipes import *
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/more.pyi b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/more.pyi
new file mode 100644
index 0000000000..75c5232c1a
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/more.pyi
@@ -0,0 +1,666 @@
+"""Stubs for more_itertools.more"""
+from __future__ import annotations
+
+from types import TracebackType
+from typing import (
+ Any,
+ Callable,
+ Container,
+ ContextManager,
+ Generic,
+ Hashable,
+ Iterable,
+ Iterator,
+ overload,
+ Reversible,
+ Sequence,
+ Sized,
+ Type,
+ TypeVar,
+ type_check_only,
+)
+from typing_extensions import Protocol
+
+# Type and type variable definitions
+_T = TypeVar('_T')
+_T1 = TypeVar('_T1')
+_T2 = TypeVar('_T2')
+_U = TypeVar('_U')
+_V = TypeVar('_V')
+_W = TypeVar('_W')
+_T_co = TypeVar('_T_co', covariant=True)
+_GenFn = TypeVar('_GenFn', bound=Callable[..., Iterator[object]])
+_Raisable = BaseException | Type[BaseException]
+
+@type_check_only
+class _SizedIterable(Protocol[_T_co], Sized, Iterable[_T_co]): ...
+
+@type_check_only
+class _SizedReversible(Protocol[_T_co], Sized, Reversible[_T_co]): ...
+
+@type_check_only
+class _SupportsSlicing(Protocol[_T_co]):
+ def __getitem__(self, __k: slice) -> _T_co: ...
+
+def chunked(
+ iterable: Iterable[_T], n: int | None, strict: bool = ...
+) -> Iterator[list[_T]]: ...
+@overload
+def first(iterable: Iterable[_T]) -> _T: ...
+@overload
+def first(iterable: Iterable[_T], default: _U) -> _T | _U: ...
+@overload
+def last(iterable: Iterable[_T]) -> _T: ...
+@overload
+def last(iterable: Iterable[_T], default: _U) -> _T | _U: ...
+@overload
+def nth_or_last(iterable: Iterable[_T], n: int) -> _T: ...
+@overload
+def nth_or_last(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
+
+class peekable(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T]) -> None: ...
+ def __iter__(self) -> peekable[_T]: ...
+ def __bool__(self) -> bool: ...
+ @overload
+ def peek(self) -> _T: ...
+ @overload
+ def peek(self, default: _U) -> _T | _U: ...
+ def prepend(self, *items: _T) -> None: ...
+ def __next__(self) -> _T: ...
+ @overload
+ def __getitem__(self, index: int) -> _T: ...
+ @overload
+ def __getitem__(self, index: slice) -> list[_T]: ...
+
+def consumer(func: _GenFn) -> _GenFn: ...
+def ilen(iterable: Iterable[object]) -> int: ...
+def iterate(func: Callable[[_T], _T], start: _T) -> Iterator[_T]: ...
+def with_iter(
+ context_manager: ContextManager[Iterable[_T]],
+) -> Iterator[_T]: ...
+def one(
+ iterable: Iterable[_T],
+ too_short: _Raisable | None = ...,
+ too_long: _Raisable | None = ...,
+) -> _T: ...
+def raise_(exception: _Raisable, *args: Any) -> None: ...
+def strictly_n(
+ iterable: Iterable[_T],
+ n: int,
+ too_short: _GenFn | None = ...,
+ too_long: _GenFn | None = ...,
+) -> list[_T]: ...
+def distinct_permutations(
+ iterable: Iterable[_T], r: int | None = ...
+) -> Iterator[tuple[_T, ...]]: ...
+def intersperse(
+ e: _U, iterable: Iterable[_T], n: int = ...
+) -> Iterator[_T | _U]: ...
+def unique_to_each(*iterables: Iterable[_T]) -> list[list[_T]]: ...
+@overload
+def windowed(
+ seq: Iterable[_T], n: int, *, step: int = ...
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def windowed(
+ seq: Iterable[_T], n: int, fillvalue: _U, step: int = ...
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def substrings(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def substrings_indexes(
+ seq: Sequence[_T], reverse: bool = ...
+) -> Iterator[tuple[Sequence[_T], int, int]]: ...
+
+class bucket(Generic[_T, _U], Container[_U]):
+ def __init__(
+ self,
+ iterable: Iterable[_T],
+ key: Callable[[_T], _U],
+ validator: Callable[[object], object] | None = ...,
+ ) -> None: ...
+ def __contains__(self, value: object) -> bool: ...
+ def __iter__(self) -> Iterator[_U]: ...
+ def __getitem__(self, value: object) -> Iterator[_T]: ...
+
+def spy(
+ iterable: Iterable[_T], n: int = ...
+) -> tuple[list[_T], Iterator[_T]]: ...
+def interleave(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def interleave_longest(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def interleave_evenly(
+ iterables: list[Iterable[_T]], lengths: list[int] | None = ...
+) -> Iterator[_T]: ...
+def collapse(
+ iterable: Iterable[Any],
+ base_type: type | None = ...,
+ levels: int | None = ...,
+) -> Iterator[Any]: ...
+@overload
+def side_effect(
+ func: Callable[[_T], object],
+ iterable: Iterable[_T],
+ chunk_size: None = ...,
+ before: Callable[[], object] | None = ...,
+ after: Callable[[], object] | None = ...,
+) -> Iterator[_T]: ...
+@overload
+def side_effect(
+ func: Callable[[list[_T]], object],
+ iterable: Iterable[_T],
+ chunk_size: int,
+ before: Callable[[], object] | None = ...,
+ after: Callable[[], object] | None = ...,
+) -> Iterator[_T]: ...
+def sliced(
+ seq: _SupportsSlicing[_T], n: int, strict: bool = ...
+) -> Iterator[_T]: ...
+def split_at(
+ iterable: Iterable[_T],
+ pred: Callable[[_T], object],
+ maxsplit: int = ...,
+ keep_separator: bool = ...,
+) -> Iterator[list[_T]]: ...
+def split_before(
+ iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
+) -> Iterator[list[_T]]: ...
+def split_after(
+ iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
+) -> Iterator[list[_T]]: ...
+def split_when(
+ iterable: Iterable[_T],
+ pred: Callable[[_T, _T], object],
+ maxsplit: int = ...,
+) -> Iterator[list[_T]]: ...
+def split_into(
+ iterable: Iterable[_T], sizes: Iterable[int | None]
+) -> Iterator[list[_T]]: ...
+@overload
+def padded(
+ iterable: Iterable[_T],
+ *,
+ n: int | None = ...,
+ next_multiple: bool = ...,
+) -> Iterator[_T | None]: ...
+@overload
+def padded(
+ iterable: Iterable[_T],
+ fillvalue: _U,
+ n: int | None = ...,
+ next_multiple: bool = ...,
+) -> Iterator[_T | _U]: ...
+@overload
+def repeat_last(iterable: Iterable[_T]) -> Iterator[_T]: ...
+@overload
+def repeat_last(iterable: Iterable[_T], default: _U) -> Iterator[_T | _U]: ...
+def distribute(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ...
+@overload
+def stagger(
+ iterable: Iterable[_T],
+ offsets: _SizedIterable[int] = ...,
+ longest: bool = ...,
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def stagger(
+ iterable: Iterable[_T],
+ offsets: _SizedIterable[int] = ...,
+ longest: bool = ...,
+ fillvalue: _U = ...,
+) -> Iterator[tuple[_T | _U, ...]]: ...
+
+class UnequalIterablesError(ValueError):
+ def __init__(self, details: tuple[int, int, int] | None = ...) -> None: ...
+
+@overload
+def zip_equal(__iter1: Iterable[_T1]) -> Iterator[tuple[_T1]]: ...
+@overload
+def zip_equal(
+ __iter1: Iterable[_T1], __iter2: Iterable[_T2]
+) -> Iterator[tuple[_T1, _T2]]: ...
+@overload
+def zip_equal(
+ __iter1: Iterable[_T],
+ __iter2: Iterable[_T],
+ __iter3: Iterable[_T],
+ *iterables: Iterable[_T],
+) -> Iterator[tuple[_T, ...]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: None = None,
+) -> Iterator[tuple[_T1 | None]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ __iter2: Iterable[_T2],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: None = None,
+) -> Iterator[tuple[_T1 | None, _T2 | None]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T],
+ __iter2: Iterable[_T],
+ __iter3: Iterable[_T],
+ *iterables: Iterable[_T],
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: None = None,
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U,
+) -> Iterator[tuple[_T1 | _U]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T1],
+ __iter2: Iterable[_T2],
+ *,
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U,
+) -> Iterator[tuple[_T1 | _U, _T2 | _U]]: ...
+@overload
+def zip_offset(
+ __iter1: Iterable[_T],
+ __iter2: Iterable[_T],
+ __iter3: Iterable[_T],
+ *iterables: Iterable[_T],
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U,
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def sort_together(
+ iterables: Iterable[Iterable[_T]],
+ key_list: Iterable[int] = ...,
+ key: Callable[..., Any] | None = ...,
+ reverse: bool = ...,
+) -> list[tuple[_T, ...]]: ...
+def unzip(iterable: Iterable[Sequence[_T]]) -> tuple[Iterator[_T], ...]: ...
+def divide(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ...
+def always_iterable(
+ obj: object,
+ base_type: type | tuple[type | tuple[Any, ...], ...] | None = ...,
+) -> Iterator[Any]: ...
+def adjacent(
+ predicate: Callable[[_T], bool],
+ iterable: Iterable[_T],
+ distance: int = ...,
+) -> Iterator[tuple[bool, _T]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None = None,
+ valuefunc: None = None,
+ reducefunc: None = None,
+) -> Iterator[tuple[_T, Iterator[_T]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None,
+ reducefunc: None,
+) -> Iterator[tuple[_U, Iterator[_T]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None,
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None,
+) -> Iterable[tuple[_T, Iterable[_V]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None,
+) -> Iterable[tuple[_U, Iterator[_V]]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None,
+ valuefunc: None,
+ reducefunc: Callable[[Iterator[_T]], _W],
+) -> Iterable[tuple[_T, _W]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None,
+ reducefunc: Callable[[Iterator[_T]], _W],
+) -> Iterable[tuple[_U, _W]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: None,
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[Iterable[_V]], _W],
+) -> Iterable[tuple[_T, _W]]: ...
+@overload
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[Iterable[_V]], _W],
+) -> Iterable[tuple[_U, _W]]: ...
+
+class numeric_range(Generic[_T, _U], Sequence[_T], Hashable, Reversible[_T]):
+ @overload
+ def __init__(self, __stop: _T) -> None: ...
+ @overload
+ def __init__(self, __start: _T, __stop: _T) -> None: ...
+ @overload
+ def __init__(self, __start: _T, __stop: _T, __step: _U) -> None: ...
+ def __bool__(self) -> bool: ...
+ def __contains__(self, elem: object) -> bool: ...
+ def __eq__(self, other: object) -> bool: ...
+ @overload
+ def __getitem__(self, key: int) -> _T: ...
+ @overload
+ def __getitem__(self, key: slice) -> numeric_range[_T, _U]: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[_T]: ...
+ def __len__(self) -> int: ...
+ def __reduce__(
+ self,
+ ) -> tuple[Type[numeric_range[_T, _U]], tuple[_T, _T, _U]]: ...
+ def __repr__(self) -> str: ...
+ def __reversed__(self) -> Iterator[_T]: ...
+ def count(self, value: _T) -> int: ...
+ def index(self, value: _T) -> int: ... # type: ignore
+
+def count_cycle(
+ iterable: Iterable[_T], n: int | None = ...
+) -> Iterable[tuple[int, _T]]: ...
+def mark_ends(
+ iterable: Iterable[_T],
+) -> Iterable[tuple[bool, bool, _T]]: ...
+def locate(
+ iterable: Iterable[object],
+ pred: Callable[..., Any] = ...,
+ window_size: int | None = ...,
+) -> Iterator[int]: ...
+def lstrip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+def rstrip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+def strip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+
+class islice_extended(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T], *args: int | None) -> None: ...
+ def __iter__(self) -> islice_extended[_T]: ...
+ def __next__(self) -> _T: ...
+ def __getitem__(self, index: slice) -> islice_extended[_T]: ...
+
+def always_reversible(iterable: Iterable[_T]) -> Iterator[_T]: ...
+def consecutive_groups(
+ iterable: Iterable[_T], ordering: Callable[[_T], int] = ...
+) -> Iterator[Iterator[_T]]: ...
+@overload
+def difference(
+ iterable: Iterable[_T],
+ func: Callable[[_T, _T], _U] = ...,
+ *,
+ initial: None = ...,
+) -> Iterator[_T | _U]: ...
+@overload
+def difference(
+ iterable: Iterable[_T], func: Callable[[_T, _T], _U] = ..., *, initial: _U
+) -> Iterator[_U]: ...
+
+class SequenceView(Generic[_T], Sequence[_T]):
+ def __init__(self, target: Sequence[_T]) -> None: ...
+ @overload
+ def __getitem__(self, index: int) -> _T: ...
+ @overload
+ def __getitem__(self, index: slice) -> Sequence[_T]: ...
+ def __len__(self) -> int: ...
+
+class seekable(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, iterable: Iterable[_T], maxlen: int | None = ...
+ ) -> None: ...
+ def __iter__(self) -> seekable[_T]: ...
+ def __next__(self) -> _T: ...
+ def __bool__(self) -> bool: ...
+ @overload
+ def peek(self) -> _T: ...
+ @overload
+ def peek(self, default: _U) -> _T | _U: ...
+ def elements(self) -> SequenceView[_T]: ...
+ def seek(self, index: int) -> None: ...
+
+class run_length:
+ @staticmethod
+ def encode(iterable: Iterable[_T]) -> Iterator[tuple[_T, int]]: ...
+ @staticmethod
+ def decode(iterable: Iterable[tuple[_T, int]]) -> Iterator[_T]: ...
+
+def exactly_n(
+ iterable: Iterable[_T], n: int, predicate: Callable[[_T], object] = ...
+) -> bool: ...
+def circular_shifts(iterable: Iterable[_T]) -> list[tuple[_T, ...]]: ...
+def make_decorator(
+ wrapping_func: Callable[..., _U], result_index: int = ...
+) -> Callable[..., Callable[[Callable[..., Any]], Callable[..., _U]]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None = ...,
+ reducefunc: None = ...,
+) -> dict[_U, list[_T]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None = ...,
+) -> dict[_U, list[_V]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None = ...,
+ reducefunc: Callable[[list[_T]], _W] = ...,
+) -> dict[_U, _W]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[list[_V]], _W],
+) -> dict[_U, _W]: ...
+def rlocate(
+ iterable: Iterable[_T],
+ pred: Callable[..., object] = ...,
+ window_size: int | None = ...,
+) -> Iterator[int]: ...
+def replace(
+ iterable: Iterable[_T],
+ pred: Callable[..., object],
+ substitutes: Iterable[_U],
+ count: int | None = ...,
+ window_size: int = ...,
+) -> Iterator[_T | _U]: ...
+def partitions(iterable: Iterable[_T]) -> Iterator[list[list[_T]]]: ...
+def set_partitions(
+ iterable: Iterable[_T], k: int | None = ...
+) -> Iterator[list[list[_T]]]: ...
+
+class time_limited(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, limit_seconds: float, iterable: Iterable[_T]
+ ) -> None: ...
+ def __iter__(self) -> islice_extended[_T]: ...
+ def __next__(self) -> _T: ...
+
+@overload
+def only(
+ iterable: Iterable[_T], *, too_long: _Raisable | None = ...
+) -> _T | None: ...
+@overload
+def only(
+ iterable: Iterable[_T], default: _U, too_long: _Raisable | None = ...
+) -> _T | _U: ...
+def ichunked(iterable: Iterable[_T], n: int) -> Iterator[Iterator[_T]]: ...
+def distinct_combinations(
+ iterable: Iterable[_T], r: int
+) -> Iterator[tuple[_T, ...]]: ...
+def filter_except(
+ validator: Callable[[Any], object],
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException],
+) -> Iterator[_T]: ...
+def map_except(
+ function: Callable[[Any], _U],
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException],
+) -> Iterator[_U]: ...
+def map_if(
+ iterable: Iterable[Any],
+ pred: Callable[[Any], bool],
+ func: Callable[[Any], Any],
+ func_else: Callable[[Any], Any] | None = ...,
+) -> Iterator[Any]: ...
+def sample(
+ iterable: Iterable[_T],
+ k: int,
+ weights: Iterable[float] | None = ...,
+) -> list[_T]: ...
+def is_sorted(
+ iterable: Iterable[_T],
+ key: Callable[[_T], _U] | None = ...,
+ reverse: bool = False,
+ strict: bool = False,
+) -> bool: ...
+
+class AbortThread(BaseException):
+ pass
+
+class callback_iter(Generic[_T], Iterator[_T]):
+ def __init__(
+ self,
+ func: Callable[..., Any],
+ callback_kwd: str = ...,
+ wait_seconds: float = ...,
+ ) -> None: ...
+ def __enter__(self) -> callback_iter[_T]: ...
+ def __exit__(
+ self,
+ exc_type: Type[BaseException] | None,
+ exc_value: BaseException | None,
+ traceback: TracebackType | None,
+ ) -> bool | None: ...
+ def __iter__(self) -> callback_iter[_T]: ...
+ def __next__(self) -> _T: ...
+ def _reader(self) -> Iterator[_T]: ...
+ @property
+ def done(self) -> bool: ...
+ @property
+ def result(self) -> Any: ...
+
+def windowed_complete(
+ iterable: Iterable[_T], n: int
+) -> Iterator[tuple[_T, ...]]: ...
+def all_unique(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> bool: ...
+def nth_product(index: int, *args: Iterable[_T]) -> tuple[_T, ...]: ...
+def nth_permutation(
+ iterable: Iterable[_T], r: int, index: int
+) -> tuple[_T, ...]: ...
+def value_chain(*args: _T | Iterable[_T]) -> Iterable[_T]: ...
+def product_index(element: Iterable[_T], *args: Iterable[_T]) -> int: ...
+def combination_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+def permutation_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+def repeat_each(iterable: Iterable[_T], n: int = ...) -> Iterator[_T]: ...
+
+class countable(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T]) -> None: ...
+ def __iter__(self) -> countable[_T]: ...
+ def __next__(self) -> _T: ...
+
+def chunked_even(iterable: Iterable[_T], n: int) -> Iterator[list[_T]]: ...
+def zip_broadcast(
+ *objects: _T | Iterable[_T],
+ scalar_types: type | tuple[type | tuple[Any, ...], ...] | None = ...,
+ strict: bool = ...,
+) -> Iterable[tuple[_T, ...]]: ...
+def unique_in_window(
+ iterable: Iterable[_T], n: int, key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def duplicates_everseen(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def duplicates_justseen(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+
+class _SupportsLessThan(Protocol):
+ def __lt__(self, __other: Any) -> bool: ...
+
+_SupportsLessThanT = TypeVar("_SupportsLessThanT", bound=_SupportsLessThan)
+
+@overload
+def minmax(
+ iterable_or_value: Iterable[_SupportsLessThanT], *, key: None = None
+) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+ iterable_or_value: Iterable[_T], *, key: Callable[[_T], _SupportsLessThan]
+) -> tuple[_T, _T]: ...
+@overload
+def minmax(
+ iterable_or_value: Iterable[_SupportsLessThanT],
+ *,
+ key: None = None,
+ default: _U,
+) -> _U | tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+ iterable_or_value: Iterable[_T],
+ *,
+ key: Callable[[_T], _SupportsLessThan],
+ default: _U,
+) -> _U | tuple[_T, _T]: ...
+@overload
+def minmax(
+ iterable_or_value: _SupportsLessThanT,
+ __other: _SupportsLessThanT,
+ *others: _SupportsLessThanT,
+) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+ iterable_or_value: _T,
+ __other: _T,
+ *others: _T,
+ key: Callable[[_T], _SupportsLessThan],
+) -> tuple[_T, _T]: ...
+def longest_common_prefix(
+ iterables: Iterable[Iterable[_T]],
+) -> Iterator[_T]: ...
+def iequals(*iterables: Iterable[object]) -> bool: ...
+def constrained_batches(
+ iterable: Iterable[object],
+ max_size: int,
+ max_count: int | None = ...,
+ get_len: Callable[[_T], object] = ...,
+ strict: bool = ...,
+) -> Iterator[tuple[_T]]: ...
+def gray_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
diff --git a/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/recipes.pyi b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/recipes.pyi
new file mode 100644
index 0000000000..0267ed569e
--- /dev/null
+++ b/contrib/python/setuptools/py3/pkg_resources/_vendor/more_itertools/recipes.pyi
@@ -0,0 +1,119 @@
+"""Stubs for more_itertools.recipes"""
+from __future__ import annotations
+
+from typing import (
+ Any,
+ Callable,
+ Iterable,
+ Iterator,
+ overload,
+ Sequence,
+ Type,
+ TypeVar,
+)
+
+# Type and type variable definitions
+_T = TypeVar('_T')
+_U = TypeVar('_U')
+
+def take(n: int, iterable: Iterable[_T]) -> list[_T]: ...
+def tabulate(
+ function: Callable[[int], _T], start: int = ...
+) -> Iterator[_T]: ...
+def tail(n: int, iterable: Iterable[_T]) -> Iterator[_T]: ...
+def consume(iterator: Iterable[object], n: int | None = ...) -> None: ...
+@overload
+def nth(iterable: Iterable[_T], n: int) -> _T | None: ...
+@overload
+def nth(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
+def all_equal(iterable: Iterable[object]) -> bool: ...
+def quantify(
+ iterable: Iterable[_T], pred: Callable[[_T], bool] = ...
+) -> int: ...
+def pad_none(iterable: Iterable[_T]) -> Iterator[_T | None]: ...
+def padnone(iterable: Iterable[_T]) -> Iterator[_T | None]: ...
+def ncycles(iterable: Iterable[_T], n: int) -> Iterator[_T]: ...
+def dotproduct(vec1: Iterable[object], vec2: Iterable[object]) -> object: ...
+def flatten(listOfLists: Iterable[Iterable[_T]]) -> Iterator[_T]: ...
+def repeatfunc(
+ func: Callable[..., _U], times: int | None = ..., *args: Any
+) -> Iterator[_U]: ...
+def pairwise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T]]: ...
+def grouper(
+ iterable: Iterable[_T],
+ n: int,
+ incomplete: str = ...,
+ fillvalue: _U = ...,
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def roundrobin(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def partition(
+ pred: Callable[[_T], object] | None, iterable: Iterable[_T]
+) -> tuple[Iterator[_T], Iterator[_T]]: ...
+def powerset(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def unique_everseen(
+ iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def unique_justseen(
+ iterable: Iterable[_T], key: Callable[[_T], object] | None = ...
+) -> Iterator[_T]: ...
+@overload
+def iter_except(
+ func: Callable[[], _T],
+ exception: Type[BaseException] | tuple[Type[BaseException], ...],
+ first: None = ...,
+) -> Iterator[_T]: ...
+@overload
+def iter_except(
+ func: Callable[[], _T],
+ exception: Type[BaseException] | tuple[Type[BaseException], ...],
+ first: Callable[[], _U],
+) -> Iterator[_T | _U]: ...
+@overload
+def first_true(
+ iterable: Iterable[_T], *, pred: Callable[[_T], object] | None = ...
+) -> _T | None: ...
+@overload
+def first_true(
+ iterable: Iterable[_T],
+ default: _U,
+ pred: Callable[[_T], object] | None = ...,
+) -> _T | _U: ...
+def random_product(
+ *args: Iterable[_T], repeat: int = ...
+) -> tuple[_T, ...]: ...
+def random_permutation(
+ iterable: Iterable[_T], r: int | None = ...
+) -> tuple[_T, ...]: ...
+def random_combination(iterable: Iterable[_T], r: int) -> tuple[_T, ...]: ...
+def random_combination_with_replacement(
+ iterable: Iterable[_T], r: int
+) -> tuple[_T, ...]: ...
+def nth_combination(
+ iterable: Iterable[_T], r: int, index: int
+) -> tuple[_T, ...]: ...
+def prepend(value: _T, iterator: Iterable[_U]) -> Iterator[_T | _U]: ...
+def convolve(signal: Iterable[_T], kernel: Iterable[_T]) -> Iterator[_T]: ...
+def before_and_after(
+ predicate: Callable[[_T], bool], it: Iterable[_T]
+) -> tuple[Iterator[_T], Iterator[_T]]: ...
+def triplewise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T, _T]]: ...
+def sliding_window(
+ iterable: Iterable[_T], n: int
+) -> Iterator[tuple[_T, ...]]: ...
+def subslices(iterable: Iterable[_T]) -> Iterator[list[_T]]: ...
+def polynomial_from_roots(roots: Sequence[int]) -> list[int]: ...
+def iter_index(
+ iterable: Iterable[object],
+ value: Any,
+ start: int | None = ...,
+) -> Iterator[int]: ...
+def sieve(n: int) -> Iterator[int]: ...
+def batched(
+ iterable: Iterable[_T],
+ n: int,
+) -> Iterator[list[_T]]: ...
+def transpose(
+ it: Iterable[Iterable[_T]],
+) -> tuple[Iterator[_T], ...]: ...
+def matmul(m1: Sequence[_T], m2: Sequence[_T]) -> Iterator[list[_T]]: ...
+def factor(n: int) -> Iterator[int]: ...
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/__init__.pyi b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/__init__.pyi
new file mode 100644
index 0000000000..96f6e36c7f
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/__init__.pyi
@@ -0,0 +1,2 @@
+from .more import *
+from .recipes import *
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.pyi b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.pyi
new file mode 100644
index 0000000000..2fba9cb300
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.pyi
@@ -0,0 +1,480 @@
+"""Stubs for more_itertools.more"""
+
+from typing import (
+ Any,
+ Callable,
+ Container,
+ Dict,
+ Generic,
+ Hashable,
+ Iterable,
+ Iterator,
+ List,
+ Optional,
+ Reversible,
+ Sequence,
+ Sized,
+ Tuple,
+ Union,
+ TypeVar,
+ type_check_only,
+)
+from types import TracebackType
+from typing_extensions import ContextManager, Protocol, Type, overload
+
+# Type and type variable definitions
+_T = TypeVar('_T')
+_U = TypeVar('_U')
+_V = TypeVar('_V')
+_W = TypeVar('_W')
+_T_co = TypeVar('_T_co', covariant=True)
+_GenFn = TypeVar('_GenFn', bound=Callable[..., Iterator[object]])
+_Raisable = Union[BaseException, 'Type[BaseException]']
+
+@type_check_only
+class _SizedIterable(Protocol[_T_co], Sized, Iterable[_T_co]): ...
+
+@type_check_only
+class _SizedReversible(Protocol[_T_co], Sized, Reversible[_T_co]): ...
+
+def chunked(
+ iterable: Iterable[_T], n: int, strict: bool = ...
+) -> Iterator[List[_T]]: ...
+@overload
+def first(iterable: Iterable[_T]) -> _T: ...
+@overload
+def first(iterable: Iterable[_T], default: _U) -> Union[_T, _U]: ...
+@overload
+def last(iterable: Iterable[_T]) -> _T: ...
+@overload
+def last(iterable: Iterable[_T], default: _U) -> Union[_T, _U]: ...
+@overload
+def nth_or_last(iterable: Iterable[_T], n: int) -> _T: ...
+@overload
+def nth_or_last(
+ iterable: Iterable[_T], n: int, default: _U
+) -> Union[_T, _U]: ...
+
+class peekable(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T]) -> None: ...
+ def __iter__(self) -> peekable[_T]: ...
+ def __bool__(self) -> bool: ...
+ @overload
+ def peek(self) -> _T: ...
+ @overload
+ def peek(self, default: _U) -> Union[_T, _U]: ...
+ def prepend(self, *items: _T) -> None: ...
+ def __next__(self) -> _T: ...
+ @overload
+ def __getitem__(self, index: int) -> _T: ...
+ @overload
+ def __getitem__(self, index: slice) -> List[_T]: ...
+
+def collate(*iterables: Iterable[_T], **kwargs: Any) -> Iterable[_T]: ...
+def consumer(func: _GenFn) -> _GenFn: ...
+def ilen(iterable: Iterable[object]) -> int: ...
+def iterate(func: Callable[[_T], _T], start: _T) -> Iterator[_T]: ...
+def with_iter(
+ context_manager: ContextManager[Iterable[_T]],
+) -> Iterator[_T]: ...
+def one(
+ iterable: Iterable[_T],
+ too_short: Optional[_Raisable] = ...,
+ too_long: Optional[_Raisable] = ...,
+) -> _T: ...
+def distinct_permutations(
+ iterable: Iterable[_T], r: Optional[int] = ...
+) -> Iterator[Tuple[_T, ...]]: ...
+def intersperse(
+ e: _U, iterable: Iterable[_T], n: int = ...
+) -> Iterator[Union[_T, _U]]: ...
+def unique_to_each(*iterables: Iterable[_T]) -> List[List[_T]]: ...
+@overload
+def windowed(
+ seq: Iterable[_T], n: int, *, step: int = ...
+) -> Iterator[Tuple[Optional[_T], ...]]: ...
+@overload
+def windowed(
+ seq: Iterable[_T], n: int, fillvalue: _U, step: int = ...
+) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+def substrings(iterable: Iterable[_T]) -> Iterator[Tuple[_T, ...]]: ...
+def substrings_indexes(
+ seq: Sequence[_T], reverse: bool = ...
+) -> Iterator[Tuple[Sequence[_T], int, int]]: ...
+
+class bucket(Generic[_T, _U], Container[_U]):
+ def __init__(
+ self,
+ iterable: Iterable[_T],
+ key: Callable[[_T], _U],
+ validator: Optional[Callable[[object], object]] = ...,
+ ) -> None: ...
+ def __contains__(self, value: object) -> bool: ...
+ def __iter__(self) -> Iterator[_U]: ...
+ def __getitem__(self, value: object) -> Iterator[_T]: ...
+
+def spy(
+ iterable: Iterable[_T], n: int = ...
+) -> Tuple[List[_T], Iterator[_T]]: ...
+def interleave(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def interleave_longest(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def collapse(
+ iterable: Iterable[Any],
+ base_type: Optional[type] = ...,
+ levels: Optional[int] = ...,
+) -> Iterator[Any]: ...
+@overload
+def side_effect(
+ func: Callable[[_T], object],
+ iterable: Iterable[_T],
+ chunk_size: None = ...,
+ before: Optional[Callable[[], object]] = ...,
+ after: Optional[Callable[[], object]] = ...,
+) -> Iterator[_T]: ...
+@overload
+def side_effect(
+ func: Callable[[List[_T]], object],
+ iterable: Iterable[_T],
+ chunk_size: int,
+ before: Optional[Callable[[], object]] = ...,
+ after: Optional[Callable[[], object]] = ...,
+) -> Iterator[_T]: ...
+def sliced(
+ seq: Sequence[_T], n: int, strict: bool = ...
+) -> Iterator[Sequence[_T]]: ...
+def split_at(
+ iterable: Iterable[_T],
+ pred: Callable[[_T], object],
+ maxsplit: int = ...,
+ keep_separator: bool = ...,
+) -> Iterator[List[_T]]: ...
+def split_before(
+ iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
+) -> Iterator[List[_T]]: ...
+def split_after(
+ iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
+) -> Iterator[List[_T]]: ...
+def split_when(
+ iterable: Iterable[_T],
+ pred: Callable[[_T, _T], object],
+ maxsplit: int = ...,
+) -> Iterator[List[_T]]: ...
+def split_into(
+ iterable: Iterable[_T], sizes: Iterable[Optional[int]]
+) -> Iterator[List[_T]]: ...
+@overload
+def padded(
+ iterable: Iterable[_T],
+ *,
+ n: Optional[int] = ...,
+ next_multiple: bool = ...
+) -> Iterator[Optional[_T]]: ...
+@overload
+def padded(
+ iterable: Iterable[_T],
+ fillvalue: _U,
+ n: Optional[int] = ...,
+ next_multiple: bool = ...,
+) -> Iterator[Union[_T, _U]]: ...
+@overload
+def repeat_last(iterable: Iterable[_T]) -> Iterator[_T]: ...
+@overload
+def repeat_last(
+ iterable: Iterable[_T], default: _U
+) -> Iterator[Union[_T, _U]]: ...
+def distribute(n: int, iterable: Iterable[_T]) -> List[Iterator[_T]]: ...
+@overload
+def stagger(
+ iterable: Iterable[_T],
+ offsets: _SizedIterable[int] = ...,
+ longest: bool = ...,
+) -> Iterator[Tuple[Optional[_T], ...]]: ...
+@overload
+def stagger(
+ iterable: Iterable[_T],
+ offsets: _SizedIterable[int] = ...,
+ longest: bool = ...,
+ fillvalue: _U = ...,
+) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+
+class UnequalIterablesError(ValueError):
+ def __init__(
+ self, details: Optional[Tuple[int, int, int]] = ...
+ ) -> None: ...
+
+def zip_equal(*iterables: Iterable[_T]) -> Iterator[Tuple[_T, ...]]: ...
+@overload
+def zip_offset(
+ *iterables: Iterable[_T], offsets: _SizedIterable[int], longest: bool = ...
+) -> Iterator[Tuple[Optional[_T], ...]]: ...
+@overload
+def zip_offset(
+ *iterables: Iterable[_T],
+ offsets: _SizedIterable[int],
+ longest: bool = ...,
+ fillvalue: _U
+) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+def sort_together(
+ iterables: Iterable[Iterable[_T]],
+ key_list: Iterable[int] = ...,
+ key: Optional[Callable[..., Any]] = ...,
+ reverse: bool = ...,
+) -> List[Tuple[_T, ...]]: ...
+def unzip(iterable: Iterable[Sequence[_T]]) -> Tuple[Iterator[_T], ...]: ...
+def divide(n: int, iterable: Iterable[_T]) -> List[Iterator[_T]]: ...
+def always_iterable(
+ obj: object,
+ base_type: Union[
+ type, Tuple[Union[type, Tuple[Any, ...]], ...], None
+ ] = ...,
+) -> Iterator[Any]: ...
+def adjacent(
+ predicate: Callable[[_T], bool],
+ iterable: Iterable[_T],
+ distance: int = ...,
+) -> Iterator[Tuple[bool, _T]]: ...
+def groupby_transform(
+ iterable: Iterable[_T],
+ keyfunc: Optional[Callable[[_T], _U]] = ...,
+ valuefunc: Optional[Callable[[_T], _V]] = ...,
+ reducefunc: Optional[Callable[..., _W]] = ...,
+) -> Iterator[Tuple[_T, _W]]: ...
+
+class numeric_range(Generic[_T, _U], Sequence[_T], Hashable, Reversible[_T]):
+ @overload
+ def __init__(self, __stop: _T) -> None: ...
+ @overload
+ def __init__(self, __start: _T, __stop: _T) -> None: ...
+ @overload
+ def __init__(self, __start: _T, __stop: _T, __step: _U) -> None: ...
+ def __bool__(self) -> bool: ...
+ def __contains__(self, elem: object) -> bool: ...
+ def __eq__(self, other: object) -> bool: ...
+ @overload
+ def __getitem__(self, key: int) -> _T: ...
+ @overload
+ def __getitem__(self, key: slice) -> numeric_range[_T, _U]: ...
+ def __hash__(self) -> int: ...
+ def __iter__(self) -> Iterator[_T]: ...
+ def __len__(self) -> int: ...
+ def __reduce__(
+ self,
+ ) -> Tuple[Type[numeric_range[_T, _U]], Tuple[_T, _T, _U]]: ...
+ def __repr__(self) -> str: ...
+ def __reversed__(self) -> Iterator[_T]: ...
+ def count(self, value: _T) -> int: ...
+ def index(self, value: _T) -> int: ... # type: ignore
+
+def count_cycle(
+ iterable: Iterable[_T], n: Optional[int] = ...
+) -> Iterable[Tuple[int, _T]]: ...
+def mark_ends(
+ iterable: Iterable[_T],
+) -> Iterable[Tuple[bool, bool, _T]]: ...
+def locate(
+ iterable: Iterable[object],
+ pred: Callable[..., Any] = ...,
+ window_size: Optional[int] = ...,
+) -> Iterator[int]: ...
+def lstrip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+def rstrip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+def strip(
+ iterable: Iterable[_T], pred: Callable[[_T], object]
+) -> Iterator[_T]: ...
+
+class islice_extended(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, iterable: Iterable[_T], *args: Optional[int]
+ ) -> None: ...
+ def __iter__(self) -> islice_extended[_T]: ...
+ def __next__(self) -> _T: ...
+ def __getitem__(self, index: slice) -> islice_extended[_T]: ...
+
+def always_reversible(iterable: Iterable[_T]) -> Iterator[_T]: ...
+def consecutive_groups(
+ iterable: Iterable[_T], ordering: Callable[[_T], int] = ...
+) -> Iterator[Iterator[_T]]: ...
+@overload
+def difference(
+ iterable: Iterable[_T],
+ func: Callable[[_T, _T], _U] = ...,
+ *,
+ initial: None = ...
+) -> Iterator[Union[_T, _U]]: ...
+@overload
+def difference(
+ iterable: Iterable[_T], func: Callable[[_T, _T], _U] = ..., *, initial: _U
+) -> Iterator[_U]: ...
+
+class SequenceView(Generic[_T], Sequence[_T]):
+ def __init__(self, target: Sequence[_T]) -> None: ...
+ @overload
+ def __getitem__(self, index: int) -> _T: ...
+ @overload
+ def __getitem__(self, index: slice) -> Sequence[_T]: ...
+ def __len__(self) -> int: ...
+
+class seekable(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, iterable: Iterable[_T], maxlen: Optional[int] = ...
+ ) -> None: ...
+ def __iter__(self) -> seekable[_T]: ...
+ def __next__(self) -> _T: ...
+ def __bool__(self) -> bool: ...
+ @overload
+ def peek(self) -> _T: ...
+ @overload
+ def peek(self, default: _U) -> Union[_T, _U]: ...
+ def elements(self) -> SequenceView[_T]: ...
+ def seek(self, index: int) -> None: ...
+
+class run_length:
+ @staticmethod
+ def encode(iterable: Iterable[_T]) -> Iterator[Tuple[_T, int]]: ...
+ @staticmethod
+ def decode(iterable: Iterable[Tuple[_T, int]]) -> Iterator[_T]: ...
+
+def exactly_n(
+ iterable: Iterable[_T], n: int, predicate: Callable[[_T], object] = ...
+) -> bool: ...
+def circular_shifts(iterable: Iterable[_T]) -> List[Tuple[_T, ...]]: ...
+def make_decorator(
+ wrapping_func: Callable[..., _U], result_index: int = ...
+) -> Callable[..., Callable[[Callable[..., Any]], Callable[..., _U]]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None = ...,
+ reducefunc: None = ...,
+) -> Dict[_U, List[_T]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: None = ...,
+) -> Dict[_U, List[_V]]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: None = ...,
+ reducefunc: Callable[[List[_T]], _W] = ...,
+) -> Dict[_U, _W]: ...
+@overload
+def map_reduce(
+ iterable: Iterable[_T],
+ keyfunc: Callable[[_T], _U],
+ valuefunc: Callable[[_T], _V],
+ reducefunc: Callable[[List[_V]], _W],
+) -> Dict[_U, _W]: ...
+def rlocate(
+ iterable: Iterable[_T],
+ pred: Callable[..., object] = ...,
+ window_size: Optional[int] = ...,
+) -> Iterator[int]: ...
+def replace(
+ iterable: Iterable[_T],
+ pred: Callable[..., object],
+ substitutes: Iterable[_U],
+ count: Optional[int] = ...,
+ window_size: int = ...,
+) -> Iterator[Union[_T, _U]]: ...
+def partitions(iterable: Iterable[_T]) -> Iterator[List[List[_T]]]: ...
+def set_partitions(
+ iterable: Iterable[_T], k: Optional[int] = ...
+) -> Iterator[List[List[_T]]]: ...
+
+class time_limited(Generic[_T], Iterator[_T]):
+ def __init__(
+ self, limit_seconds: float, iterable: Iterable[_T]
+ ) -> None: ...
+ def __iter__(self) -> islice_extended[_T]: ...
+ def __next__(self) -> _T: ...
+
+@overload
+def only(
+ iterable: Iterable[_T], *, too_long: Optional[_Raisable] = ...
+) -> Optional[_T]: ...
+@overload
+def only(
+ iterable: Iterable[_T], default: _U, too_long: Optional[_Raisable] = ...
+) -> Union[_T, _U]: ...
+def ichunked(iterable: Iterable[_T], n: int) -> Iterator[Iterator[_T]]: ...
+def distinct_combinations(
+ iterable: Iterable[_T], r: int
+) -> Iterator[Tuple[_T, ...]]: ...
+def filter_except(
+ validator: Callable[[Any], object],
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException]
+) -> Iterator[_T]: ...
+def map_except(
+ function: Callable[[Any], _U],
+ iterable: Iterable[_T],
+ *exceptions: Type[BaseException]
+) -> Iterator[_U]: ...
+def sample(
+ iterable: Iterable[_T],
+ k: int,
+ weights: Optional[Iterable[float]] = ...,
+) -> List[_T]: ...
+def is_sorted(
+ iterable: Iterable[_T],
+ key: Optional[Callable[[_T], _U]] = ...,
+ reverse: bool = False,
+) -> bool: ...
+
+class AbortThread(BaseException):
+ pass
+
+class callback_iter(Generic[_T], Iterator[_T]):
+ def __init__(
+ self,
+ func: Callable[..., Any],
+ callback_kwd: str = ...,
+ wait_seconds: float = ...,
+ ) -> None: ...
+ def __enter__(self) -> callback_iter[_T]: ...
+ def __exit__(
+ self,
+ exc_type: Optional[Type[BaseException]],
+ exc_value: Optional[BaseException],
+ traceback: Optional[TracebackType],
+ ) -> Optional[bool]: ...
+ def __iter__(self) -> callback_iter[_T]: ...
+ def __next__(self) -> _T: ...
+ def _reader(self) -> Iterator[_T]: ...
+ @property
+ def done(self) -> bool: ...
+ @property
+ def result(self) -> Any: ...
+
+def windowed_complete(
+ iterable: Iterable[_T], n: int
+) -> Iterator[Tuple[_T, ...]]: ...
+def all_unique(
+ iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = ...
+) -> bool: ...
+def nth_product(index: int, *args: Iterable[_T]) -> Tuple[_T, ...]: ...
+def nth_permutation(
+ iterable: Iterable[_T], r: int, index: int
+) -> Tuple[_T, ...]: ...
+def value_chain(*args: Union[_T, Iterable[_T]]) -> Iterable[_T]: ...
+def product_index(element: Iterable[_T], *args: Iterable[_T]) -> int: ...
+def combination_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+def permutation_index(
+ element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
+
+class countable(Generic[_T], Iterator[_T]):
+ def __init__(self, iterable: Iterable[_T]) -> None: ...
+ def __iter__(self) -> countable[_T]: ...
+ def __next__(self) -> _T: ...
diff --git a/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/recipes.pyi b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/recipes.pyi
new file mode 100644
index 0000000000..5e39d96390
--- /dev/null
+++ b/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/recipes.pyi
@@ -0,0 +1,103 @@
+"""Stubs for more_itertools.recipes"""
+from typing import (
+ Any,
+ Callable,
+ Iterable,
+ Iterator,
+ List,
+ Optional,
+ Tuple,
+ TypeVar,
+ Union,
+)
+from typing_extensions import overload, Type
+
+# Type and type variable definitions
+_T = TypeVar('_T')
+_U = TypeVar('_U')
+
+def take(n: int, iterable: Iterable[_T]) -> List[_T]: ...
+def tabulate(
+ function: Callable[[int], _T], start: int = ...
+) -> Iterator[_T]: ...
+def tail(n: int, iterable: Iterable[_T]) -> Iterator[_T]: ...
+def consume(iterator: Iterable[object], n: Optional[int] = ...) -> None: ...
+@overload
+def nth(iterable: Iterable[_T], n: int) -> Optional[_T]: ...
+@overload
+def nth(iterable: Iterable[_T], n: int, default: _U) -> Union[_T, _U]: ...
+def all_equal(iterable: Iterable[object]) -> bool: ...
+def quantify(
+ iterable: Iterable[_T], pred: Callable[[_T], bool] = ...
+) -> int: ...
+def pad_none(iterable: Iterable[_T]) -> Iterator[Optional[_T]]: ...
+def padnone(iterable: Iterable[_T]) -> Iterator[Optional[_T]]: ...
+def ncycles(iterable: Iterable[_T], n: int) -> Iterator[_T]: ...
+def dotproduct(vec1: Iterable[object], vec2: Iterable[object]) -> object: ...
+def flatten(listOfLists: Iterable[Iterable[_T]]) -> Iterator[_T]: ...
+def repeatfunc(
+ func: Callable[..., _U], times: Optional[int] = ..., *args: Any
+) -> Iterator[_U]: ...
+def pairwise(iterable: Iterable[_T]) -> Iterator[Tuple[_T, _T]]: ...
+@overload
+def grouper(
+ iterable: Iterable[_T], n: int
+) -> Iterator[Tuple[Optional[_T], ...]]: ...
+@overload
+def grouper(
+ iterable: Iterable[_T], n: int, fillvalue: _U
+) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+@overload
+def grouper( # Deprecated interface
+ iterable: int, n: Iterable[_T]
+) -> Iterator[Tuple[Optional[_T], ...]]: ...
+@overload
+def grouper( # Deprecated interface
+ iterable: int, n: Iterable[_T], fillvalue: _U
+) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+def roundrobin(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def partition(
+ pred: Optional[Callable[[_T], object]], iterable: Iterable[_T]
+) -> Tuple[Iterator[_T], Iterator[_T]]: ...
+def powerset(iterable: Iterable[_T]) -> Iterator[Tuple[_T, ...]]: ...
+def unique_everseen(
+ iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = ...
+) -> Iterator[_T]: ...
+def unique_justseen(
+ iterable: Iterable[_T], key: Optional[Callable[[_T], object]] = ...
+) -> Iterator[_T]: ...
+@overload
+def iter_except(
+ func: Callable[[], _T], exception: Type[BaseException], first: None = ...
+) -> Iterator[_T]: ...
+@overload
+def iter_except(
+ func: Callable[[], _T],
+ exception: Type[BaseException],
+ first: Callable[[], _U],
+) -> Iterator[Union[_T, _U]]: ...
+@overload
+def first_true(
+ iterable: Iterable[_T], *, pred: Optional[Callable[[_T], object]] = ...
+) -> Optional[_T]: ...
+@overload
+def first_true(
+ iterable: Iterable[_T],
+ default: _U,
+ pred: Optional[Callable[[_T], object]] = ...,
+) -> Union[_T, _U]: ...
+def random_product(
+ *args: Iterable[_T], repeat: int = ...
+) -> Tuple[_T, ...]: ...
+def random_permutation(
+ iterable: Iterable[_T], r: Optional[int] = ...
+) -> Tuple[_T, ...]: ...
+def random_combination(iterable: Iterable[_T], r: int) -> Tuple[_T, ...]: ...
+def random_combination_with_replacement(
+ iterable: Iterable[_T], r: int
+) -> Tuple[_T, ...]: ...
+def nth_combination(
+ iterable: Iterable[_T], r: int, index: int
+) -> Tuple[_T, ...]: ...
+def prepend(value: _T, iterator: Iterable[_U]) -> Iterator[Union[_T, _U]]: ...
+def convolve(signal: Iterable[_T], kernel: Iterable[_T]) -> Iterator[_T]: ...
diff --git a/contrib/python/toml/py2/toml/__init__.pyi b/contrib/python/toml/py2/toml/__init__.pyi
new file mode 100644
index 0000000000..94c20f449c
--- /dev/null
+++ b/contrib/python/toml/py2/toml/__init__.pyi
@@ -0,0 +1,15 @@
+from toml import decoder as decoder, encoder as encoder
+
+load = decoder.load
+loads = decoder.loads
+TomlDecoder = decoder.TomlDecoder
+TomlDecodeError = decoder.TomlDecodeError
+TomlPreserveCommentDecoder = decoder.TomlPreserveCommentDecoder
+dump = encoder.dump
+dumps = encoder.dumps
+TomlEncoder = encoder.TomlEncoder
+TomlArraySeparatorEncoder = encoder.TomlArraySeparatorEncoder
+TomlPreserveInlineDictEncoder = encoder.TomlPreserveInlineDictEncoder
+TomlNumpyEncoder = encoder.TomlNumpyEncoder
+TomlPreserveCommentEncoder = encoder.TomlPreserveCommentEncoder
+TomlPathlibEncoder = encoder.TomlPathlibEncoder
diff --git a/contrib/python/toml/py2/toml/decoder.pyi b/contrib/python/toml/py2/toml/decoder.pyi
new file mode 100644
index 0000000000..967d3dd15a
--- /dev/null
+++ b/contrib/python/toml/py2/toml/decoder.pyi
@@ -0,0 +1,52 @@
+from toml.tz import TomlTz as TomlTz
+from typing import Any, Optional
+
+unicode = str
+basestring = str
+unichr = chr
+FNFError = FileNotFoundError
+FNFError = IOError
+TIME_RE: Any
+
+class TomlDecodeError(ValueError):
+ msg: Any = ...
+ doc: Any = ...
+ pos: Any = ...
+ lineno: Any = ...
+ colno: Any = ...
+ def __init__(self, msg: Any, doc: Any, pos: Any) -> None: ...
+
+class CommentValue:
+ val: Any = ...
+ comment: Any = ...
+ def __init__(self, val: Any, comment: Any, beginline: Any, _dict: Any) -> None: ...
+ def __getitem__(self, key: Any): ...
+ def __setitem__(self, key: Any, value: Any) -> None: ...
+ def dump(self, dump_value_func: Any): ...
+
+def load(f: Union[str, list, IO[str]],
+ _dict: Type[MutableMapping[str, Any]] = ...,
+ decoder: TomlDecoder = ...) \
+ -> MutableMapping[str, Any]: ...
+def loads(s: str, _dict: Type[MutableMapping[str, Any]] = ..., decoder: TomlDecoder = ...) \
+ -> MutableMapping[str, Any]: ...
+
+class InlineTableDict: ...
+
+class TomlDecoder:
+ def __init__(self, _dict: Any = ...) -> None: ...
+ def get_empty_table(self): ...
+ def get_empty_inline_table(self): ...
+ def load_inline_object(self, line: Any, currentlevel: Any, multikey: bool = ..., multibackslash: bool = ...) -> None: ...
+ def load_line(self, line: Any, currentlevel: Any, multikey: Any, multibackslash: Any): ...
+ def load_value(self, v: Any, strictly_valid: bool = ...): ...
+ def bounded_string(self, s: Any): ...
+ def load_array(self, a: Any): ...
+ def preserve_comment(self, line_no: Any, key: Any, comment: Any, beginline: Any) -> None: ...
+ def embed_comments(self, idx: Any, currentlevel: Any) -> None: ...
+
+class TomlPreserveCommentDecoder(TomlDecoder):
+ saved_comments: Any = ...
+ def __init__(self, _dict: Any = ...) -> None: ...
+ def preserve_comment(self, line_no: Any, key: Any, comment: Any, beginline: Any) -> None: ...
+ def embed_comments(self, idx: Any, currentlevel: Any) -> None: ...
diff --git a/contrib/python/toml/py2/toml/encoder.pyi b/contrib/python/toml/py2/toml/encoder.pyi
new file mode 100644
index 0000000000..194a3583ef
--- /dev/null
+++ b/contrib/python/toml/py2/toml/encoder.pyi
@@ -0,0 +1,34 @@
+from toml.decoder import InlineTableDict as InlineTableDict
+from typing import Any, Optional
+
+unicode = str
+
+def dump(o: Mapping[str, Any], f: IO[str], encoder: TomlEncoder = ...) -> str: ...
+def dumps(o: Mapping[str, Any], encoder: TomlEncoder = ...) -> str: ...
+
+class TomlEncoder:
+ preserve: Any = ...
+ dump_funcs: Any = ...
+ def __init__(self, _dict: Any = ..., preserve: bool = ...): ...
+ def get_empty_table(self): ...
+ def dump_list(self, v: Any): ...
+ def dump_inline_table(self, section: Any): ...
+ def dump_value(self, v: Any): ...
+ def dump_sections(self, o: Any, sup: Any): ...
+
+class TomlPreserveInlineDictEncoder(TomlEncoder):
+ def __init__(self, _dict: Any = ...) -> None: ...
+
+class TomlArraySeparatorEncoder(TomlEncoder):
+ separator: Any = ...
+ def __init__(self, _dict: Any = ..., preserve: bool = ..., separator: str = ...) -> None: ...
+ def dump_list(self, v: Any): ...
+
+class TomlNumpyEncoder(TomlEncoder):
+ def __init__(self, _dict: Any = ..., preserve: bool = ...) -> None: ...
+
+class TomlPreserveCommentEncoder(TomlEncoder):
+ def __init__(self, _dict: Any = ..., preserve: bool = ...): ...
+
+class TomlPathlibEncoder(TomlEncoder):
+ def dump_value(self, v: Any): ...
diff --git a/contrib/python/toml/py2/toml/ordered.pyi b/contrib/python/toml/py2/toml/ordered.pyi
new file mode 100644
index 0000000000..0f4292dc94
--- /dev/null
+++ b/contrib/python/toml/py2/toml/ordered.pyi
@@ -0,0 +1,7 @@
+from toml import TomlDecoder as TomlDecoder, TomlEncoder as TomlEncoder
+
+class TomlOrderedDecoder(TomlDecoder):
+ def __init__(self) -> None: ...
+
+class TomlOrderedEncoder(TomlEncoder):
+ def __init__(self) -> None: ...
diff --git a/contrib/python/toml/py2/toml/tz.pyi b/contrib/python/toml/py2/toml/tz.pyi
new file mode 100644
index 0000000000..fe37aead6e
--- /dev/null
+++ b/contrib/python/toml/py2/toml/tz.pyi
@@ -0,0 +1,9 @@
+from datetime import tzinfo
+from typing import Any
+
+class TomlTz(tzinfo):
+ def __init__(self, toml_offset: Any) -> None: ...
+ def __deepcopy__(self, memo: Any): ...
+ def tzname(self, dt: Any): ...
+ def utcoffset(self, dt: Any): ...
+ def dst(self, dt: Any): ...
diff --git a/contrib/python/toml/py3/toml/__init__.pyi b/contrib/python/toml/py3/toml/__init__.pyi
new file mode 100644
index 0000000000..94c20f449c
--- /dev/null
+++ b/contrib/python/toml/py3/toml/__init__.pyi
@@ -0,0 +1,15 @@
+from toml import decoder as decoder, encoder as encoder
+
+load = decoder.load
+loads = decoder.loads
+TomlDecoder = decoder.TomlDecoder
+TomlDecodeError = decoder.TomlDecodeError
+TomlPreserveCommentDecoder = decoder.TomlPreserveCommentDecoder
+dump = encoder.dump
+dumps = encoder.dumps
+TomlEncoder = encoder.TomlEncoder
+TomlArraySeparatorEncoder = encoder.TomlArraySeparatorEncoder
+TomlPreserveInlineDictEncoder = encoder.TomlPreserveInlineDictEncoder
+TomlNumpyEncoder = encoder.TomlNumpyEncoder
+TomlPreserveCommentEncoder = encoder.TomlPreserveCommentEncoder
+TomlPathlibEncoder = encoder.TomlPathlibEncoder
diff --git a/contrib/python/toml/py3/toml/decoder.pyi b/contrib/python/toml/py3/toml/decoder.pyi
new file mode 100644
index 0000000000..967d3dd15a
--- /dev/null
+++ b/contrib/python/toml/py3/toml/decoder.pyi
@@ -0,0 +1,52 @@
+from toml.tz import TomlTz as TomlTz
+from typing import Any, Optional
+
+unicode = str
+basestring = str
+unichr = chr
+FNFError = FileNotFoundError
+FNFError = IOError
+TIME_RE: Any
+
+class TomlDecodeError(ValueError):
+ msg: Any = ...
+ doc: Any = ...
+ pos: Any = ...
+ lineno: Any = ...
+ colno: Any = ...
+ def __init__(self, msg: Any, doc: Any, pos: Any) -> None: ...
+
+class CommentValue:
+ val: Any = ...
+ comment: Any = ...
+ def __init__(self, val: Any, comment: Any, beginline: Any, _dict: Any) -> None: ...
+ def __getitem__(self, key: Any): ...
+ def __setitem__(self, key: Any, value: Any) -> None: ...
+ def dump(self, dump_value_func: Any): ...
+
+def load(f: Union[str, list, IO[str]],
+ _dict: Type[MutableMapping[str, Any]] = ...,
+ decoder: TomlDecoder = ...) \
+ -> MutableMapping[str, Any]: ...
+def loads(s: str, _dict: Type[MutableMapping[str, Any]] = ..., decoder: TomlDecoder = ...) \
+ -> MutableMapping[str, Any]: ...
+
+class InlineTableDict: ...
+
+class TomlDecoder:
+ def __init__(self, _dict: Any = ...) -> None: ...
+ def get_empty_table(self): ...
+ def get_empty_inline_table(self): ...
+ def load_inline_object(self, line: Any, currentlevel: Any, multikey: bool = ..., multibackslash: bool = ...) -> None: ...
+ def load_line(self, line: Any, currentlevel: Any, multikey: Any, multibackslash: Any): ...
+ def load_value(self, v: Any, strictly_valid: bool = ...): ...
+ def bounded_string(self, s: Any): ...
+ def load_array(self, a: Any): ...
+ def preserve_comment(self, line_no: Any, key: Any, comment: Any, beginline: Any) -> None: ...
+ def embed_comments(self, idx: Any, currentlevel: Any) -> None: ...
+
+class TomlPreserveCommentDecoder(TomlDecoder):
+ saved_comments: Any = ...
+ def __init__(self, _dict: Any = ...) -> None: ...
+ def preserve_comment(self, line_no: Any, key: Any, comment: Any, beginline: Any) -> None: ...
+ def embed_comments(self, idx: Any, currentlevel: Any) -> None: ...
diff --git a/contrib/python/toml/py3/toml/encoder.pyi b/contrib/python/toml/py3/toml/encoder.pyi
new file mode 100644
index 0000000000..194a3583ef
--- /dev/null
+++ b/contrib/python/toml/py3/toml/encoder.pyi
@@ -0,0 +1,34 @@
+from toml.decoder import InlineTableDict as InlineTableDict
+from typing import Any, Optional
+
+unicode = str
+
+def dump(o: Mapping[str, Any], f: IO[str], encoder: TomlEncoder = ...) -> str: ...
+def dumps(o: Mapping[str, Any], encoder: TomlEncoder = ...) -> str: ...
+
+class TomlEncoder:
+ preserve: Any = ...
+ dump_funcs: Any = ...
+ def __init__(self, _dict: Any = ..., preserve: bool = ...): ...
+ def get_empty_table(self): ...
+ def dump_list(self, v: Any): ...
+ def dump_inline_table(self, section: Any): ...
+ def dump_value(self, v: Any): ...
+ def dump_sections(self, o: Any, sup: Any): ...
+
+class TomlPreserveInlineDictEncoder(TomlEncoder):
+ def __init__(self, _dict: Any = ...) -> None: ...
+
+class TomlArraySeparatorEncoder(TomlEncoder):
+ separator: Any = ...
+ def __init__(self, _dict: Any = ..., preserve: bool = ..., separator: str = ...) -> None: ...
+ def dump_list(self, v: Any): ...
+
+class TomlNumpyEncoder(TomlEncoder):
+ def __init__(self, _dict: Any = ..., preserve: bool = ...) -> None: ...
+
+class TomlPreserveCommentEncoder(TomlEncoder):
+ def __init__(self, _dict: Any = ..., preserve: bool = ...): ...
+
+class TomlPathlibEncoder(TomlEncoder):
+ def dump_value(self, v: Any): ...
diff --git a/contrib/python/toml/py3/toml/ordered.pyi b/contrib/python/toml/py3/toml/ordered.pyi
new file mode 100644
index 0000000000..0f4292dc94
--- /dev/null
+++ b/contrib/python/toml/py3/toml/ordered.pyi
@@ -0,0 +1,7 @@
+from toml import TomlDecoder as TomlDecoder, TomlEncoder as TomlEncoder
+
+class TomlOrderedDecoder(TomlDecoder):
+ def __init__(self) -> None: ...
+
+class TomlOrderedEncoder(TomlEncoder):
+ def __init__(self) -> None: ...
diff --git a/contrib/python/toml/py3/toml/tz.pyi b/contrib/python/toml/py3/toml/tz.pyi
new file mode 100644
index 0000000000..fe37aead6e
--- /dev/null
+++ b/contrib/python/toml/py3/toml/tz.pyi
@@ -0,0 +1,9 @@
+from datetime import tzinfo
+from typing import Any
+
+class TomlTz(tzinfo):
+ def __init__(self, toml_offset: Any) -> None: ...
+ def __deepcopy__(self, memo: Any): ...
+ def tzname(self, dt: Any): ...
+ def utcoffset(self, dt: Any): ...
+ def dst(self, dt: Any): ...
diff --git a/contrib/python/tornado/tornado-4/tornado/platform/auto.pyi b/contrib/python/tornado/tornado-4/tornado/platform/auto.pyi
new file mode 100644
index 0000000000..a1c97228a4
--- /dev/null
+++ b/contrib/python/tornado/tornado-4/tornado/platform/auto.pyi
@@ -0,0 +1,4 @@
+# auto.py is full of patterns mypy doesn't like, so for type checking
+# purposes we replace it with interface.py.
+
+from .interface import *
diff --git a/contrib/python/tornado/tornado-4/tornado/speedups.pyi b/contrib/python/tornado/tornado-4/tornado/speedups.pyi
new file mode 100644
index 0000000000..9e8def483d
--- /dev/null
+++ b/contrib/python/tornado/tornado-4/tornado/speedups.pyi
@@ -0,0 +1 @@
+def websocket_mask(mask: bytes, data: bytes) -> bytes: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/__init__.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/__init__.pyi
new file mode 100644
index 0000000000..bda5b5a7f4
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/__init__.pyi
@@ -0,0 +1 @@
+__version__: str
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/compiler/__init__.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/compiler/__init__.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/compiler/__init__.pyi
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/descriptor.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/descriptor.pyi
new file mode 100644
index 0000000000..d8a1ad676a
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/descriptor.pyi
@@ -0,0 +1,352 @@
+from _typeshed import Incomplete
+from typing import Any
+
+from .descriptor_pb2 import (
+ EnumOptions,
+ EnumValueOptions,
+ FieldOptions,
+ FileOptions,
+ MessageOptions,
+ MethodOptions,
+ OneofOptions,
+ ServiceOptions,
+)
+from .message import Message
+
+class Error(Exception): ...
+class TypeTransformationError(Error): ...
+
+class DescriptorMetaclass(type):
+ def __instancecheck__(self, obj: Any) -> bool: ...
+
+_internal_create_key: object
+_USE_C_DESCRIPTORS: bool
+
+class DescriptorBase(metaclass=DescriptorMetaclass):
+ has_options: Any
+ def __init__(self, options, serialized_options, options_class_name) -> None: ...
+ def GetOptions(self): ...
+
+class _NestedDescriptorBase(DescriptorBase):
+ name: Any
+ full_name: Any
+ file: Any
+ containing_type: Any
+ def __init__(
+ self,
+ options,
+ options_class_name,
+ name,
+ full_name,
+ file,
+ containing_type,
+ serialized_start=...,
+ serialized_end=...,
+ serialized_options=...,
+ ) -> None: ...
+ def CopyToProto(self, proto): ...
+
+class Descriptor(_NestedDescriptorBase):
+ fields: Any
+ fields_by_number: Any
+ fields_by_name: Any
+ nested_types: Any
+ nested_types_by_name: Any
+ enum_types: Any
+ enum_types_by_name: Any
+ enum_values_by_name: Any
+ extensions: Any
+ extensions_by_name: Any
+ is_extendable: Any
+ extension_ranges: Any
+ oneofs: Any
+ oneofs_by_name: Any
+ syntax: Any
+ def __init__(
+ self,
+ name: str,
+ full_name: str,
+ filename: Any,
+ containing_type: Descriptor | None,
+ fields: list[FieldDescriptor],
+ nested_types: list[FieldDescriptor],
+ enum_types: list[EnumDescriptor],
+ extensions: list[FieldDescriptor],
+ options: Incomplete | None = ...,
+ serialized_options: Incomplete | None = ...,
+ is_extendable: bool | None = ...,
+ extension_ranges: Incomplete | None = ...,
+ oneofs: list[OneofDescriptor] | None = ...,
+ file: FileDescriptor | None = ...,
+ serialized_start: Incomplete | None = ...,
+ serialized_end: Incomplete | None = ...,
+ syntax: str | None = ...,
+ create_key: Incomplete | None = ...,
+ ): ...
+ def EnumValueName(self, enum, value): ...
+ def CopyToProto(self, proto): ...
+ def GetOptions(self) -> MessageOptions: ...
+
+class FieldDescriptor(DescriptorBase):
+ TYPE_DOUBLE: Any
+ TYPE_FLOAT: Any
+ TYPE_INT64: Any
+ TYPE_UINT64: Any
+ TYPE_INT32: Any
+ TYPE_FIXED64: Any
+ TYPE_FIXED32: Any
+ TYPE_BOOL: Any
+ TYPE_STRING: Any
+ TYPE_GROUP: Any
+ TYPE_MESSAGE: Any
+ TYPE_BYTES: Any
+ TYPE_UINT32: Any
+ TYPE_ENUM: Any
+ TYPE_SFIXED32: Any
+ TYPE_SFIXED64: Any
+ TYPE_SINT32: Any
+ TYPE_SINT64: Any
+ MAX_TYPE: Any
+ CPPTYPE_INT32: Any
+ CPPTYPE_INT64: Any
+ CPPTYPE_UINT32: Any
+ CPPTYPE_UINT64: Any
+ CPPTYPE_DOUBLE: Any
+ CPPTYPE_FLOAT: Any
+ CPPTYPE_BOOL: Any
+ CPPTYPE_ENUM: Any
+ CPPTYPE_STRING: Any
+ CPPTYPE_MESSAGE: Any
+ MAX_CPPTYPE: Any
+ LABEL_OPTIONAL: Any
+ LABEL_REQUIRED: Any
+ LABEL_REPEATED: Any
+ MAX_LABEL: Any
+ MAX_FIELD_NUMBER: Any
+ FIRST_RESERVED_FIELD_NUMBER: Any
+ LAST_RESERVED_FIELD_NUMBER: Any
+ def __new__(
+ cls,
+ name,
+ full_name,
+ index,
+ number,
+ type,
+ cpp_type,
+ label,
+ default_value,
+ message_type,
+ enum_type,
+ containing_type,
+ is_extension,
+ extension_scope,
+ options=...,
+ serialized_options=...,
+ has_default_value=...,
+ containing_oneof=...,
+ json_name=...,
+ file=...,
+ create_key=...,
+ ): ...
+ name: Any
+ full_name: Any
+ index: Any
+ number: Any
+ type: Any
+ cpp_type: Any
+ label: Any
+ has_default_value: Any
+ default_value: Any
+ containing_type: Any
+ message_type: Any
+ enum_type: Any
+ is_extension: Any
+ extension_scope: Any
+ containing_oneof: Any
+ def __init__(
+ self,
+ name,
+ full_name,
+ index,
+ number,
+ type,
+ cpp_type,
+ label,
+ default_value,
+ message_type,
+ enum_type,
+ containing_type,
+ is_extension,
+ extension_scope,
+ options=...,
+ serialized_options=...,
+ has_default_value=...,
+ containing_oneof=...,
+ json_name=...,
+ file=...,
+ create_key=...,
+ ) -> None: ...
+ @staticmethod
+ def ProtoTypeToCppProtoType(proto_type): ...
+ def GetOptions(self) -> FieldOptions: ...
+
+class EnumDescriptor(_NestedDescriptorBase):
+ def __new__(
+ cls,
+ name,
+ full_name,
+ filename,
+ values,
+ containing_type=...,
+ options=...,
+ serialized_options=...,
+ file=...,
+ serialized_start=...,
+ serialized_end=...,
+ create_key=...,
+ ): ...
+ values: Any
+ values_by_name: Any
+ values_by_number: Any
+ def __init__(
+ self,
+ name,
+ full_name,
+ filename,
+ values,
+ containing_type=...,
+ options=...,
+ serialized_options=...,
+ file=...,
+ serialized_start=...,
+ serialized_end=...,
+ create_key=...,
+ ) -> None: ...
+ def CopyToProto(self, proto): ...
+ def GetOptions(self) -> EnumOptions: ...
+
+class EnumValueDescriptor(DescriptorBase):
+ def __new__(cls, name, index, number, type=..., options=..., serialized_options=..., create_key=...): ...
+ name: Any
+ index: Any
+ number: Any
+ type: Any
+ def __init__(self, name, index, number, type=..., options=..., serialized_options=..., create_key=...) -> None: ...
+ def GetOptions(self) -> EnumValueOptions: ...
+
+class OneofDescriptor:
+ def __new__(cls, name, full_name, index, containing_type, fields, options=..., serialized_options=..., create_key=...): ...
+ name: Any
+ full_name: Any
+ index: Any
+ containing_type: Any
+ fields: Any
+ def __init__(
+ self, name, full_name, index, containing_type, fields, options=..., serialized_options=..., create_key=...
+ ) -> None: ...
+ def GetOptions(self) -> OneofOptions: ...
+
+class ServiceDescriptor(_NestedDescriptorBase):
+ index: Any
+ methods: Any
+ methods_by_name: Any
+ def __init__(
+ self,
+ name: str,
+ full_name: str,
+ index: int,
+ methods: list[MethodDescriptor],
+ options: ServiceOptions | None = ...,
+ serialized_options: Incomplete | None = ...,
+ file: FileDescriptor | None = ...,
+ serialized_start: Incomplete | None = ...,
+ serialized_end: Incomplete | None = ...,
+ create_key: Incomplete | None = ...,
+ ): ...
+ def FindMethodByName(self, name): ...
+ def CopyToProto(self, proto): ...
+ def GetOptions(self) -> ServiceOptions: ...
+
+class MethodDescriptor(DescriptorBase):
+ def __new__(
+ cls,
+ name,
+ full_name,
+ index,
+ containing_service,
+ input_type,
+ output_type,
+ client_streaming=...,
+ server_streaming=...,
+ options=...,
+ serialized_options=...,
+ create_key=...,
+ ): ...
+ name: Any
+ full_name: Any
+ index: Any
+ containing_service: Any
+ input_type: Any
+ output_type: Any
+ client_streaming: bool
+ server_streaming: bool
+ def __init__(
+ self,
+ name,
+ full_name,
+ index,
+ containing_service,
+ input_type,
+ output_type,
+ client_streaming=...,
+ server_streaming=...,
+ options=...,
+ serialized_options=...,
+ create_key=...,
+ ) -> None: ...
+ def GetOptions(self) -> MethodOptions: ...
+
+class FileDescriptor(DescriptorBase):
+ def __new__(
+ cls,
+ name,
+ package,
+ options=...,
+ serialized_options=...,
+ serialized_pb=...,
+ dependencies=...,
+ public_dependencies=...,
+ syntax=...,
+ pool=...,
+ create_key=...,
+ ): ...
+ _options: Any
+ pool: Any
+ message_types_by_name: Any
+ name: Any
+ package: Any
+ syntax: Any
+ serialized_pb: Any
+ enum_types_by_name: Any
+ extensions_by_name: Any
+ services_by_name: Any
+ dependencies: Any
+ public_dependencies: Any
+ def __init__(
+ self,
+ name,
+ package,
+ options=...,
+ serialized_options=...,
+ serialized_pb=...,
+ dependencies=...,
+ public_dependencies=...,
+ syntax=...,
+ pool=...,
+ create_key=...,
+ ) -> None: ...
+ def CopyToProto(self, proto): ...
+ def GetOptions(self) -> FileOptions: ...
+
+def MakeDescriptor(desc_proto, package=..., build_file_if_cpp=..., syntax=...): ...
+def _ParseOptions(message: Message, string: bytes) -> Message: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/descriptor_pool.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/descriptor_pool.pyi
new file mode 100644
index 0000000000..00be66656d
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/descriptor_pool.pyi
@@ -0,0 +1,26 @@
+from _typeshed import Incomplete
+
+class DescriptorPool:
+ def __new__(cls, descriptor_db: Incomplete | None = ...): ...
+ def __init__( # pyright: ignore[reportInconsistentConstructor]
+ self, descriptor_db: Incomplete | None = ..., use_deprecated_legacy_json_field_conflicts: bool = ...
+ ) -> None: ...
+ def Add(self, file_desc_proto): ...
+ def AddSerializedFile(self, serialized_file_desc_proto): ...
+ def AddDescriptor(self, desc): ...
+ def AddServiceDescriptor(self, service_desc): ...
+ def AddExtensionDescriptor(self, extension): ...
+ def AddFileDescriptor(self, file_desc): ...
+ def FindFileByName(self, file_name): ...
+ def FindFileContainingSymbol(self, symbol): ...
+ def FindMessageTypeByName(self, full_name): ...
+ def FindEnumTypeByName(self, full_name): ...
+ def FindFieldByName(self, full_name): ...
+ def FindOneofByName(self, full_name): ...
+ def FindExtensionByName(self, full_name): ...
+ def FindExtensionByNumber(self, message_descriptor, number): ...
+ def FindAllExtensions(self, message_descriptor): ...
+ def FindServiceByName(self, full_name): ...
+ def FindMethodByName(self, full_name): ...
+
+def Default(): ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/__init__.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/__init__.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/__init__.pyi
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/api_implementation.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/api_implementation.pyi
new file mode 100644
index 0000000000..4940124ff9
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/api_implementation.pyi
@@ -0,0 +1,3 @@
+def Type() -> str: ...
+def Version() -> int: ...
+def IsPythonDefaultSerializationDeterministic() -> bool: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/builder.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/builder.pyi
new file mode 100644
index 0000000000..a0a72dec58
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/builder.pyi
@@ -0,0 +1,5 @@
+from _typeshed import Incomplete
+from typing import Any
+
+def BuildMessageAndEnumDescriptors(file_des: Incomplete, module: dict[str, Any]) -> None: ...
+def BuildTopDescriptorsAndMessages(file_des: Incomplete, module_name: str, module: dict[str, Any]) -> None: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi
new file mode 100644
index 0000000000..235ab25d61
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/containers.pyi
@@ -0,0 +1,100 @@
+from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
+from typing import Any, Protocol, SupportsIndex, TypeVar, overload
+
+from google.protobuf.descriptor import Descriptor
+from google.protobuf.internal.message_listener import MessageListener
+from google.protobuf.internal.python_message import GeneratedProtocolMessageType
+from google.protobuf.message import Message
+
+_T = TypeVar("_T")
+_K = TypeVar("_K", bound=bool | int | str)
+_ScalarV = TypeVar("_ScalarV", bound=bool | int | float | str | bytes)
+_MessageV = TypeVar("_MessageV", bound=Message)
+_M = TypeVar("_M")
+
+class _ValueChecker(Protocol[_T]):
+ def CheckValue(self, proposed_value: _T) -> _T: ...
+ def DefaultValue(self) -> _T: ...
+
+class BaseContainer(Sequence[_T]):
+ def __init__(self, message_listener: MessageListener) -> None: ...
+ def __len__(self) -> int: ...
+ def __ne__(self, other: object) -> bool: ...
+ def __hash__(self) -> int: ...
+ def sort(self, *, key: Callable[[_T], Any] | None = ..., reverse: bool = ...) -> None: ...
+ @overload
+ def __getitem__(self, key: SupportsIndex) -> _T: ...
+ @overload
+ def __getitem__(self, key: slice) -> list[_T]: ...
+
+class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]):
+ def __init__(self, message_listener: MessageListener, type_checker: _ValueChecker[_ScalarV]) -> None: ...
+ def append(self, value: _ScalarV) -> None: ...
+ def insert(self, key: int, value: _ScalarV) -> None: ...
+ def extend(self, elem_seq: Iterable[_ScalarV] | None) -> None: ...
+ def MergeFrom(self: _M, other: _M) -> None: ...
+ def remove(self, elem: _ScalarV) -> None: ...
+ def pop(self, key: int = ...) -> _ScalarV: ...
+ @overload
+ def __setitem__(self, key: int, value: _ScalarV) -> None: ...
+ @overload
+ def __setitem__(self, key: slice, value: Iterable[_ScalarV]) -> None: ...
+ def __delitem__(self, key: int | slice) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+
+class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]):
+ def __init__(self, message_listener: MessageListener, message_descriptor: Descriptor) -> None: ...
+ def add(self, **kwargs: Any) -> _MessageV: ...
+ def append(self, value: _MessageV) -> None: ...
+ def insert(self, key: int, value: _MessageV) -> None: ...
+ def extend(self, elem_seq: Iterable[_MessageV]) -> None: ...
+ def MergeFrom(self: _M, other: _M) -> None: ...
+ def remove(self, elem: _MessageV) -> None: ...
+ def pop(self, key: int = ...) -> _MessageV: ...
+ def __delitem__(self, key: int | slice) -> None: ...
+ def __eq__(self, other: object) -> bool: ...
+
+class ScalarMap(MutableMapping[_K, _ScalarV]):
+ def __init__(
+ self,
+ message_listener: MessageListener,
+ key_checker: _ValueChecker[_K],
+ value_checker: _ValueChecker[_ScalarV],
+ entry_descriptor: Descriptor,
+ ) -> None: ...
+ def __setitem__(self, k: _K, v: _ScalarV) -> None: ...
+ def __delitem__(self, v: _K) -> None: ...
+ def __getitem__(self, k: _K) -> _ScalarV: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[_K]: ...
+ def __eq__(self, other: object) -> bool: ...
+ @overload
+ def get(self, key: _K, default: None = ...) -> _ScalarV | None: ...
+ @overload
+ def get(self, key: _K, default: _ScalarV | _T) -> _ScalarV | _T: ...
+ def MergeFrom(self: _M, other: _M): ...
+ def InvalidateIterators(self) -> None: ...
+ def GetEntryClass(self) -> GeneratedProtocolMessageType: ...
+
+class MessageMap(MutableMapping[_K, _MessageV]):
+ def __init__(
+ self,
+ message_listener: MessageListener,
+ message_descriptor: Descriptor,
+ key_checker: _ValueChecker[_K],
+ entry_descriptor: Descriptor,
+ ) -> None: ...
+ def __setitem__(self, k: _K, v: _MessageV) -> None: ...
+ def __delitem__(self, v: _K) -> None: ...
+ def __getitem__(self, k: _K) -> _MessageV: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[_K]: ...
+ def __eq__(self, other: object) -> bool: ...
+ @overload
+ def get(self, key: _K, default: None = ...) -> _MessageV | None: ...
+ @overload
+ def get(self, key: _K, default: _MessageV | _T) -> _MessageV | _T: ...
+ def get_or_create(self, key: _K) -> _MessageV: ...
+ def MergeFrom(self: _M, other: _M): ...
+ def InvalidateIterators(self) -> None: ...
+ def GetEntryClass(self) -> GeneratedProtocolMessageType: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/decoder.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/decoder.pyi
new file mode 100644
index 0000000000..41a50035b5
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/decoder.pyi
@@ -0,0 +1,63 @@
+from collections.abc import Callable
+from typing import Any
+from typing_extensions import TypeAlias
+
+from google.protobuf.descriptor import Descriptor, FieldDescriptor
+from google.protobuf.message import Message
+
+_Decoder: TypeAlias = Callable[[str, int, int, Message, dict[FieldDescriptor, Any]], int]
+_NewDefault: TypeAlias = Callable[[Message], Message]
+
+def ReadTag(buffer, pos): ...
+
+Int32Decoder: _Decoder
+Int64Decoder: _Decoder
+UInt32Decoder: _Decoder
+UInt64Decoder: _Decoder
+SInt32Decoder: _Decoder
+SInt64Decoder: _Decoder
+Fixed32Decoder: _Decoder
+Fixed64Decoder: _Decoder
+SFixed32Decoder: _Decoder
+SFixed64Decoder: _Decoder
+FloatDecoder: _Decoder
+DoubleDecoder: _Decoder
+BoolDecoder: _Decoder
+
+def EnumDecoder(
+ field_number: int,
+ is_repeated: bool,
+ is_packed: bool,
+ key: FieldDescriptor,
+ new_default: _NewDefault,
+ clear_if_default: bool = ...,
+) -> _Decoder: ...
+def StringDecoder(
+ field_number: int,
+ is_repeated: bool,
+ is_packed: bool,
+ key: FieldDescriptor,
+ new_default: _NewDefault,
+ clear_if_default: bool = ...,
+) -> _Decoder: ...
+def BytesDecoder(
+ field_number: int,
+ is_repeated: bool,
+ is_packed: bool,
+ key: FieldDescriptor,
+ new_default: _NewDefault,
+ clear_if_default: bool = ...,
+) -> _Decoder: ...
+def GroupDecoder(
+ field_number: int, is_repeated: bool, is_packed: bool, key: FieldDescriptor, new_default: _NewDefault
+) -> _Decoder: ...
+def MessageDecoder(
+ field_number: int, is_repeated: bool, is_packed: bool, key: FieldDescriptor, new_default: _NewDefault
+) -> _Decoder: ...
+
+MESSAGE_SET_ITEM_TAG: bytes
+
+def MessageSetItemDecoder(descriptor: Descriptor) -> _Decoder: ...
+def MapDecoder(field_descriptor, new_default, is_message_map) -> _Decoder: ...
+
+SkipField: Any
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/encoder.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/encoder.pyi
new file mode 100644
index 0000000000..278478edb3
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/encoder.pyi
@@ -0,0 +1,41 @@
+from collections.abc import Callable
+from typing_extensions import TypeAlias
+
+from google.protobuf.descriptor import FieldDescriptor
+
+_Sizer: TypeAlias = Callable[[int, bool, bool], int]
+
+Int32Sizer: _Sizer
+UInt32Sizer: _Sizer
+SInt32Sizer: _Sizer
+Fixed32Sizer: _Sizer
+Fixed64Sizer: _Sizer
+BoolSizer: _Sizer
+
+def StringSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ...
+def BytesSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ...
+def GroupSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ...
+def MessageSizer(field_number: int, is_repeated: bool, is_packed: bool) -> _Sizer: ...
+def MessageSetItemSizer(field_number: int) -> _Sizer: ...
+def MapSizer(field_descriptor: FieldDescriptor, is_message_map: bool) -> _Sizer: ...
+def TagBytes(field_number: int, wire_type: int) -> bytes: ...
+
+_Encoder: TypeAlias = Callable[[Callable[[bytes], int], bytes, bool], int]
+
+Int32Encoder: _Encoder
+UInt32Encoder: _Encoder
+SInt32Encoder: _Encoder
+Fixed32Encoder: _Encoder
+Fixed64Encoder: _Encoder
+SFixed32Encoder: _Encoder
+SFixed64Encoder: _Encoder
+FloatEncoder: _Encoder
+DoubleEncoder: _Encoder
+
+def BoolEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ...
+def StringEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ...
+def BytesEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ...
+def GroupEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ...
+def MessageEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder: ...
+def MessageSetItemEncoder(field_number: int) -> _Encoder: ...
+def MapEncoder(field_descriptor: FieldDescriptor) -> _Encoder: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/enum_type_wrapper.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/enum_type_wrapper.pyi
new file mode 100644
index 0000000000..95b5b4bb25
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/enum_type_wrapper.pyi
@@ -0,0 +1,21 @@
+from typing import Generic, TypeVar
+
+from google.protobuf.descriptor import EnumDescriptor
+
+_V = TypeVar("_V", bound=int)
+
+# Expose a generic version so that those using mypy-protobuf
+# can get autogenerated NewType wrapper around the int values
+# NOTE: this doesn't actually inherit from type,
+# but mypy doesn't support metaclasses that don't inherit from type,
+# so we pretend it does in the stubs...
+class _EnumTypeWrapper(type, Generic[_V]):
+ DESCRIPTOR: EnumDescriptor
+ def __init__(self, enum_type: EnumDescriptor) -> None: ...
+ def Name(self, number: _V) -> str: ...
+ def Value(self, name: str | bytes) -> _V: ...
+ def keys(self) -> list[str]: ...
+ def values(self) -> list[_V]: ...
+ def items(self) -> list[tuple[str, _V]]: ...
+
+class EnumTypeWrapper(_EnumTypeWrapper[int]): ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/extension_dict.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/extension_dict.pyi
new file mode 100644
index 0000000000..ecf56a360d
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/extension_dict.pyi
@@ -0,0 +1,27 @@
+from collections.abc import Iterator
+from typing import Any, Generic, TypeVar
+
+from google.protobuf.descriptor import FieldDescriptor
+from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer
+from google.protobuf.message import Message
+
+_ContainerMessageT = TypeVar("_ContainerMessageT", bound=Message)
+_ExtenderMessageT = TypeVar(
+ "_ExtenderMessageT",
+ bound=Message | RepeatedScalarFieldContainer[Any] | RepeatedCompositeFieldContainer[Any] | bool | float | str | bytes,
+)
+
+class _ExtensionFieldDescriptor(FieldDescriptor, Generic[_ContainerMessageT, _ExtenderMessageT]): ...
+
+class _ExtensionDict(Generic[_ContainerMessageT]):
+ def __init__(self, extended_message: _ContainerMessageT) -> None: ...
+ def __getitem__(
+ self, extension_handle: _ExtensionFieldDescriptor[_ContainerMessageT, _ExtenderMessageT]
+ ) -> _ExtenderMessageT: ...
+ def __setitem__(
+ self, extension_handle: _ExtensionFieldDescriptor[_ContainerMessageT, _ExtenderMessageT], value: _ExtenderMessageT
+ ) -> None: ...
+ def __delitem__(self, extension_handle: _ExtensionFieldDescriptor[_ContainerMessageT, _ExtenderMessageT]) -> None: ...
+ def __contains__(self, extension_handle: _ExtensionFieldDescriptor[_ContainerMessageT, _ExtenderMessageT]) -> bool: ...
+ def __iter__(self) -> Iterator[_ExtensionFieldDescriptor[_ContainerMessageT, Any]]: ...
+ def __len__(self) -> int: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/message_listener.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/message_listener.pyi
new file mode 100644
index 0000000000..01c3be010c
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/message_listener.pyi
@@ -0,0 +1,5 @@
+class MessageListener:
+ def Modified(self) -> None: ...
+
+class NullMessageListener(MessageListener):
+ def Modified(self) -> None: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/python_message.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/python_message.pyi
new file mode 100644
index 0000000000..0395ff6470
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/python_message.pyi
@@ -0,0 +1,3 @@
+class GeneratedProtocolMessageType(type):
+ def __new__(cls, name, bases, dictionary): ...
+ def __init__(cls, name, bases, dictionary): ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/type_checkers.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/type_checkers.pyi
new file mode 100644
index 0000000000..e050e95587
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/type_checkers.pyi
@@ -0,0 +1,11 @@
+from typing import Generic, TypeVar
+
+_T = TypeVar("_T")
+
+class TypeChecker(Generic[_T]):
+ def __init__(self, *acceptable_types: _T): ...
+ def CheckValue(self, proposed_value: _T) -> _T: ...
+
+class TypeCheckerWithDefault(TypeChecker[_T]):
+ def __init__(self, default_value: _T, *acceptable_types: _T): ...
+ def DefaultValue(self) -> _T: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi
new file mode 100644
index 0000000000..e257cf0529
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/well_known_types.pyi
@@ -0,0 +1,103 @@
+from _typeshed import Incomplete, SupportsItems
+from collections.abc import Iterable, Iterator, KeysView, Mapping, Sequence
+from datetime import datetime, timedelta, tzinfo
+from typing import Any as tAny
+from typing_extensions import TypeAlias
+
+from google.protobuf import struct_pb2
+
+class Any:
+ type_url: str
+ value: Incomplete
+ def Pack(
+ self, msg: Incomplete, type_url_prefix: str = "type.googleapis.com/", deterministic: Incomplete | None = None
+ ) -> None: ...
+ def Unpack(self, msg: Incomplete) -> bool: ...
+ def TypeName(self) -> str: ...
+ def Is(self, descriptor: Incomplete) -> bool: ...
+
+class Timestamp:
+ def ToJsonString(self) -> str: ...
+ seconds: int
+ nanos: int
+ def FromJsonString(self, value: str) -> None: ...
+ def GetCurrentTime(self) -> None: ...
+ def ToNanoseconds(self) -> int: ...
+ def ToMicroseconds(self) -> int: ...
+ def ToMilliseconds(self) -> int: ...
+ def ToSeconds(self) -> int: ...
+ def FromNanoseconds(self, nanos: int) -> None: ...
+ def FromMicroseconds(self, micros: int) -> None: ...
+ def FromMilliseconds(self, millis: int) -> None: ...
+ def FromSeconds(self, seconds: int) -> None: ...
+ def ToDatetime(self, tzinfo: tzinfo | None = ...) -> datetime: ...
+ def FromDatetime(self, dt: datetime) -> None: ...
+
+class Duration:
+ def ToJsonString(self) -> str: ...
+ seconds: int
+ nanos: int
+ def FromJsonString(self, value: tAny) -> None: ...
+ def ToNanoseconds(self) -> int: ...
+ def ToMicroseconds(self) -> int: ...
+ def ToMilliseconds(self) -> int: ...
+ def ToSeconds(self) -> int: ...
+ def FromNanoseconds(self, nanos: int) -> None: ...
+ def FromMicroseconds(self, micros: int) -> None: ...
+ def FromMilliseconds(self, millis: int) -> None: ...
+ def FromSeconds(self, seconds: int) -> None: ...
+ def ToTimedelta(self) -> timedelta: ...
+ def FromTimedelta(self, td: timedelta) -> None: ...
+
+class FieldMask:
+ def ToJsonString(self) -> str: ...
+ def FromJsonString(self, value: tAny) -> None: ...
+ def IsValidForDescriptor(self, message_descriptor: tAny): ...
+ def AllFieldsFromDescriptor(self, message_descriptor: tAny) -> None: ...
+ def CanonicalFormFromMask(self, mask: tAny) -> None: ...
+ def Union(self, mask1: tAny, mask2: tAny) -> None: ...
+ def Intersect(self, mask1: tAny, mask2: tAny) -> None: ...
+ def MergeMessage(
+ self, source: tAny, destination: tAny, replace_message_field: bool = ..., replace_repeated_field: bool = ...
+ ) -> None: ...
+
+class _FieldMaskTree:
+ def __init__(self, field_mask: Incomplete | None = ...) -> None: ...
+ def MergeFromFieldMask(self, field_mask: tAny) -> None: ...
+ def AddPath(self, path: tAny): ...
+ def ToFieldMask(self, field_mask: tAny) -> None: ...
+ def IntersectPath(self, path: tAny, intersection: tAny): ...
+ def AddLeafNodes(self, prefix: tAny, node: tAny) -> None: ...
+ def MergeMessage(self, source: tAny, destination: tAny, replace_message: tAny, replace_repeated: tAny) -> None: ...
+
+_StructValue: TypeAlias = struct_pb2.Struct | struct_pb2.ListValue | str | float | bool | None
+_StructValueArg: TypeAlias = _StructValue | Mapping[str, _StructValueArg] | Sequence[_StructValueArg]
+
+class Struct:
+ def __getitem__(self, key: str) -> _StructValue: ...
+ def __contains__(self, item: object) -> bool: ...
+ def __setitem__(self, key: str, value: _StructValueArg) -> None: ...
+ def __delitem__(self, key: str) -> None: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[str]: ...
+ def keys(self) -> KeysView[str]: ...
+ def values(self) -> list[_StructValue]: ...
+ def items(self) -> list[tuple[str, _StructValue]]: ...
+ def get_or_create_list(self, key: str) -> struct_pb2.ListValue: ...
+ def get_or_create_struct(self, key: str) -> struct_pb2.Struct: ...
+ def update(self, dictionary: SupportsItems[str, _StructValueArg]) -> None: ...
+
+class ListValue:
+ def __len__(self) -> int: ...
+ def append(self, value: _StructValue) -> None: ...
+ def extend(self, elem_seq: Iterable[_StructValue]) -> None: ...
+ def __getitem__(self, index: int) -> _StructValue: ...
+ def __setitem__(self, index: int, value: _StructValueArg) -> None: ...
+ def __delitem__(self, key: int) -> None: ...
+ # Doesn't actually exist at runtime; needed so type checkers understand the class is iterable
+ def __iter__(self) -> Iterator[_StructValue]: ...
+ def items(self) -> Iterator[_StructValue]: ...
+ def add_struct(self) -> struct_pb2.Struct: ...
+ def add_list(self) -> struct_pb2.ListValue: ...
+
+WKTBASES: dict[str, type[tAny]]
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/internal/wire_format.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/internal/wire_format.pyi
new file mode 100644
index 0000000000..3dcbd04324
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/internal/wire_format.pyi
@@ -0,0 +1,50 @@
+from typing import Any
+
+TAG_TYPE_BITS: Any
+TAG_TYPE_MASK: Any
+WIRETYPE_VARINT: Any
+WIRETYPE_FIXED64: Any
+WIRETYPE_LENGTH_DELIMITED: Any
+WIRETYPE_START_GROUP: Any
+WIRETYPE_END_GROUP: Any
+WIRETYPE_FIXED32: Any
+INT32_MAX: Any
+INT32_MIN: Any
+UINT32_MAX: Any
+INT64_MAX: Any
+INT64_MIN: Any
+UINT64_MAX: Any
+FORMAT_UINT32_LITTLE_ENDIAN: Any
+FORMAT_UINT64_LITTLE_ENDIAN: Any
+FORMAT_FLOAT_LITTLE_ENDIAN: Any
+FORMAT_DOUBLE_LITTLE_ENDIAN: Any
+
+def PackTag(field_number, wire_type): ...
+def UnpackTag(tag): ...
+def ZigZagEncode(value): ...
+def ZigZagDecode(value): ...
+def Int32ByteSize(field_number, int32): ...
+def Int32ByteSizeNoTag(int32): ...
+def Int64ByteSize(field_number, int64): ...
+def UInt32ByteSize(field_number, uint32): ...
+def UInt64ByteSize(field_number, uint64): ...
+def SInt32ByteSize(field_number, int32): ...
+def SInt64ByteSize(field_number, int64): ...
+def Fixed32ByteSize(field_number, fixed32): ...
+def Fixed64ByteSize(field_number, fixed64): ...
+def SFixed32ByteSize(field_number, sfixed32): ...
+def SFixed64ByteSize(field_number, sfixed64): ...
+def FloatByteSize(field_number, flt): ...
+def DoubleByteSize(field_number, double): ...
+def BoolByteSize(field_number, b): ...
+def EnumByteSize(field_number, enum): ...
+def StringByteSize(field_number, string): ...
+def BytesByteSize(field_number, b): ...
+def GroupByteSize(field_number, message): ...
+def MessageByteSize(field_number, message): ...
+def MessageSetItemByteSize(field_number, msg): ...
+def TagByteSize(field_number): ...
+
+NON_PACKABLE_TYPES: Any
+
+def IsTypePackable(field_type): ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/json_format.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/json_format.pyi
new file mode 100644
index 0000000000..62ad1bad2e
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/json_format.pyi
@@ -0,0 +1,44 @@
+from typing import Any, TypeVar
+
+from google.protobuf.descriptor_pool import DescriptorPool
+from google.protobuf.message import Message
+
+_MessageT = TypeVar("_MessageT", bound=Message)
+
+class Error(Exception): ...
+class ParseError(Error): ...
+class SerializeToJsonError(Error): ...
+
+def MessageToJson(
+ message: Message,
+ including_default_value_fields: bool = ...,
+ preserving_proto_field_name: bool = ...,
+ indent: int | None = ...,
+ sort_keys: bool = ...,
+ use_integers_for_enums: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ float_precision: int | None = ...,
+ ensure_ascii: bool = ...,
+) -> str: ...
+def MessageToDict(
+ message: Message,
+ including_default_value_fields: bool = ...,
+ preserving_proto_field_name: bool = ...,
+ use_integers_for_enums: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ float_precision: int | None = ...,
+) -> dict[str, Any]: ...
+def Parse(
+ text: bytes | str,
+ message: _MessageT,
+ ignore_unknown_fields: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ max_recursion_depth: int = ...,
+) -> _MessageT: ...
+def ParseDict(
+ js_dict: Any,
+ message: _MessageT,
+ ignore_unknown_fields: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ max_recursion_depth: int = ...,
+) -> _MessageT: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/message.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/message.pyi
new file mode 100644
index 0000000000..64448454fc
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/message.pyi
@@ -0,0 +1,46 @@
+from collections.abc import Sequence
+from typing import Any, TypeVar
+from typing_extensions import Self
+
+from .descriptor import Descriptor, FieldDescriptor
+from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor
+
+class Error(Exception): ...
+class DecodeError(Error): ...
+class EncodeError(Error): ...
+
+_M = TypeVar("_M", bound=Message) # message type (of self)
+
+class Message:
+ DESCRIPTOR: Descriptor
+ def __deepcopy__(self, memo: Any = ...) -> Self: ...
+ def __eq__(self, other_msg): ...
+ def __ne__(self, other_msg): ...
+ def MergeFrom(self, other_msg: Self) -> None: ...
+ def CopyFrom(self, other_msg: Self) -> None: ...
+ def Clear(self) -> None: ...
+ def SetInParent(self) -> None: ...
+ def IsInitialized(self) -> bool: ...
+ def MergeFromString(self, serialized: bytes) -> int: ...
+ def ParseFromString(self, serialized: bytes) -> int: ...
+ def SerializeToString(self, deterministic: bool = ...) -> bytes: ...
+ def SerializePartialToString(self, deterministic: bool = ...) -> bytes: ...
+ def ListFields(self) -> Sequence[tuple[FieldDescriptor, Any]]: ...
+ # The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `HasExtension` & `ClearExtension`
+ def HasExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> bool: ...
+ def ClearExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> None: ...
+ # The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `Extensions`
+ @property
+ def Extensions(self: _M) -> _ExtensionDict[_M]: ...
+ def ByteSize(self) -> int: ...
+ @classmethod
+ def FromString(cls, s: bytes) -> Self: ...
+ # Intentionally left out typing on these three methods, because they are
+ # stringly typed and it is not useful to call them on a Message directly.
+ # We prefer more specific typing on individual subclasses of Message
+ # See https://github.com/dropbox/mypy-protobuf/issues/62 for details
+ def HasField(self, field_name: Any) -> bool: ...
+ def ClearField(self, field_name: Any) -> None: ...
+ def WhichOneof(self, oneof_group: Any) -> Any: ...
+ # TODO: check kwargs
+ def __init__(self, *args, **kwargs) -> None: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/message_factory.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/message_factory.pyi
new file mode 100644
index 0000000000..e9009393aa
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/message_factory.pyi
@@ -0,0 +1,17 @@
+from collections.abc import Iterable
+from typing import Any
+
+from google.protobuf.descriptor import Descriptor
+from google.protobuf.descriptor_pb2 import FileDescriptorProto
+from google.protobuf.descriptor_pool import DescriptorPool
+from google.protobuf.message import Message
+
+class MessageFactory:
+ pool: Any
+ def __init__(self, pool: DescriptorPool | None = ...) -> None: ...
+ def GetPrototype(self, descriptor: Descriptor) -> type[Message]: ...
+ def GetMessages(self, files: Iterable[str]) -> dict[str, type[Message]]: ...
+
+def GetMessageClass(descriptor: Descriptor) -> type[Message]: ...
+def GetMessageClassesForFiles(files: Iterable[str], pool: DescriptorPool) -> dict[str, type[Message]]: ...
+def GetMessages(file_protos: Iterable[FileDescriptorProto], pool: DescriptorPool | None = ...) -> dict[str, type[Message]]: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/reflection.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/reflection.pyi
new file mode 100644
index 0000000000..4bfbd2f4ce
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/reflection.pyi
@@ -0,0 +1,6 @@
+class GeneratedProtocolMessageType(type):
+ def __new__(cls, name, bases, dictionary): ...
+ def __init__(__self, name, bases, dictionary) -> None: ...
+
+def ParseMessage(descriptor, byte_str): ...
+def MakeClass(descriptor): ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/service.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/service.pyi
new file mode 100644
index 0000000000..1123b6134d
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/service.pyi
@@ -0,0 +1,39 @@
+from collections.abc import Callable
+from concurrent.futures import Future
+
+from google.protobuf.descriptor import MethodDescriptor, ServiceDescriptor
+from google.protobuf.message import Message
+
+class RpcException(Exception): ...
+
+class Service:
+ @staticmethod
+ def GetDescriptor() -> ServiceDescriptor: ...
+ def CallMethod(
+ self,
+ method_descriptor: MethodDescriptor,
+ rpc_controller: RpcController,
+ request: Message,
+ done: Callable[[Message], None] | None,
+ ) -> Future[Message] | None: ...
+ def GetRequestClass(self, method_descriptor: MethodDescriptor) -> type[Message]: ...
+ def GetResponseClass(self, method_descriptor: MethodDescriptor) -> type[Message]: ...
+
+class RpcController:
+ def Reset(self) -> None: ...
+ def Failed(self) -> bool: ...
+ def ErrorText(self) -> str | None: ...
+ def StartCancel(self) -> None: ...
+ def SetFailed(self, reason: str) -> None: ...
+ def IsCanceled(self) -> bool: ...
+ def NotifyOnCancel(self, callback: Callable[[], None]) -> None: ...
+
+class RpcChannel:
+ def CallMethod(
+ self,
+ method_descriptor: MethodDescriptor,
+ rpc_controller: RpcController,
+ request: Message,
+ response_class: type[Message],
+ done: Callable[[Message], None] | None,
+ ) -> Future[Message] | None: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/symbol_database.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/symbol_database.pyi
new file mode 100644
index 0000000000..c595d9c525
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/symbol_database.pyi
@@ -0,0 +1,16 @@
+from collections.abc import Iterable
+
+from google.protobuf.descriptor import Descriptor, EnumDescriptor, FileDescriptor, ServiceDescriptor
+from google.protobuf.message import Message
+from google.protobuf.message_factory import MessageFactory
+
+class SymbolDatabase(MessageFactory):
+ def RegisterMessage(self, message: type[Message] | Message) -> type[Message] | Message: ...
+ def RegisterMessageDescriptor(self, message_descriptor: Descriptor) -> None: ...
+ def RegisterEnumDescriptor(self, enum_descriptor: EnumDescriptor) -> EnumDescriptor: ...
+ def RegisterServiceDescriptor(self, service_descriptor: ServiceDescriptor) -> None: ...
+ def RegisterFileDescriptor(self, file_descriptor: FileDescriptor) -> None: ...
+ def GetSymbol(self, symbol: str) -> type[Message]: ...
+ def GetMessages(self, files: Iterable[str]) -> dict[str, type[Message]]: ...
+
+def Default() -> SymbolDatabase: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/text_format.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/text_format.pyi
new file mode 100644
index 0000000000..593739c94f
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/text_format.pyi
@@ -0,0 +1,216 @@
+from _typeshed import SupportsWrite
+from collections.abc import Callable, Iterable
+from typing import Any, TypeVar
+from typing_extensions import TypeAlias
+
+from .descriptor import FieldDescriptor
+from .descriptor_pool import DescriptorPool
+from .message import Message
+
+_M = TypeVar("_M", bound=Message) # message type (of self)
+
+class Error(Exception): ...
+
+class ParseError(Error):
+ def __init__(self, message: str | None = ..., line: int | None = ..., column: int | None = ...) -> None: ...
+ def GetLine(self) -> int | None: ...
+ def GetColumn(self) -> int | None: ...
+
+class TextWriter:
+ def __init__(self, as_utf8: bool) -> None: ...
+ def write(self, val: str) -> int: ...
+ def getvalue(self) -> str: ...
+ def close(self) -> None: ...
+
+_MessageFormatter: TypeAlias = Callable[[Message, int, bool], str | None]
+
+def MessageToString(
+ message: Message,
+ as_utf8: bool = ...,
+ as_one_line: bool = ...,
+ use_short_repeated_primitives: bool = ...,
+ pointy_brackets: bool = ...,
+ use_index_order: bool = ...,
+ float_format: str | None = ...,
+ double_format: str | None = ...,
+ use_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ indent: int = ...,
+ message_formatter: _MessageFormatter | None = ...,
+ print_unknown_fields: bool = ...,
+ force_colon: bool = ...,
+) -> str: ...
+def MessageToBytes(
+ message: Message,
+ as_utf8: bool = ...,
+ as_one_line: bool = ...,
+ use_short_repeated_primitives: bool = ...,
+ pointy_brackets: bool = ...,
+ use_index_order: bool = ...,
+ float_format: str | None = ...,
+ double_format: str | None = ...,
+ use_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ indent: int = ...,
+ message_formatter: _MessageFormatter = ...,
+ print_unknown_fields: bool = ...,
+ force_colon: bool = ...,
+) -> bytes: ...
+def PrintMessage(
+ message: Message,
+ out: SupportsWrite[str],
+ indent: int = ...,
+ as_utf8: bool = ...,
+ as_one_line: bool = ...,
+ use_short_repeated_primitives: bool = ...,
+ pointy_brackets: bool = ...,
+ use_index_order: bool = ...,
+ float_format: str | None = ...,
+ double_format: str | None = ...,
+ use_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ message_formatter: _MessageFormatter | None = ...,
+ print_unknown_fields: bool = ...,
+ force_colon: bool = ...,
+) -> None: ...
+def PrintField(
+ field: FieldDescriptor,
+ value: Any,
+ out: SupportsWrite[str],
+ indent: int = ...,
+ as_utf8: bool = ...,
+ as_one_line: bool = ...,
+ use_short_repeated_primitives: bool = ...,
+ pointy_brackets: bool = ...,
+ use_index_order: bool = ...,
+ float_format: str | None = ...,
+ double_format: str | None = ...,
+ message_formatter: _MessageFormatter | None = ...,
+ print_unknown_fields: bool = ...,
+ force_colon: bool = ...,
+) -> None: ...
+def PrintFieldValue(
+ field: FieldDescriptor,
+ value: Any,
+ out: SupportsWrite[str],
+ indent: int = ...,
+ as_utf8: bool = ...,
+ as_one_line: bool = ...,
+ use_short_repeated_primitives: bool = ...,
+ pointy_brackets: bool = ...,
+ use_index_order: bool = ...,
+ float_format: str | None = ...,
+ double_format: str | None = ...,
+ message_formatter: _MessageFormatter | None = ...,
+ print_unknown_fields: bool = ...,
+ force_colon: bool = ...,
+) -> None: ...
+
+class _Printer:
+ out: SupportsWrite[str]
+ indent: int
+ as_utf8: bool
+ as_one_line: bool
+ use_short_repeated_primitives: bool
+ pointy_brackets: bool
+ use_index_order: bool
+ float_format: str | None
+ double_format: str | None
+ use_field_number: bool
+ descriptor_pool: DescriptorPool | None
+ message_formatter: _MessageFormatter | None
+ print_unknown_fields: bool
+ force_colon: bool
+ def __init__(
+ self,
+ out: SupportsWrite[str],
+ indent: int = ...,
+ as_utf8: bool = ...,
+ as_one_line: bool = ...,
+ use_short_repeated_primitives: bool = ...,
+ pointy_brackets: bool = ...,
+ use_index_order: bool = ...,
+ float_format: str | None = ...,
+ double_format: str | None = ...,
+ use_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ message_formatter: _MessageFormatter | None = ...,
+ print_unknown_fields: bool = ...,
+ force_colon: bool = ...,
+ ) -> None: ...
+ def PrintMessage(self, message: Message) -> None: ...
+ def PrintField(self, field: FieldDescriptor, value: Any) -> None: ...
+ def PrintFieldValue(self, field: FieldDescriptor, value: Any) -> None: ...
+
+def Parse(
+ text: str | bytes,
+ message: _M,
+ allow_unknown_extension: bool = ...,
+ allow_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ allow_unknown_field: bool = ...,
+) -> _M: ...
+def Merge(
+ text: str | bytes,
+ message: _M,
+ allow_unknown_extension: bool = ...,
+ allow_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ allow_unknown_field: bool = ...,
+) -> _M: ...
+def MergeLines(
+ lines: Iterable[str | bytes],
+ message: _M,
+ allow_unknown_extension: bool = ...,
+ allow_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ allow_unknown_field: bool = ...,
+) -> _M: ...
+
+class _Parser:
+ allow_unknown_extension: bool
+ allow_field_number: bool
+ descriptor_pool: DescriptorPool | None
+ allow_unknown_field: bool
+ def __init__(
+ self,
+ allow_unknown_extension: bool = ...,
+ allow_field_number: bool = ...,
+ descriptor_pool: DescriptorPool | None = ...,
+ allow_unknown_field: bool = ...,
+ ) -> None: ...
+ def ParseLines(self, lines: Iterable[str | bytes], message: _M) -> _M: ...
+ def MergeLines(self, lines: Iterable[str | bytes], message: _M) -> _M: ...
+
+_ParseError: TypeAlias = ParseError
+
+class Tokenizer:
+ token: str
+ def __init__(self, lines: Iterable[str], skip_comments: bool = True) -> None: ...
+ def LookingAt(self, token: str) -> bool: ...
+ def AtEnd(self) -> bool: ...
+ def TryConsume(self, token: str) -> bool: ...
+ def Consume(self, token: str) -> None: ...
+ def ConsumeComment(self) -> str: ...
+ def ConsumeCommentOrTrailingComment(self) -> tuple[bool, str]: ...
+ def TryConsumeIdentifier(self) -> bool: ...
+ def ConsumeIdentifier(self) -> str: ...
+ def TryConsumeIdentifierOrNumber(self) -> bool: ...
+ def ConsumeIdentifierOrNumber(self) -> str: ...
+ def TryConsumeInteger(self) -> bool: ...
+ def ConsumeInteger(self) -> int: ...
+ def TryConsumeFloat(self) -> bool: ...
+ def ConsumeFloat(self) -> float: ...
+ def ConsumeBool(self) -> bool: ...
+ def TryConsumeByteString(self) -> bool: ...
+ def ConsumeString(self) -> str: ...
+ def ConsumeByteString(self) -> bytes: ...
+ def ConsumeEnum(self, field: FieldDescriptor) -> int: ...
+ def ParseErrorPreviousToken(self, message: Message) -> _ParseError: ...
+ def ParseError(self, message: Message) -> _ParseError: ...
+ def NextToken(self) -> None: ...
+
+def ParseInteger(text: str, is_signed: bool = ..., is_long: bool = ...) -> int: ...
+def ParseFloat(text: str) -> float: ...
+def ParseBool(text: str) -> bool: ...
+def ParseEnum(field: FieldDescriptor, value: str) -> int: ...
diff --git a/contrib/python/types-protobuf/google-stubs/protobuf/util/__init__.pyi b/contrib/python/types-protobuf/google-stubs/protobuf/util/__init__.pyi
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/python/types-protobuf/google-stubs/protobuf/util/__init__.pyi
diff --git a/contrib/python/yarl/yarl/__init__.pyi b/contrib/python/yarl/yarl/__init__.pyi
new file mode 100644
index 0000000000..5fd4bd0d12
--- /dev/null
+++ b/contrib/python/yarl/yarl/__init__.pyi
@@ -0,0 +1,121 @@
+import sys
+from functools import _CacheInfo
+from typing import Any, Mapping, Optional, Sequence, Tuple, Type, Union, overload
+
+import multidict
+
+if sys.version_info >= (3, 8):
+ from typing import Final, TypedDict, final
+else:
+ from typing_extensions import Final, TypedDict, final
+
+_SimpleQuery = Union[str, int, float]
+_QueryVariable = Union[_SimpleQuery, Sequence[_SimpleQuery]]
+_Query = Union[
+ None, str, Mapping[str, _QueryVariable], Sequence[Tuple[str, _QueryVariable]]
+]
+
+@final
+class URL:
+ scheme: Final[str]
+ raw_user: Final[str]
+ user: Final[Optional[str]]
+ raw_password: Final[Optional[str]]
+ password: Final[Optional[str]]
+ raw_host: Final[Optional[str]]
+ host: Final[Optional[str]]
+ port: Final[Optional[int]]
+ explicit_port: Final[Optional[int]]
+ raw_authority: Final[str]
+ authority: Final[str]
+ raw_path: Final[str]
+ path: Final[str]
+ raw_query_string: Final[str]
+ query_string: Final[str]
+ path_qs: Final[str]
+ raw_path_qs: Final[str]
+ raw_fragment: Final[str]
+ fragment: Final[str]
+ query: Final[multidict.MultiDict[str]]
+ raw_name: Final[str]
+ name: Final[str]
+ raw_suffix: Final[str]
+ suffix: Final[str]
+ raw_suffixes: Final[Tuple[str, ...]]
+ suffixes: Final[Tuple[str, ...]]
+ raw_parts: Final[Tuple[str, ...]]
+ parts: Final[Tuple[str, ...]]
+ parent: Final[URL]
+ def __init__(
+ self, val: Union[str, "URL"] = ..., *, encoded: bool = ...
+ ) -> None: ...
+ @classmethod
+ def build(
+ cls,
+ *,
+ scheme: str = ...,
+ authority: str = ...,
+ user: Optional[str] = ...,
+ password: Optional[str] = ...,
+ host: str = ...,
+ port: Optional[int] = ...,
+ path: str = ...,
+ query: Optional[_Query] = ...,
+ query_string: str = ...,
+ fragment: str = ...,
+ encoded: bool = ...
+ ) -> URL: ...
+ def __str__(self) -> str: ...
+ def __repr__(self) -> str: ...
+ def __bytes__(self) -> bytes: ...
+ def __eq__(self, other: Any) -> bool: ...
+ def __le__(self, other: Any) -> bool: ...
+ def __lt__(self, other: Any) -> bool: ...
+ def __ge__(self, other: Any) -> bool: ...
+ def __gt__(self, other: Any) -> bool: ...
+ def __hash__(self) -> int: ...
+ def __truediv__(self, name: str) -> URL: ...
+ def __mod__(self, query: _Query) -> URL: ...
+ def is_absolute(self) -> bool: ...
+ def is_default_port(self) -> bool: ...
+ def origin(self) -> URL: ...
+ def relative(self) -> URL: ...
+ def with_scheme(self, scheme: str) -> URL: ...
+ def with_user(self, user: Optional[str]) -> URL: ...
+ def with_password(self, password: Optional[str]) -> URL: ...
+ def with_host(self, host: str) -> URL: ...
+ def with_port(self, port: Optional[int]) -> URL: ...
+ def with_path(self, path: str, *, encoded: bool = ...) -> URL: ...
+ @overload
+ def with_query(self, query: _Query) -> URL: ...
+ @overload
+ def with_query(self, **kwargs: _QueryVariable) -> URL: ...
+ @overload
+ def update_query(self, query: _Query) -> URL: ...
+ @overload
+ def update_query(self, **kwargs: _QueryVariable) -> URL: ...
+ def with_fragment(self, fragment: Optional[str]) -> URL: ...
+ def with_name(self, name: str) -> URL: ...
+ def with_suffix(self, suffix: str) -> URL: ...
+ def join(self, url: URL) -> URL: ...
+ def joinpath(self, *url: str, encoded: bool = ...) -> URL: ...
+ def human_repr(self) -> str: ...
+ # private API
+ @classmethod
+ def _normalize_path(cls, path: str) -> str: ...
+
+@final
+class cached_property:
+ def __init__(self, wrapped: Any) -> None: ...
+ def __get__(self, inst: URL, owner: Type[URL]) -> Any: ...
+ def __set__(self, inst: URL, value: Any) -> None: ...
+
+class CacheInfo(TypedDict):
+ idna_encode: _CacheInfo
+ idna_decode: _CacheInfo
+
+def cache_clear() -> None: ...
+def cache_info() -> CacheInfo: ...
+def cache_configure(
+ *, idna_encode_size: Optional[int] = ..., idna_decode_size: Optional[int] = ...
+) -> None: ...
diff --git a/contrib/python/yarl/yarl/_quoting_c.pyi b/contrib/python/yarl/yarl/_quoting_c.pyi
new file mode 100644
index 0000000000..1c8fc24ec7
--- /dev/null
+++ b/contrib/python/yarl/yarl/_quoting_c.pyi
@@ -0,0 +1,16 @@
+from typing import Optional
+
+class _Quoter:
+ def __init__(
+ self,
+ *,
+ safe: str = ...,
+ protected: str = ...,
+ qs: bool = ...,
+ requote: bool = ...
+ ) -> None: ...
+ def __call__(self, val: Optional[str] = ...) -> Optional[str]: ...
+
+class _Unquoter:
+ def __init__(self, *, unsafe: str = ..., qs: bool = ...) -> None: ...
+ def __call__(self, val: Optional[str] = ...) -> Optional[str]: ...
diff --git a/contrib/python/zstandard/py3/zstandard/__init__.pyi b/contrib/python/zstandard/py3/zstandard/__init__.pyi
new file mode 100644
index 0000000000..c95a73e89b
--- /dev/null
+++ b/contrib/python/zstandard/py3/zstandard/__init__.pyi
@@ -0,0 +1,480 @@
+# Copyright (c) 2016-present, Gregory Szorc
+# All rights reserved.
+#
+# This software may be modified and distributed under the terms
+# of the BSD license. See the LICENSE file for details.
+
+import os
+
+from typing import (
+ BinaryIO,
+ ByteString,
+ Generator,
+ IO,
+ Iterable,
+ List,
+ Optional,
+ Set,
+ Tuple,
+ Union,
+)
+
+FLUSH_BLOCK: int
+FLUSH_FRAME: int
+
+COMPRESSOBJ_FLUSH_FINISH: int
+COMPRESSOBJ_FLUSH_BLOCK: int
+
+CONTENTSIZE_UNKNOWN: int
+CONTENTSIZE_ERROR: int
+
+MAX_COMPRESSION_LEVEL: int
+
+COMPRESSION_RECOMMENDED_INPUT_SIZE: int
+COMPRESSION_RECOMMENDED_OUTPUT_SIZE: int
+
+DECOMPRESSION_RECOMMENDED_INPUT_SIZE: int
+DECOMPRESSION_RECOMMENDED_OUTPUT_SIZE: int
+
+BLOCKSIZELOG_MAX: int
+BLOCKSIZE_MAX: int
+
+WINDOWLOG_MIN: int
+WINDOWLOG_MAX: int
+
+CHAINLOG_MIN: int
+CHAINLOG_MAX: int
+HASHLOG_MIN: int
+HASHLOG_MAX: int
+MINMATCH_MIN: int
+MINMATCH_MAX: int
+SEARCHLOG_MIN: int
+SEARCHLOG_MAX: int
+SEARCHLENGTH_MIN: int
+SEARCHLENGTH_MAX: int
+TARGETLENGTH_MIN: int
+TARGETLENGTH_MAX: int
+LDM_MINMATCH_MIN: int
+LDM_MINMATCH_MAX: int
+LDM_BUCKETSIZELOG_MAX: int
+
+STRATEGY_FAST: int
+STRATEGY_DFAST: int
+STRATEGY_GREEDY: int
+STRATEGY_LAZY: int
+STRATEGY_LAZY2: int
+STRATEGY_BTLAZY2: int
+STRATEGY_BTOPT: int
+STRATEGY_BTULTRA: int
+STRATEGY_BTULTRA2: int
+
+DICT_TYPE_AUTO: int
+DICT_TYPE_RAWCONTENT: int
+DICT_TYPE_FULLDICT: int
+
+FORMAT_ZSTD1: int
+FORMAT_ZSTD1_MAGICLESS: int
+
+ZSTD_VERSION: Tuple[int, int, int]
+FRAME_HEADER: bytes
+MAGIC_NUMBER: int
+
+backend: str
+backend_features: Set[str]
+__version__: str
+
+class ZstdError(Exception): ...
+
+class BufferSegment(object):
+ offset: int
+ def __len__(self) -> int: ...
+ def tobytes(self) -> bytes: ...
+
+class BufferSegments(object):
+ def __len__(self) -> int: ...
+ def __getitem__(self, i: int) -> BufferSegment: ...
+
+class BufferWithSegments(object):
+ size: int
+ def __init__(self, data: ByteString, segments: ByteString): ...
+ def __len__(self) -> int: ...
+ def __getitem__(self, i: int) -> BufferSegment: ...
+ def segments(self): ...
+ def tobytes(self) -> bytes: ...
+
+class BufferWithSegmentsCollection(object):
+ def __init__(self, *args): ...
+ def __len__(self) -> int: ...
+ def __getitem__(self, i: int) -> BufferSegment: ...
+ def size(self) -> int: ...
+
+class ZstdCompressionParameters(object):
+ @staticmethod
+ def from_level(
+ level: int, source_size: int = ..., dict_size: int = ..., **kwargs
+ ) -> "ZstdCompressionParameters": ...
+ def __init__(
+ self,
+ format: int = ...,
+ compression_level: int = ...,
+ window_log: int = ...,
+ hash_log: int = ...,
+ chain_log: int = ...,
+ search_log: int = ...,
+ min_match: int = ...,
+ target_length: int = ...,
+ strategy: int = ...,
+ write_content_size: int = ...,
+ write_checksum: int = ...,
+ write_dict_id: int = ...,
+ job_size: int = ...,
+ overlap_log: int = ...,
+ force_max_window: int = ...,
+ enable_ldm: int = ...,
+ ldm_hash_log: int = ...,
+ ldm_min_match: int = ...,
+ ldm_bucket_size_log: int = ...,
+ ldm_hash_rate_log: int = ...,
+ threads: int = ...,
+ ): ...
+ @property
+ def format(self) -> int: ...
+ @property
+ def compression_level(self) -> int: ...
+ @property
+ def window_log(self) -> int: ...
+ @property
+ def hash_log(self) -> int: ...
+ @property
+ def chain_log(self) -> int: ...
+ @property
+ def search_log(self) -> int: ...
+ @property
+ def min_match(self) -> int: ...
+ @property
+ def target_length(self) -> int: ...
+ @property
+ def strategy(self) -> int: ...
+ @property
+ def write_content_size(self) -> int: ...
+ @property
+ def write_checksum(self) -> int: ...
+ @property
+ def write_dict_id(self) -> int: ...
+ @property
+ def job_size(self) -> int: ...
+ @property
+ def overlap_log(self) -> int: ...
+ @property
+ def force_max_window(self) -> int: ...
+ @property
+ def enable_ldm(self) -> int: ...
+ @property
+ def ldm_hash_log(self) -> int: ...
+ @property
+ def ldm_min_match(self) -> int: ...
+ @property
+ def ldm_bucket_size_log(self) -> int: ...
+ @property
+ def ldm_hash_rate_log(self) -> int: ...
+ @property
+ def threads(self) -> int: ...
+ def estimated_compression_context_size(self) -> int: ...
+
+class CompressionParameters(ZstdCompressionParameters): ...
+
+class ZstdCompressionDict(object):
+ k: int
+ d: int
+ def __init__(
+ self,
+ data: ByteString,
+ dict_type: int = ...,
+ k: int = ...,
+ d: int = ...,
+ ): ...
+ def __len__(self) -> int: ...
+ def dict_id(self) -> int: ...
+ def as_bytes(self) -> bytes: ...
+ def precompute_compress(
+ self,
+ level: int = ...,
+ compression_params: ZstdCompressionParameters = ...,
+ ): ...
+
+class ZstdCompressionObj(object):
+ def compress(self, data: ByteString) -> bytes: ...
+ def flush(self, flush_mode: int = ...) -> bytes: ...
+
+class ZstdCompressionChunker(object):
+ def compress(self, data: ByteString): ...
+ def flush(self): ...
+ def finish(self): ...
+
+class ZstdCompressionReader(BinaryIO):
+ def __enter__(self) -> "ZstdCompressionReader": ...
+ def __exit__(self, exc_type, exc_value, exc_tb): ...
+ def readable(self) -> bool: ...
+ def writable(self) -> bool: ...
+ def seekable(self) -> bool: ...
+ def readline(self, limit: int = ...) -> bytes: ...
+ def readlines(self, hint: int = ...) -> List[bytes]: ...
+ def write(self, data: ByteString): ...
+ def writelines(self, data: Iterable[bytes]): ...
+ def isatty(self) -> bool: ...
+ def flush(self): ...
+ def close(self): ...
+ @property
+ def closed(self) -> bool: ...
+ def tell(self) -> int: ...
+ def readall(self) -> bytes: ...
+ def __iter__(self): ...
+ def __next__(self): ...
+ def next(self): ...
+ def read(self, size: int = ...) -> bytes: ...
+ def read1(self, size: int = ...) -> bytes: ...
+ def readinto(self, b) -> int: ...
+ def readinto1(self, b) -> int: ...
+
+class ZstdCompressionWriter(BinaryIO):
+ def __enter__(self) -> "ZstdCompressionWriter": ...
+ def __exit__(self, exc_type, exc_value, exc_tb): ...
+ def memory_size(self) -> int: ...
+ def fileno(self) -> int: ...
+ def close(self): ...
+ @property
+ def closed(self) -> bool: ...
+ def isatty(self) -> bool: ...
+ def readable(self) -> bool: ...
+ def readline(self, size: int = ...) -> bytes: ...
+ def readlines(self, hint: int = ...) -> List[bytes]: ...
+ def seek(self, offset: int, whence: int = ...): ...
+ def seekable(self) -> bool: ...
+ def truncate(self, size: int = ...): ...
+ def writable(self) -> bool: ...
+ def writelines(self, lines: Iterable[bytes]): ...
+ def read(self, size: int = ...) -> bytes: ...
+ def readall(self) -> bytes: ...
+ def readinto(self, b): ...
+ def write(self, data: ByteString) -> int: ...
+ def flush(self, flush_mode: int = ...) -> int: ...
+ def tell(self) -> int: ...
+
+class ZstdCompressor(object):
+ def __init__(
+ self,
+ level: int = ...,
+ dict_data: Optional[ZstdCompressionDict] = ...,
+ compression_params: Optional[ZstdCompressionParameters] = ...,
+ write_checksum: Optional[bool] = ...,
+ write_content_size: Optional[bool] = ...,
+ write_dict_id: Optional[bool] = ...,
+ threads: int = ...,
+ ): ...
+ def memory_size(self) -> int: ...
+ def compress(self, data: ByteString) -> bytes: ...
+ def compressobj(self, size: int = ...) -> ZstdCompressionObj: ...
+ def chunker(
+ self, size: int = ..., chunk_size: int = ...
+ ) -> ZstdCompressionChunker: ...
+ def copy_stream(
+ self,
+ ifh: IO[bytes],
+ ofh: IO[bytes],
+ size: int = ...,
+ read_size: int = ...,
+ write_size: int = ...,
+ ) -> Tuple[int, int]: ...
+ def stream_reader(
+ self,
+ source: Union[IO[bytes], ByteString],
+ size: int = ...,
+ read_size: int = ...,
+ *,
+ closefd: bool = ...,
+ ) -> ZstdCompressionReader: ...
+ def stream_writer(
+ self,
+ writer: IO[bytes],
+ size: int = ...,
+ write_size: int = ...,
+ write_return_read: bool = ...,
+ *,
+ closefd: bool = ...,
+ ) -> ZstdCompressionWriter: ...
+ def read_to_iter(
+ self,
+ reader: Union[IO[bytes], ByteString],
+ size: int = ...,
+ read_size: int = ...,
+ write_size: int = ...,
+ ) -> Generator[bytes, None, None]: ...
+ def frame_progression(self) -> Tuple[int, int, int]: ...
+ def multi_compress_to_buffer(
+ self,
+ data: Union[
+ BufferWithSegments,
+ BufferWithSegmentsCollection,
+ List[ByteString],
+ ],
+ threads: int = ...,
+ ) -> BufferWithSegmentsCollection: ...
+
+class ZstdDecompressionObj(object):
+ def decompress(self, data: ByteString) -> bytes: ...
+ def flush(self, length: int = ...) -> bytes: ...
+ @property
+ def unused_data(self) -> bytes: ...
+ @property
+ def unconsumed_tail(self) -> bytes: ...
+ @property
+ def eof(self) -> bool: ...
+
+class ZstdDecompressionReader(BinaryIO):
+ def __enter__(self) -> "ZstdDecompressionReader": ...
+ def __exit__(self, exc_type, exc_value, exc_tb): ...
+ def readable(self) -> bool: ...
+ def writable(self) -> bool: ...
+ def seekable(self) -> bool: ...
+ def readline(self, size: int = ...): ...
+ def readlines(self, hint: int = ...): ...
+ def write(self, data: ByteString): ...
+ def writelines(self, lines: Iterable[bytes]): ...
+ def isatty(self) -> bool: ...
+ def flush(self): ...
+ def close(self): ...
+ @property
+ def closed(self) -> bool: ...
+ def tell(self) -> int: ...
+ def readall(self) -> bytes: ...
+ def __iter__(self): ...
+ def __next__(self): ...
+ def next(self): ...
+ def read(self, size: int = ...) -> bytes: ...
+ def readinto(self, b) -> int: ...
+ def read1(self, size: int = ...) -> bytes: ...
+ def readinto1(self, b) -> int: ...
+ def seek(self, pos: int, whence: int = ...) -> int: ...
+
+class ZstdDecompressionWriter(BinaryIO):
+ def __enter__(self) -> "ZstdDecompressionWriter": ...
+ def __exit__(self, exc_type, exc_value, exc_tb): ...
+ def memory_size(self) -> int: ...
+ def close(self): ...
+ @property
+ def closed(self) -> bool: ...
+ def fileno(self) -> int: ...
+ def flush(self): ...
+ def isatty(self) -> bool: ...
+ def readable(self) -> bool: ...
+ def readline(self, size: int = ...): ...
+ def readlines(self, hint: int = ...): ...
+ def seek(self, offset: int, whence: int = ...): ...
+ def seekable(self) -> bool: ...
+ def tell(self): ...
+ def truncate(self, size: int = ...): ...
+ def writable(self) -> bool: ...
+ def writelines(self, lines: Iterable[bytes]): ...
+ def read(self, size: int = ...): ...
+ def readall(self): ...
+ def readinto(self, b): ...
+ def write(self, data: ByteString) -> int: ...
+
+class ZstdDecompressor(object):
+ def __init__(
+ self,
+ dict_data: Optional[ZstdCompressionDict] = ...,
+ max_window_size: int = ...,
+ format: int = ...,
+ ): ...
+ def memory_size(self) -> int: ...
+ def decompress(
+ self,
+ data: ByteString,
+ max_output_size: int = ...,
+ read_across_frames: bool = ...,
+ allow_extra_data: bool = ...,
+ ) -> bytes: ...
+ def stream_reader(
+ self,
+ source: Union[IO[bytes], ByteString],
+ read_size: int = ...,
+ read_across_frames: bool = ...,
+ *,
+ closefd=False,
+ ) -> ZstdDecompressionReader: ...
+ def decompressobj(
+ self, write_size: int = ..., read_across_frames: bool = False
+ ) -> ZstdDecompressionObj: ...
+ def read_to_iter(
+ self,
+ reader: Union[IO[bytes], ByteString],
+ read_size: int = ...,
+ write_size: int = ...,
+ skip_bytes: int = ...,
+ ) -> Generator[bytes, None, None]: ...
+ def stream_writer(
+ self,
+ writer: IO[bytes],
+ write_size: int = ...,
+ write_return_read: bool = ...,
+ *,
+ closefd: bool = ...,
+ ) -> ZstdDecompressionWriter: ...
+ def copy_stream(
+ self,
+ ifh: IO[bytes],
+ ofh: IO[bytes],
+ read_size: int = ...,
+ write_size: int = ...,
+ ) -> Tuple[int, int]: ...
+ def decompress_content_dict_chain(
+ self, frames: list[ByteString]
+ ) -> bytes: ...
+ def multi_decompress_to_buffer(
+ self,
+ frames: Union[
+ BufferWithSegments,
+ BufferWithSegmentsCollection,
+ List[ByteString],
+ ],
+ decompressed_sizes: ByteString = ...,
+ threads: int = ...,
+ ) -> BufferWithSegmentsCollection: ...
+
+class FrameParameters(object):
+ content_size: int
+ window_size: int
+ dict_id: int
+ has_checksum: bool
+
+def estimate_decompression_context_size() -> int: ...
+def frame_content_size(data: ByteString) -> int: ...
+def frame_header_size(data: ByteString) -> int: ...
+def get_frame_parameters(data: ByteString) -> FrameParameters: ...
+def train_dictionary(
+ dict_size: int,
+ samples: list[ByteString],
+ k: int = ...,
+ d: int = ...,
+ f: int = ...,
+ split_point: float = ...,
+ accel: int = ...,
+ notifications: int = ...,
+ dict_id: int = ...,
+ level: int = ...,
+ steps: int = ...,
+ threads: int = ...,
+) -> ZstdCompressionDict: ...
+def open(
+ filename: Union[bytes, str, os.PathLike, BinaryIO],
+ mode: str = ...,
+ cctx: Optional[ZstdCompressor] = ...,
+ dctx: Optional[ZstdDecompressor] = ...,
+ encoding: Optional[str] = ...,
+ errors: Optional[str] = ...,
+ newline: Optional[str] = ...,
+ closefd: bool = ...,
+): ...
+def compress(data: ByteString, level: int = ...) -> bytes: ...
+def decompress(data: ByteString, max_output_size: int = ...) -> bytes: ...