diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9082e1ea..a0b91c20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,45 +38,31 @@ jobs: if: ${{ failure() || success() }} tests: - name: "Test 🐍 ${{ matrix.python }} • pybind-${{ matrix.pybind11-branch }} • ${{ matrix.numpy-format }}" + name: "Test 🐍 ${{ matrix.config.python }} • pybind-${{ matrix.config.pybind11-branch }} • ${{ matrix.config.numpy-format }}" runs-on: ubuntu-latest strategy: fail-fast: false matrix: - pybind11-branch: - - "v2.13" - python: - - "3.13" - - "3.12" - - "3.11" - - "3.10" - - "3.9" - - "3.8" - numpy-format: - - "numpy-array-wrap-with-annotated" - include: - - python: "3.13" - pybind11-branch: "v2.9" - numpy-format: "numpy-array-wrap-with-annotated" - - python: "3.13" - pybind11-branch: "v2.11" - numpy-format: "numpy-array-wrap-with-annotated" - - python: "3.13" - pybind11-branch: "v2.12" - numpy-format: "numpy-array-wrap-with-annotated" - - python: "3.13" - pybind11-branch: "v2.13" - numpy-format: "numpy-array-use-type-var" -# # TODO: uncomment -# - python: "3.13" -# pybind11-branch: "master" + config: [ + { pybind11-branch: "v3.0", python: "3.13", numpy-format: "numpy-array-use-type-var"}, + { pybind11-branch: "v3.0", python: "3.13", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.13", python: "3.13", numpy-format: "numpy-array-use-type-var"}, + { pybind11-branch: "v2.13", python: "3.13", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.13", python: "3.12", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.13", python: "3.11", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.13", python: "3.10", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.13", python: "3.9", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.12", python: "3.13", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.11", python: "3.13", numpy-format: "numpy-array-wrap-with-annotated"}, + { pybind11-branch: "v2.9", python: "3.13", numpy-format: "numpy-array-wrap-with-annotated"}, + ] steps: - uses: actions/checkout@v4 - - name: Setup Python ${{ matrix.python }} + - name: Setup Python ${{ matrix.config.python }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python }} + python-version: ${{ matrix.config.python }} - name: Update CMake uses: jwlawson/actions-setup-cmake@v2 @@ -89,31 +75,31 @@ jobs: run: python -m pip install pytest-github-actions-annotate-failures - name: Install requirements - run: pip install -r "./tests/stubs/python-${{ matrix.python }}/requirements.txt" + run: pip install -r "./tests/stubs/python-${{ matrix.config.python }}/requirements.txt" - name: Install pybind11-stubgen run: pip install . - name: Install demo module shell: bash - run: ./tests/install-demo-module.sh --pybind11-branch "${{ matrix.pybind11-branch }}" + run: ./tests/install-demo-module.sh --pybind11-branch "${{ matrix.config.pybind11-branch }}" - name: Check stubs generation shell: bash - run: ./tests/check-demo-stubs-generation.sh --stubs-sub-dir "stubs/python-${{ matrix.python }}/pybind11-${{ matrix.pybind11-branch }}/${{ matrix.numpy-format }}" --${{ matrix.numpy-format }} + run: ./tests/check-demo-stubs-generation.sh --stubs-sub-dir "stubs/python-${{ matrix.config.python }}/pybind11-${{ matrix.config.pybind11-branch }}/${{ matrix.config.numpy-format }}" --${{ matrix.config.numpy-format }} - name: Archive patch uses: actions/upload-artifact@v4 if: failure() with: - name: "python-${{ matrix.python }}-pybind-${{ matrix.pybind11-branch }}-${{ matrix.numpy-format }}.patch" - path: "./tests/stubs/python-${{ matrix.python }}/pybind11-${{ matrix.pybind11-branch }}/${{ matrix.numpy-format }}.patch" + name: "python-${{ matrix.config.python }}-pybind-${{ matrix.config.pybind11-branch }}-${{ matrix.config.numpy-format }}.patch" + path: "./tests/stubs/python-${{ matrix.config.python }}/pybind11-${{ matrix.config.pybind11-branch }}/${{ matrix.config.numpy-format }}.patch" retention-days: 30 if-no-files-found: ignore - name: Check error generation shell: bash - run: ./tests/check-demo-errors-generation.sh + run: ./tests/check-demo-errors-generation.sh "pybind11-${{ matrix.config.pybind11-branch }}" test-cli-options: name: "Runs on 🐍 ${{ matrix.python }} • ${{ matrix.test-package }}" @@ -128,7 +114,6 @@ jobs: - "3.11" - "3.10" - "3.9" - - "3.8" steps: - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 79915dfc..59716e8d 100644 --- a/.gitignore +++ b/.gitignore @@ -203,7 +203,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # End of https://www.toptal.com/developers/gitignore/api/c++,cmake,python diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e0de5022 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "pybind11-stubgen" +description = "PEP 561 type stubs generator for pybind11 modules" +version = "2.5.5" +requires-python = "~=3.7" +authors = [ + {name = "Sergei Izmailov", email = "sergei.a.izmailov@gmail.com"}, +] +license = "BSD-3-Clause" +license-files = ["LICENSE"] +dynamic = ["readme"] + +[project.urls] +Repository = "https://github.com/sizmailov/pybind11-stubgen" +Issues = "https://github.com/sizmailov/pybind11-stubgen/issues" + +[tool.setuptools.packages] +find = {} + +[tool.setuptools.dynamic] +readme = {file = ["README.md"], content-type = "text/markdown"} + +[project.entry-points.console_scripts] +pybind11-stubgen = "pybind11_stubgen.__init__:main" diff --git a/setup.py b/setup.py deleted file mode 100644 index 27a68aaa..00000000 --- a/setup.py +++ /dev/null @@ -1,19 +0,0 @@ -from setuptools import find_packages, setup - -setup( - name="pybind11-stubgen", - maintainer="Sergei Izmailov", - maintainer_email="sergei.a.izmailov@gmail.com", - description="PEP 561 type stubs generator for pybind11 modules", - url="https://github.com/sizmailov/pybind11-stubgen", - version="2.5.5", - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - license="BSD", - entry_points={ - "console_scripts": "pybind11-stubgen = pybind11_stubgen.__init__:main" - }, - packages=find_packages(), - package_data={"pybind11_stubgen": ["py.typed"]}, - python_requires="~=3.7", -) diff --git a/tests/check-demo-errors-generation.sh b/tests/check-demo-errors-generation.sh index 71906c73..255e5e33 100755 --- a/tests/check-demo-errors-generation.sh +++ b/tests/check-demo-errors-generation.sh @@ -2,8 +2,14 @@ set -e +if [ "$#" -ne 1 ]; then + echo "Usage: $0 pybind11-vX.Y" + exit 1 +fi + TESTS_ROOT="$(readlink -m "$(dirname "$0")")" -DEMO_ERRORS_FILE="${TESTS_ROOT}/demo.errors.stderr.txt" +ERRORS_ROOT="$(readlink -m "${TESTS_ROOT}/errors/$1")" +DEMO_ERRORS_FILE="${ERRORS_ROOT}/demo.errors.stderr.txt" STUBS_DIR="/tmp/out" # Stubs should never be actually written remove_demo_errors() { diff --git a/tests/errors/pybind11-v2.11 b/tests/errors/pybind11-v2.11 new file mode 120000 index 00000000..2369df54 --- /dev/null +++ b/tests/errors/pybind11-v2.11 @@ -0,0 +1 @@ +pybind11-v2.9 \ No newline at end of file diff --git a/tests/errors/pybind11-v2.12 b/tests/errors/pybind11-v2.12 new file mode 120000 index 00000000..e6ae88f7 --- /dev/null +++ b/tests/errors/pybind11-v2.12 @@ -0,0 +1 @@ +pybind11-v2.11 \ No newline at end of file diff --git a/tests/errors/pybind11-v2.13 b/tests/errors/pybind11-v2.13 new file mode 120000 index 00000000..6480bdb7 --- /dev/null +++ b/tests/errors/pybind11-v2.13 @@ -0,0 +1 @@ +pybind11-v2.12 \ No newline at end of file diff --git a/tests/demo.errors.stderr.txt b/tests/errors/pybind11-v2.9/demo.errors.stderr.txt similarity index 100% rename from tests/demo.errors.stderr.txt rename to tests/errors/pybind11-v2.9/demo.errors.stderr.txt diff --git a/tests/errors/pybind11-v3.0/demo.errors.stderr.txt b/tests/errors/pybind11-v3.0/demo.errors.stderr.txt new file mode 100644 index 00000000..e858fa4a --- /dev/null +++ b/tests/errors/pybind11-v3.0/demo.errors.stderr.txt @@ -0,0 +1,15 @@ +pybind11_stubgen - [ ERROR] In demo._bindings.aliases.foreign_enum_default : Invalid expression '' +pybind11_stubgen - [ ERROR] In demo._bindings.enum.accept_defaulted_enum : Invalid expression '' +pybind11_stubgen - [ ERROR] In demo._bindings.flawed_bindings.accept_unbound_enum : Invalid expression '(anonymous namespace)::Enum' +pybind11_stubgen - [ ERROR] In demo._bindings.flawed_bindings.accept_unbound_enum_defaulted : Invalid expression '' +pybind11_stubgen - [ ERROR] In demo._bindings.flawed_bindings.accept_unbound_type : Invalid expression '(anonymous namespace)::Unbound' +pybind11_stubgen - [ ERROR] In demo._bindings.flawed_bindings.accept_unbound_type_defaulted : Invalid expression '' +pybind11_stubgen - [ ERROR] In demo._bindings.flawed_bindings.get_unbound_type : Invalid expression '(anonymous namespace)::Unbound' +pybind11_stubgen - [WARNING] Enum-like str representations were found with no matching mapping to the enum class location. +Use `--enum-class-locations` to specify full path to the following enum(s): + - ConsoleForegroundColor +pybind11_stubgen - [WARNING] Raw C++ types/values were found in signatures extracted from docstrings. +Please check the corresponding sections of pybind11 documentation to avoid common mistakes in binding code: + - https://pybind11.readthedocs.io/en/latest/advanced/misc.html#avoiding-cpp-types-in-docstrings + - https://pybind11.readthedocs.io/en/latest/advanced/functions.html#default-arguments-revisited +pybind11_stubgen - [ INFO] Terminating due to previous errors diff --git a/tests/stubs/python-3.10 b/tests/stubs/python-3.10 index 08f31189..032aea2d 120000 --- a/tests/stubs/python-3.10 +++ b/tests/stubs/python-3.10 @@ -1 +1 @@ -python-3.11 \ No newline at end of file +python-3.9 \ No newline at end of file diff --git a/tests/stubs/python-3.11 b/tests/stubs/python-3.11 index 0a8325ae..f31904fc 120000 --- a/tests/stubs/python-3.11 +++ b/tests/stubs/python-3.11 @@ -1 +1 @@ -python-3.12 \ No newline at end of file +python-3.10 \ No newline at end of file diff --git a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi index ea36dda6..bdc4a13e 100644 --- a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi @@ -7,6 +7,7 @@ __all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] class Base: class Inner: pass + name: str class CppException(Exception): @@ -53,5 +54,7 @@ class Outer: def name(self) -> str: ... @property def value(self) -> int: ... + value: Outer.Inner.NestedEnum + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi index 8e453374..7c1d4e96 100644 --- a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi @@ -25,24 +25,24 @@ __all__: list[str] = [ def accept_matrix_int( arg0: typing.Annotated[ numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) - ] + ], ) -> None: ... def accept_vector_float64( arg0: typing.Annotated[ numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) - ] + ], ) -> None: ... def dense_matrix_c( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... def dense_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... @@ -52,7 +52,7 @@ def fixed_mutator_a( numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, - ] + ], ) -> None: ... def fixed_mutator_c( arg0: typing.Annotated[ @@ -61,7 +61,7 @@ def fixed_mutator_c( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.f_contiguous, - ] + ], ) -> None: ... def fixed_mutator_r( arg0: typing.Annotated[ @@ -70,31 +70,35 @@ def fixed_mutator_r( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.c_contiguous, - ] + ], ) -> None: ... def four_col_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) ]: ... def four_row_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") ]: ... -def get_matrix_int() -> typing.Annotated[ - numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) -]: ... -def get_vector_float64() -> typing.Annotated[ - numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) -]: ... +def get_matrix_int() -> ( + typing.Annotated[ + numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) + ] +): ... +def get_vector_float64() -> ( + typing.Annotated[ + numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) + ] +): ... def sparse_matrix_c( - arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... def sparse_matrix_r( - arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi index e211caaf..34943048 100644 --- a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def accept_ndarray_float64( - arg0: typing.Annotated[numpy.ndarray, numpy.float64] + arg0: typing.Annotated[numpy.ndarray, numpy.float64], ) -> None: ... def accept_ndarray_int(arg0: typing.Annotated[numpy.ndarray, numpy.int32]) -> None: ... def get_ndarray_float64() -> typing.Annotated[numpy.ndarray, numpy.float64]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi index 9d81595c..492380b4 100644 --- a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi @@ -21,11 +21,13 @@ class WithGetterSetterDoc: """ getter doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: """ setter doc token """ + @property def def_property_readonly(self) -> int: """ @@ -44,6 +46,7 @@ class WithPropAndGetterSetterDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -64,6 +67,7 @@ class WithPropDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -71,16 +75,19 @@ class WithPropDoc: """ prop doc token """ + @property def def_readonly(self) -> int: """ prop doc token """ + @property def def_readwrite(self) -> int: """ prop doc token """ + @def_readwrite.setter def def_readwrite(self, arg0: int) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi index bd5bb496..e0faec55 100644 --- a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def std_array( - arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)] + arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)], ) -> typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)]: ... def std_map() -> dict[int, complex]: ... def std_optional(arg0: int | None) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi index 3547ce70..e9d68305 100644 --- a/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi @@ -14,6 +14,7 @@ class MapStringComplex: """ Check whether the map is nonempty """ + @typing.overload def __contains__(self, arg0: str) -> bool: ... @typing.overload @@ -27,6 +28,7 @@ class MapStringComplex: """ Return the canonical string representation of this map. """ + def __setitem__(self, arg0: str, arg1: complex) -> None: ... def items(self) -> typing.ItemsView[str, complex]: ... def keys(self) -> typing.KeysView[str]: ... @@ -38,26 +40,31 @@ class VectorPairStringDouble: """ Check whether the list is nonempty """ + def __contains__(self, x: tuple[str, float]) -> bool: """ Return true the container contains ``x`` """ + @typing.overload def __delitem__(self, arg0: int) -> None: """ Delete the list elements at index ``i`` """ + @typing.overload def __delitem__(self, arg0: slice) -> None: """ Delete list elements using a slice object """ + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload def __getitem__(self, s: slice) -> VectorPairStringDouble: """ Retrieve list elements using a slice object """ + @typing.overload def __getitem__(self, arg0: int) -> tuple[str, float]: ... @typing.overload @@ -67,6 +74,7 @@ class VectorPairStringDouble: """ Copy constructor """ + @typing.overload def __init__(self, arg0: typing.Iterable) -> None: ... def __iter__(self) -> typing.Iterator: ... @@ -79,42 +87,51 @@ class VectorPairStringDouble: """ Assign list elements using a slice object """ + def append(self, x: tuple[str, float]) -> None: """ Add an item to the end of the list """ + def clear(self) -> None: """ Clear the contents """ + def count(self, x: tuple[str, float]) -> int: """ Return the number of times ``x`` appears in the list """ + @typing.overload def extend(self, L: VectorPairStringDouble) -> None: """ Extend the list by appending all the items in the given list """ + @typing.overload def extend(self, L: typing.Iterable) -> None: """ Extend the list by appending all the items in the given list """ + def insert(self, i: int, x: tuple[str, float]) -> None: """ Insert an item at a given position. """ + @typing.overload def pop(self) -> tuple[str, float]: """ Remove and return the last item """ + @typing.overload def pop(self, i: int) -> tuple[str, float]: """ Remove and return the item at index ``i`` """ + def remove(self, x: tuple[str, float]) -> None: """ Remove the first item from the list whose value is x. It is an error if there is no such item. diff --git a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi index ea36dda6..bdc4a13e 100644 --- a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi @@ -7,6 +7,7 @@ __all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] class Base: class Inner: pass + name: str class CppException(Exception): @@ -53,5 +54,7 @@ class Outer: def name(self) -> str: ... @property def value(self) -> int: ... + value: Outer.Inner.NestedEnum + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi index 8e453374..7c1d4e96 100644 --- a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi @@ -25,24 +25,24 @@ __all__: list[str] = [ def accept_matrix_int( arg0: typing.Annotated[ numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) - ] + ], ) -> None: ... def accept_vector_float64( arg0: typing.Annotated[ numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) - ] + ], ) -> None: ... def dense_matrix_c( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... def dense_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... @@ -52,7 +52,7 @@ def fixed_mutator_a( numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, - ] + ], ) -> None: ... def fixed_mutator_c( arg0: typing.Annotated[ @@ -61,7 +61,7 @@ def fixed_mutator_c( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.f_contiguous, - ] + ], ) -> None: ... def fixed_mutator_r( arg0: typing.Annotated[ @@ -70,31 +70,35 @@ def fixed_mutator_r( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.c_contiguous, - ] + ], ) -> None: ... def four_col_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) ]: ... def four_row_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") ]: ... -def get_matrix_int() -> typing.Annotated[ - numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) -]: ... -def get_vector_float64() -> typing.Annotated[ - numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) -]: ... +def get_matrix_int() -> ( + typing.Annotated[ + numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) + ] +): ... +def get_vector_float64() -> ( + typing.Annotated[ + numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) + ] +): ... def sparse_matrix_c( - arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... def sparse_matrix_r( - arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi index e211caaf..34943048 100644 --- a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def accept_ndarray_float64( - arg0: typing.Annotated[numpy.ndarray, numpy.float64] + arg0: typing.Annotated[numpy.ndarray, numpy.float64], ) -> None: ... def accept_ndarray_int(arg0: typing.Annotated[numpy.ndarray, numpy.int32]) -> None: ... def get_ndarray_float64() -> typing.Annotated[numpy.ndarray, numpy.float64]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi index 9d81595c..492380b4 100644 --- a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi @@ -21,11 +21,13 @@ class WithGetterSetterDoc: """ getter doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: """ setter doc token """ + @property def def_property_readonly(self) -> int: """ @@ -44,6 +46,7 @@ class WithPropAndGetterSetterDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -64,6 +67,7 @@ class WithPropDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -71,16 +75,19 @@ class WithPropDoc: """ prop doc token """ + @property def def_readonly(self) -> int: """ prop doc token """ + @property def def_readwrite(self) -> int: """ prop doc token """ + @def_readwrite.setter def def_readwrite(self, arg0: int) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi index bd5bb496..e0faec55 100644 --- a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def std_array( - arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)] + arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)], ) -> typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)]: ... def std_map() -> dict[int, complex]: ... def std_optional(arg0: int | None) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi index 6f1f9b67..f51d6c50 100644 --- a/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.12/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi @@ -14,6 +14,7 @@ class MapStringComplex: """ Check whether the map is nonempty """ + @typing.overload def __contains__(self, arg0: str) -> bool: ... @typing.overload @@ -27,6 +28,7 @@ class MapStringComplex: """ Return the canonical string representation of this map. """ + def __setitem__(self, arg0: str, arg1: complex) -> None: ... def items(self) -> typing.ItemsView: ... def keys(self) -> typing.KeysView: ... @@ -38,26 +40,31 @@ class VectorPairStringDouble: """ Check whether the list is nonempty """ + def __contains__(self, x: tuple[str, float]) -> bool: """ Return true the container contains ``x`` """ + @typing.overload def __delitem__(self, arg0: int) -> None: """ Delete the list elements at index ``i`` """ + @typing.overload def __delitem__(self, arg0: slice) -> None: """ Delete list elements using a slice object """ + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload def __getitem__(self, s: slice) -> VectorPairStringDouble: """ Retrieve list elements using a slice object """ + @typing.overload def __getitem__(self, arg0: int) -> tuple[str, float]: ... @typing.overload @@ -67,6 +74,7 @@ class VectorPairStringDouble: """ Copy constructor """ + @typing.overload def __init__(self, arg0: typing.Iterable) -> None: ... def __iter__(self) -> typing.Iterator[tuple[str, float]]: ... @@ -79,42 +87,51 @@ class VectorPairStringDouble: """ Assign list elements using a slice object """ + def append(self, x: tuple[str, float]) -> None: """ Add an item to the end of the list """ + def clear(self) -> None: """ Clear the contents """ + def count(self, x: tuple[str, float]) -> int: """ Return the number of times ``x`` appears in the list """ + @typing.overload def extend(self, L: VectorPairStringDouble) -> None: """ Extend the list by appending all the items in the given list """ + @typing.overload def extend(self, L: typing.Iterable) -> None: """ Extend the list by appending all the items in the given list """ + def insert(self, i: int, x: tuple[str, float]) -> None: """ Insert an item at a given position. """ + @typing.overload def pop(self) -> tuple[str, float]: """ Remove and return the last item """ + @typing.overload def pop(self, i: int) -> tuple[str, float]: """ Remove and return the item at index ``i`` """ + def remove(self, x: tuple[str, float]) -> None: """ Remove the first item from the list whose value is x. It is an error if there is no such item. diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/classes.pyi index ea36dda6..bdc4a13e 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/classes.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/classes.pyi @@ -7,6 +7,7 @@ __all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] class Base: class Inner: pass + name: str class CppException(Exception): @@ -53,5 +54,7 @@ class Outer: def name(self) -> str: ... @property def value(self) -> int: ... + value: Outer.Inner.NestedEnum + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/eigen.pyi index 742d2eea..f5111a0a 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/eigen.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/eigen.pyi @@ -26,45 +26,47 @@ N = typing.TypeVar("N", bound=int) def accept_matrix_int( arg0: numpy.ndarray[ tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32] - ] + ], ) -> None: ... def accept_vector_float64( arg0: numpy.ndarray[ tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64] - ] + ], ) -> None: ... def dense_matrix_c( - arg0: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]] + arg0: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]], ) -> numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]]: ... def dense_matrix_r( - arg0: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]] + arg0: numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]], ) -> numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]]: ... def fixed_mutator_a( arg0: numpy.ndarray[ tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32] - ] + ], ) -> None: ... def fixed_mutator_c( arg0: numpy.ndarray[ tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32] - ] + ], ) -> None: ... def fixed_mutator_r( arg0: numpy.ndarray[ tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32] - ] + ], ) -> None: ... def four_col_matrix_r( - arg0: numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]] + arg0: numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]], ) -> numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]]: ... def four_row_matrix_r( - arg0: numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]] + arg0: numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]], ) -> numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]]: ... -def get_matrix_int() -> numpy.ndarray[ - tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32] -]: ... -def get_vector_float64() -> numpy.ndarray[ - tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64] -]: ... +def get_matrix_int() -> ( + numpy.ndarray[tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32]] +): ... +def get_vector_float64() -> ( + numpy.ndarray[ + tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64] + ] +): ... def sparse_matrix_c(arg0: scipy.sparse.csc_matrix) -> scipy.sparse.csc_matrix: ... def sparse_matrix_r(arg0: scipy.sparse.csr_matrix) -> scipy.sparse.csr_matrix: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/numpy.pyi index 08714c58..19245c5d 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/numpy.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/numpy.pyi @@ -13,10 +13,10 @@ __all__: list[str] = [ ] def accept_ndarray_float64( - arg0: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] + arg0: numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]], ) -> None: ... def accept_ndarray_int( - arg0: numpy.ndarray[typing.Any, numpy.dtype[numpy.int32]] + arg0: numpy.ndarray[typing.Any, numpy.dtype[numpy.int32]], ) -> None: ... def get_ndarray_float64() -> numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]]: ... def get_ndarray_int() -> numpy.ndarray[typing.Any, numpy.dtype[numpy.int32]]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/properties.pyi index 9d81595c..492380b4 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/properties.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/properties.pyi @@ -21,11 +21,13 @@ class WithGetterSetterDoc: """ getter doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: """ setter doc token """ + @property def def_property_readonly(self) -> int: """ @@ -44,6 +46,7 @@ class WithPropAndGetterSetterDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -64,6 +67,7 @@ class WithPropDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -71,16 +75,19 @@ class WithPropDoc: """ prop doc token """ + @property def def_readonly(self) -> int: """ prop doc token """ + @property def def_readwrite(self) -> int: """ prop doc token """ + @def_readwrite.setter def def_readwrite(self, arg0: int) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl.pyi index bd5bb496..e0faec55 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def std_array( - arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)] + arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)], ) -> typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)]: ... def std_map() -> dict[int, complex]: ... def std_optional(arg0: int | None) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi index 6f1f9b67..f51d6c50 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi @@ -14,6 +14,7 @@ class MapStringComplex: """ Check whether the map is nonempty """ + @typing.overload def __contains__(self, arg0: str) -> bool: ... @typing.overload @@ -27,6 +28,7 @@ class MapStringComplex: """ Return the canonical string representation of this map. """ + def __setitem__(self, arg0: str, arg1: complex) -> None: ... def items(self) -> typing.ItemsView: ... def keys(self) -> typing.KeysView: ... @@ -38,26 +40,31 @@ class VectorPairStringDouble: """ Check whether the list is nonempty """ + def __contains__(self, x: tuple[str, float]) -> bool: """ Return true the container contains ``x`` """ + @typing.overload def __delitem__(self, arg0: int) -> None: """ Delete the list elements at index ``i`` """ + @typing.overload def __delitem__(self, arg0: slice) -> None: """ Delete list elements using a slice object """ + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload def __getitem__(self, s: slice) -> VectorPairStringDouble: """ Retrieve list elements using a slice object """ + @typing.overload def __getitem__(self, arg0: int) -> tuple[str, float]: ... @typing.overload @@ -67,6 +74,7 @@ class VectorPairStringDouble: """ Copy constructor """ + @typing.overload def __init__(self, arg0: typing.Iterable) -> None: ... def __iter__(self) -> typing.Iterator[tuple[str, float]]: ... @@ -79,42 +87,51 @@ class VectorPairStringDouble: """ Assign list elements using a slice object """ + def append(self, x: tuple[str, float]) -> None: """ Add an item to the end of the list """ + def clear(self) -> None: """ Clear the contents """ + def count(self, x: tuple[str, float]) -> int: """ Return the number of times ``x`` appears in the list """ + @typing.overload def extend(self, L: VectorPairStringDouble) -> None: """ Extend the list by appending all the items in the given list """ + @typing.overload def extend(self, L: typing.Iterable) -> None: """ Extend the list by appending all the items in the given list """ + def insert(self, i: int, x: tuple[str, float]) -> None: """ Insert an item at a given position. """ + @typing.overload def pop(self) -> tuple[str, float]: """ Remove and return the last item """ + @typing.overload def pop(self, i: int) -> tuple[str, float]: """ Remove and return the item at index ``i`` """ + def remove(self, x: tuple[str, float]) -> None: """ Remove the first item from the list whose value is x. It is an error if there is no such item. diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi index ea36dda6..bdc4a13e 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi @@ -7,6 +7,7 @@ __all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] class Base: class Inner: pass + name: str class CppException(Exception): @@ -53,5 +54,7 @@ class Outer: def name(self) -> str: ... @property def value(self) -> int: ... + value: Outer.Inner.NestedEnum + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi index 8e453374..7c1d4e96 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi @@ -25,24 +25,24 @@ __all__: list[str] = [ def accept_matrix_int( arg0: typing.Annotated[ numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) - ] + ], ) -> None: ... def accept_vector_float64( arg0: typing.Annotated[ numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) - ] + ], ) -> None: ... def dense_matrix_c( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... def dense_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... @@ -52,7 +52,7 @@ def fixed_mutator_a( numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, - ] + ], ) -> None: ... def fixed_mutator_c( arg0: typing.Annotated[ @@ -61,7 +61,7 @@ def fixed_mutator_c( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.f_contiguous, - ] + ], ) -> None: ... def fixed_mutator_r( arg0: typing.Annotated[ @@ -70,31 +70,35 @@ def fixed_mutator_r( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.c_contiguous, - ] + ], ) -> None: ... def four_col_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) ]: ... def four_row_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") ]: ... -def get_matrix_int() -> typing.Annotated[ - numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) -]: ... -def get_vector_float64() -> typing.Annotated[ - numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) -]: ... +def get_matrix_int() -> ( + typing.Annotated[ + numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) + ] +): ... +def get_vector_float64() -> ( + typing.Annotated[ + numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) + ] +): ... def sparse_matrix_c( - arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... def sparse_matrix_r( - arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi index e211caaf..34943048 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def accept_ndarray_float64( - arg0: typing.Annotated[numpy.ndarray, numpy.float64] + arg0: typing.Annotated[numpy.ndarray, numpy.float64], ) -> None: ... def accept_ndarray_int(arg0: typing.Annotated[numpy.ndarray, numpy.int32]) -> None: ... def get_ndarray_float64() -> typing.Annotated[numpy.ndarray, numpy.float64]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi index 9d81595c..492380b4 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi @@ -21,11 +21,13 @@ class WithGetterSetterDoc: """ getter doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: """ setter doc token """ + @property def def_property_readonly(self) -> int: """ @@ -44,6 +46,7 @@ class WithPropAndGetterSetterDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -64,6 +67,7 @@ class WithPropDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -71,16 +75,19 @@ class WithPropDoc: """ prop doc token """ + @property def def_readonly(self) -> int: """ prop doc token """ + @property def def_readwrite(self) -> int: """ prop doc token """ + @def_readwrite.setter def def_readwrite(self, arg0: int) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi index bd5bb496..e0faec55 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def std_array( - arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)] + arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)], ) -> typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)]: ... def std_map() -> dict[int, complex]: ... def std_optional(arg0: int | None) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi index 6f1f9b67..f51d6c50 100644 --- a/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi @@ -14,6 +14,7 @@ class MapStringComplex: """ Check whether the map is nonempty """ + @typing.overload def __contains__(self, arg0: str) -> bool: ... @typing.overload @@ -27,6 +28,7 @@ class MapStringComplex: """ Return the canonical string representation of this map. """ + def __setitem__(self, arg0: str, arg1: complex) -> None: ... def items(self) -> typing.ItemsView: ... def keys(self) -> typing.KeysView: ... @@ -38,26 +40,31 @@ class VectorPairStringDouble: """ Check whether the list is nonempty """ + def __contains__(self, x: tuple[str, float]) -> bool: """ Return true the container contains ``x`` """ + @typing.overload def __delitem__(self, arg0: int) -> None: """ Delete the list elements at index ``i`` """ + @typing.overload def __delitem__(self, arg0: slice) -> None: """ Delete list elements using a slice object """ + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload def __getitem__(self, s: slice) -> VectorPairStringDouble: """ Retrieve list elements using a slice object """ + @typing.overload def __getitem__(self, arg0: int) -> tuple[str, float]: ... @typing.overload @@ -67,6 +74,7 @@ class VectorPairStringDouble: """ Copy constructor """ + @typing.overload def __init__(self, arg0: typing.Iterable) -> None: ... def __iter__(self) -> typing.Iterator[tuple[str, float]]: ... @@ -79,42 +87,51 @@ class VectorPairStringDouble: """ Assign list elements using a slice object """ + def append(self, x: tuple[str, float]) -> None: """ Add an item to the end of the list """ + def clear(self) -> None: """ Clear the contents """ + def count(self, x: tuple[str, float]) -> int: """ Return the number of times ``x`` appears in the list """ + @typing.overload def extend(self, L: VectorPairStringDouble) -> None: """ Extend the list by appending all the items in the given list """ + @typing.overload def extend(self, L: typing.Iterable) -> None: """ Extend the list by appending all the items in the given list """ + def insert(self, i: int, x: tuple[str, float]) -> None: """ Insert an item at a given position. """ + @typing.overload def pop(self) -> tuple[str, float]: """ Remove and return the last item """ + @typing.overload def pop(self, i: int) -> tuple[str, float]: """ Remove and return the item at index ``i`` """ + def remove(self, x: tuple[str, float]) -> None: """ Remove the first item from the list whose value is x. It is an error if there is no such item. diff --git a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi index ea36dda6..bdc4a13e 100644 --- a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi @@ -7,6 +7,7 @@ __all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] class Base: class Inner: pass + name: str class CppException(Exception): @@ -53,5 +54,7 @@ class Outer: def name(self) -> str: ... @property def value(self) -> int: ... + value: Outer.Inner.NestedEnum + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi index 8e453374..7c1d4e96 100644 --- a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi @@ -25,24 +25,24 @@ __all__: list[str] = [ def accept_matrix_int( arg0: typing.Annotated[ numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) - ] + ], ) -> None: ... def accept_vector_float64( arg0: typing.Annotated[ numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) - ] + ], ) -> None: ... def dense_matrix_c( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... def dense_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... @@ -52,7 +52,7 @@ def fixed_mutator_a( numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, - ] + ], ) -> None: ... def fixed_mutator_c( arg0: typing.Annotated[ @@ -61,7 +61,7 @@ def fixed_mutator_c( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.f_contiguous, - ] + ], ) -> None: ... def fixed_mutator_r( arg0: typing.Annotated[ @@ -70,31 +70,35 @@ def fixed_mutator_r( pybind11_stubgen.typing_ext.FixedSize(5, 6), numpy.ndarray.flags.writeable, numpy.ndarray.flags.c_contiguous, - ] + ], ) -> None: ... def four_col_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) ]: ... def four_row_matrix_r( arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") - ] + ], ) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") ]: ... -def get_matrix_int() -> typing.Annotated[ - numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) -]: ... -def get_vector_float64() -> typing.Annotated[ - numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) -]: ... +def get_matrix_int() -> ( + typing.Annotated[ + numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) + ] +): ... +def get_vector_float64() -> ( + typing.Annotated[ + numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) + ] +): ... def sparse_matrix_c( - arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... def sparse_matrix_r( - arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32] + arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32], ) -> typing.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi index e211caaf..34943048 100644 --- a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi @@ -13,7 +13,7 @@ __all__: list[str] = [ ] def accept_ndarray_float64( - arg0: typing.Annotated[numpy.ndarray, numpy.float64] + arg0: typing.Annotated[numpy.ndarray, numpy.float64], ) -> None: ... def accept_ndarray_int(arg0: typing.Annotated[numpy.ndarray, numpy.int32]) -> None: ... def get_ndarray_float64() -> typing.Annotated[numpy.ndarray, numpy.float64]: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi index 9d81595c..492380b4 100644 --- a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi @@ -21,11 +21,13 @@ class WithGetterSetterDoc: """ getter doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: """ setter doc token """ + @property def def_property_readonly(self) -> int: """ @@ -44,6 +46,7 @@ class WithPropAndGetterSetterDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -64,6 +67,7 @@ class WithPropDoc: """ prop doc token """ + @def_property.setter def def_property(self, arg1: int) -> None: ... @property @@ -71,16 +75,19 @@ class WithPropDoc: """ prop doc token """ + @property def def_readonly(self) -> int: """ prop doc token """ + @property def def_readwrite(self) -> int: """ prop doc token """ + @def_readwrite.setter def def_readwrite(self, arg0: int) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi index 7133e4cc..0f82bb19 100644 --- a/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi +++ b/tests/stubs/python-3.12/pybind11-v2.9/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi @@ -14,6 +14,7 @@ class MapStringComplex: """ Check whether the map is nonempty """ + @typing.overload def __contains__(self, arg0: str) -> bool: ... @typing.overload @@ -27,6 +28,7 @@ class MapStringComplex: """ Return the canonical string representation of this map. """ + def __setitem__(self, arg0: str, arg1: complex) -> None: ... def items(self) -> typing.ItemsView[MapStringComplex]: ... def keys(self) -> typing.KeysView[MapStringComplex]: ... @@ -38,26 +40,31 @@ class VectorPairStringDouble: """ Check whether the list is nonempty """ + def __contains__(self, x: tuple[str, float]) -> bool: """ Return true the container contains ``x`` """ + @typing.overload def __delitem__(self, arg0: int) -> None: """ Delete the list elements at index ``i`` """ + @typing.overload def __delitem__(self, arg0: slice) -> None: """ Delete list elements using a slice object """ + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload def __getitem__(self, s: slice) -> VectorPairStringDouble: """ Retrieve list elements using a slice object """ + @typing.overload def __getitem__(self, arg0: int) -> tuple[str, float]: ... @typing.overload @@ -67,6 +74,7 @@ class VectorPairStringDouble: """ Copy constructor """ + @typing.overload def __init__(self, arg0: typing.Iterable) -> None: ... def __iter__(self) -> typing.Iterator: ... @@ -79,42 +87,51 @@ class VectorPairStringDouble: """ Assign list elements using a slice object """ + def append(self, x: tuple[str, float]) -> None: """ Add an item to the end of the list """ + def clear(self) -> None: """ Clear the contents """ + def count(self, x: tuple[str, float]) -> int: """ Return the number of times ``x`` appears in the list """ + @typing.overload def extend(self, L: VectorPairStringDouble) -> None: """ Extend the list by appending all the items in the given list """ + @typing.overload def extend(self, L: typing.Iterable) -> None: """ Extend the list by appending all the items in the given list """ + def insert(self, i: int, x: tuple[str, float]) -> None: """ Insert an item at a given position. """ + @typing.overload def pop(self) -> tuple[str, float]: """ Remove and return the last item """ + @typing.overload def pop(self, i: int) -> tuple[str, float]: """ Remove and return the item at index ``i`` """ + def remove(self, x: tuple[str, float]) -> None: """ Remove the first item from the list whose value is x. It is an error if there is no such item. diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/__init__.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/__init__.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/__init__.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/__init__.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/__init__.pyi similarity index 95% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/__init__.pyi index 93963f4b..8d6f4ceb 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/__init__.pyi @@ -47,7 +47,7 @@ class Dummy: def foreign_enum_default( color: typing.Any = demo._bindings.enum.ConsoleForegroundColor.Blue, ) -> None: ... -def func(arg0: int) -> int: ... +def func(arg0: typing.SupportsInt) -> int: ... local_func_alias = func local_type_alias = Color diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_arg.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_arg.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_attr.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_attr.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_class_member.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_class_member.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_method_arg.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_method_arg.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_method_return.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_method_return.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_return.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/foreign_return.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/missing_self_arg.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/aliases/missing_self_arg.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/classes.pyi similarity index 84% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/classes.pyi index ea36dda6..5578ccd3 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/classes.pyi @@ -7,13 +7,17 @@ __all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] class Base: class Inner: pass + name: str class CppException(Exception): pass class Derived(Base): - count: int + @property + def count(self) -> int: ... + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: ... class Foo: class FooChild: @@ -43,15 +47,17 @@ class Outer: def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... + def __init__(self, value: typing.SupportsInt) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: typing.Any) -> bool: ... def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + def __setstate__(self, state: typing.SupportsInt) -> None: ... def __str__(self) -> str: ... @property def name(self) -> str: ... @property def value(self) -> int: ... + value: Outer.Inner.NestedEnum + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/eigen.pyi new file mode 100644 index 00000000..c7a814b2 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/eigen.pyi @@ -0,0 +1,71 @@ +from __future__ import annotations + +import typing + +import numpy +import numpy.typing +import scipy.sparse + +__all__: list[str] = [ + "accept_matrix_int", + "accept_vector_float64", + "dense_matrix_c", + "dense_matrix_r", + "fixed_mutator_a", + "fixed_mutator_c", + "fixed_mutator_r", + "four_col_matrix_r", + "four_row_matrix_r", + "get_matrix_int", + "get_vector_float64", + "sparse_matrix_c", + "sparse_matrix_r", +] + +def accept_matrix_int( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.int32, "[3, 3]"], +) -> None: ... +def accept_vector_float64( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"], +) -> None: ... +def dense_matrix_c( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, n]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]: ... +def dense_matrix_r( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, n]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]: ... +def fixed_mutator_a( + arg0: typing.Annotated[ + numpy.typing.NDArray[numpy.float32], "[5, 6]", "flags.writeable" + ], +) -> None: ... +def fixed_mutator_c( + arg0: typing.Annotated[ + numpy.typing.NDArray[numpy.float32], + "[5, 6]", + "flags.writeable", + "flags.f_contiguous", + ], +) -> None: ... +def fixed_mutator_r( + arg0: typing.Annotated[ + numpy.typing.NDArray[numpy.float32], + "[5, 6]", + "flags.writeable", + "flags.c_contiguous", + ], +) -> None: ... +def four_col_matrix_r( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, 4]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, 4]"]: ... +def four_row_matrix_r( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[4, n]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[4, n]"]: ... +def get_matrix_int() -> ( + typing.Annotated[numpy.typing.NDArray[numpy.int32], "[3, 3]"] +): ... +def get_vector_float64() -> ( + typing.Annotated[numpy.typing.NDArray[numpy.float64], "[3, 1]"] +): ... +def sparse_matrix_c(arg0: scipy.sparse.csc_matrix) -> scipy.sparse.csc_matrix: ... +def sparse_matrix_r(arg0: scipy.sparse.csr_matrix) -> scipy.sparse.csr_matrix: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/enum.pyi similarity index 94% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/enum.pyi index 57aba5b9..a994e39a 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/enum.pyi @@ -49,11 +49,11 @@ class ConsoleForegroundColor: def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... - def __init__(self, value: int) -> None: ... + def __init__(self, value: typing.SupportsInt) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: typing.Any) -> bool: ... def __repr__(self) -> str: ... - def __setstate__(self, state: int) -> None: ... + def __setstate__(self, state: typing.SupportsInt) -> None: ... def __str__(self) -> str: ... @property def name(self) -> str: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/flawed_bindings.pyi similarity index 84% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/flawed_bindings.pyi index 4f3886ea..d95bbb35 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/flawed_bindings.pyi @@ -1,5 +1,7 @@ from __future__ import annotations +import typing + __all__: list[str] = [ "Enum", "Unbound", @@ -18,6 +20,6 @@ class Unbound: def accept_unbound_enum(arg0: ...) -> int: ... def accept_unbound_enum_defaulted(x: Enum = ...) -> int: ... -def accept_unbound_type(arg0: tuple[..., int]) -> int: ... +def accept_unbound_type(arg0: tuple[..., typing.SupportsInt]) -> int: ... def accept_unbound_type_defaulted(x: Unbound = ...) -> int: ... def get_unbound_type() -> ...: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/functions.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/functions.pyi new file mode 100644 index 00000000..99710ab0 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/functions.pyi @@ -0,0 +1,74 @@ +from __future__ import annotations + +import collections.abc +import typing + +__all__: list[str] = [ + "Foo", + "accept_annotated_callable", + "accept_callable", + "accept_frozenset", + "accept_py_handle", + "accept_py_object", + "accept_set", + "add", + "default_custom_arg", + "default_int_arg", + "default_list_arg", + "default_optional_arg", + "func_w_anon_args", + "func_w_named_pos_args", + "generic", + "mul", + "pass_callback", + "pos_kw_only_mix", + "pos_kw_only_variadic_mix", +] + +class Foo: + def __init__(self, arg0: typing.SupportsInt) -> None: ... + +def accept_annotated_callable( + arg0: collections.abc.Callable[[typing.SupportsInt, typing.SupportsInt], int], +) -> typing.Any: ... +def accept_callable(arg0: collections.abc.Callable) -> typing.Any: ... +def accept_frozenset(arg0: frozenset) -> None: ... +def accept_py_handle(arg0: typing.Any) -> str: ... +def accept_py_object(arg0: typing.Any) -> str: ... +def accept_set(arg0: set) -> None: ... +def add(arg0: typing.SupportsInt, arg1: typing.SupportsInt) -> int: ... +def default_custom_arg(foo: Foo = Foo(5)) -> None: ... +def default_int_arg(n: typing.SupportsInt = 5) -> None: ... +def default_list_arg(l: list = [1, 2, 6, 18]) -> None: ... +def default_optional_arg(n: typing.SupportsInt | None = None) -> None: ... +def func_w_anon_args( + arg0: typing.SupportsInt, arg1: typing.SupportsInt, arg2: typing.SupportsInt +) -> None: ... +def func_w_named_pos_args( + x: typing.SupportsInt, y: typing.SupportsInt, z: typing.SupportsInt +) -> None: ... +def generic(*args, **kwargs) -> None: ... +@typing.overload +def mul(x: typing.SupportsInt, y: typing.SupportsInt) -> int: + """ + Multiply x and y (int) + """ + +@typing.overload +def mul(p: typing.SupportsFloat, q: typing.SupportsFloat) -> float: + """ + Multiply p and q (double) + """ + +def pass_callback(arg0: collections.abc.Callable[[Foo], Foo]) -> Foo: ... +def pos_kw_only_mix( + i: typing.SupportsInt, /, j: typing.SupportsInt, *, k: typing.SupportsInt +) -> tuple: ... +def pos_kw_only_variadic_mix( + i: typing.SupportsInt, + /, + j: typing.SupportsInt, + *args, + k: typing.SupportsInt, + **kwargs, +) -> tuple: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/issues.pyi similarity index 90% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/issues.pyi index cf6abad8..165940ce 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/issues.pyi @@ -17,7 +17,9 @@ def backslashes_should_be_escaped() -> None: Here's some reStructuredText: :math:`x = [x, y, \\theta]^T` """ -def issue_51_catastrophic_regex(arg0: int, arg1: int) -> None: +def issue_51_catastrophic_regex( + arg0: typing.SupportsInt, arg1: typing.SupportsInt +) -> None: """ Use-case: issue_51(os.get_handle_inheritable, os.set_handle_inheritable) diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/methods.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/methods.pyi new file mode 100644 index 00000000..406a3011 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/methods.pyi @@ -0,0 +1,10 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = ["Dummy"] + +class Dummy: + @staticmethod + def static_method(arg0: typing.SupportsInt) -> int: ... + def regular_method(self, arg0: typing.SupportsInt) -> int: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/numpy.pyi similarity index 50% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/numpy.pyi index d1fe4668..ca0a64b9 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/numpy.pyi @@ -3,7 +3,7 @@ from __future__ import annotations import typing import numpy -import typing_extensions +import numpy.typing __all__: list[str] = [ "accept_ndarray_float64", @@ -14,13 +14,11 @@ __all__: list[str] = [ ] def accept_ndarray_float64( - arg0: typing_extensions.Annotated[numpy.ndarray, numpy.float64] + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float64], ) -> None: ... def accept_ndarray_int( - arg0: typing_extensions.Annotated[numpy.ndarray, numpy.int32] + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.int32], ) -> None: ... -def get_ndarray_float64() -> typing_extensions.Annotated[ - numpy.ndarray, numpy.float64 -]: ... -def get_ndarray_int() -> typing_extensions.Annotated[numpy.ndarray, numpy.int32]: ... +def get_ndarray_float64() -> numpy.typing.NDArray[numpy.float64]: ... +def get_ndarray_int() -> numpy.typing.NDArray[numpy.int32]: ... def return_dtype() -> numpy.dtype[typing.Any]: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/properties.pyi similarity index 79% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/properties.pyi index 9d81595c..0c9632ad 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/properties.pyi @@ -21,11 +21,13 @@ class WithGetterSetterDoc: """ getter doc token """ + @def_property.setter - def def_property(self, arg1: int) -> None: + def def_property(self, arg1: typing.SupportsInt) -> None: """ setter doc token """ + @property def def_property_readonly(self) -> int: """ @@ -44,8 +46,9 @@ class WithPropAndGetterSetterDoc: """ prop doc token """ + @def_property.setter - def def_property(self, arg1: int) -> None: ... + def def_property(self, arg1: typing.SupportsInt) -> None: ... @property def def_property_readonly(self) -> int: """ @@ -64,25 +67,29 @@ class WithPropDoc: """ prop doc token """ + @def_property.setter - def def_property(self, arg1: int) -> None: ... + def def_property(self, arg1: typing.SupportsInt) -> None: ... @property def def_property_readonly(self) -> int: """ prop doc token """ + @property def def_readonly(self) -> int: """ prop doc token """ + @property def def_readwrite(self) -> int: """ prop doc token """ + @def_readwrite.setter - def def_readwrite(self, arg0: int) -> None: ... + def def_readwrite(self, arg0: typing.SupportsInt) -> None: ... class WithoutDoc: """ @@ -91,9 +98,15 @@ class WithoutDoc: def_property_readonly_static: typing.ClassVar[int] = 0 def_property_static: typing.ClassVar[int] = 0 - def_property: int - def_readwrite: int + @property + def def_property(self) -> int: ... + @def_property.setter + def def_property(self, arg1: typing.SupportsInt) -> None: ... @property def def_property_readonly(self) -> int: ... @property def def_readonly(self) -> int: ... + @property + def def_readwrite(self) -> int: ... + @def_readwrite.setter + def def_readwrite(self, arg0: typing.SupportsInt) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/stl.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/stl.pyi new file mode 100644 index 00000000..12833c68 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/stl.pyi @@ -0,0 +1,28 @@ +from __future__ import annotations + +import collections.abc +import typing + +__all__: list[str] = [ + "std_array", + "std_map", + "std_optional", + "std_variant", + "std_vector", +] + +def std_array( + arg0: typing.Annotated[ + collections.abc.Sequence[typing.SupportsInt], "FixedSize(3)" + ], +) -> typing.Annotated[list[int], "FixedSize(3)"]: ... +def std_map() -> dict[int, complex]: ... +def std_optional(arg0: typing.SupportsInt | None) -> None: ... +def std_variant( + arg0: ( + typing.SupportsInt + | typing.SupportsFloat + | tuple[typing.SupportsInt, typing.SupportsInt] + ), +) -> None: ... +def std_vector() -> list[tuple[int, float]]: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi similarity index 76% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi index 6f1f9b67..32f31d42 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/stl_bind.pyi @@ -1,5 +1,6 @@ from __future__ import annotations +import collections.abc import typing __all__: list[str] = [ @@ -14,6 +15,7 @@ class MapStringComplex: """ Check whether the map is nonempty """ + @typing.overload def __contains__(self, arg0: str) -> bool: ... @typing.overload @@ -21,12 +23,13 @@ class MapStringComplex: def __delitem__(self, arg0: str) -> None: ... def __getitem__(self, arg0: str) -> complex: ... def __init__(self) -> None: ... - def __iter__(self) -> typing.Iterator[str]: ... + def __iter__(self) -> collections.abc.Iterator[str]: ... def __len__(self) -> int: ... def __repr__(self) -> str: """ Return the canonical string representation of this map. """ + def __setitem__(self, arg0: str, arg1: complex) -> None: ... def items(self) -> typing.ItemsView: ... def keys(self) -> typing.KeysView: ... @@ -38,28 +41,33 @@ class VectorPairStringDouble: """ Check whether the list is nonempty """ - def __contains__(self, x: tuple[str, float]) -> bool: + + def __contains__(self, x: tuple[str, typing.SupportsFloat]) -> bool: """ Return true the container contains ``x`` """ + @typing.overload - def __delitem__(self, arg0: int) -> None: + def __delitem__(self, arg0: typing.SupportsInt) -> None: """ Delete the list elements at index ``i`` """ + @typing.overload def __delitem__(self, arg0: slice) -> None: """ Delete list elements using a slice object """ + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload def __getitem__(self, s: slice) -> VectorPairStringDouble: """ Retrieve list elements using a slice object """ + @typing.overload - def __getitem__(self, arg0: int) -> tuple[str, float]: ... + def __getitem__(self, arg0: typing.SupportsInt) -> tuple[str, float]: ... @typing.overload def __init__(self) -> None: ... @typing.overload @@ -67,55 +75,69 @@ class VectorPairStringDouble: """ Copy constructor """ + @typing.overload - def __init__(self, arg0: typing.Iterable) -> None: ... - def __iter__(self) -> typing.Iterator[tuple[str, float]]: ... + def __init__(self, arg0: collections.abc.Iterable) -> None: ... + def __iter__(self) -> collections.abc.Iterator[tuple[str, float]]: ... def __len__(self) -> int: ... def __ne__(self, arg0: VectorPairStringDouble) -> bool: ... @typing.overload - def __setitem__(self, arg0: int, arg1: tuple[str, float]) -> None: ... + def __setitem__( + self, arg0: typing.SupportsInt, arg1: tuple[str, typing.SupportsFloat] + ) -> None: ... @typing.overload def __setitem__(self, arg0: slice, arg1: VectorPairStringDouble) -> None: """ Assign list elements using a slice object """ - def append(self, x: tuple[str, float]) -> None: + + def append(self, x: tuple[str, typing.SupportsFloat]) -> None: """ Add an item to the end of the list """ + def clear(self) -> None: """ Clear the contents """ - def count(self, x: tuple[str, float]) -> int: + + def count(self, x: tuple[str, typing.SupportsFloat]) -> int: """ Return the number of times ``x`` appears in the list """ + @typing.overload def extend(self, L: VectorPairStringDouble) -> None: """ Extend the list by appending all the items in the given list """ + @typing.overload - def extend(self, L: typing.Iterable) -> None: + def extend(self, L: collections.abc.Iterable) -> None: """ Extend the list by appending all the items in the given list """ - def insert(self, i: int, x: tuple[str, float]) -> None: + + def insert( + self, i: typing.SupportsInt, x: tuple[str, typing.SupportsFloat] + ) -> None: """ Insert an item at a given position. """ + @typing.overload def pop(self) -> tuple[str, float]: """ Remove and return the last item """ + @typing.overload - def pop(self, i: int) -> tuple[str, float]: + def pop(self, i: typing.SupportsInt) -> tuple[str, float]: """ Remove and return the item at index ``i`` """ - def remove(self, x: tuple[str, float]) -> None: + + def remove(self, x: tuple[str, typing.SupportsFloat]) -> None: """ Remove the first item from the list whose value is x. It is an error if there is no such item. """ diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/typing.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/typing.pyi new file mode 100644 index 00000000..98fd047b --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/typing.pyi @@ -0,0 +1,8 @@ +from __future__ import annotations + +import collections.abc + +__all__: list[str] = ["get_buffer", "get_sequence"] + +def get_buffer(arg0: collections.abc.Buffer) -> collections.abc.Buffer: ... +def get_sequence(arg0: collections.abc.Sequence) -> collections.abc.Sequence: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/values.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/_bindings/values.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/core.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/core.pyi diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/__init__.pyi new file mode 100644 index 00000000..10d343e0 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/__init__.pyi @@ -0,0 +1,11 @@ +from __future__ import annotations + +from . import classes, functions, functions_3_8_plus, functions_3_9_plus, values + +__all__: list[str] = [ + "classes", + "functions", + "functions_3_8_plus", + "functions_3_9_plus", + "values", +] diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/classes.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/classes.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions.pyi similarity index 88% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions.pyi index 13f2855c..5ed9ef3c 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions.pyi @@ -4,12 +4,14 @@ import sys as sys import typing as typing from demo.pure_python.functions_3_8_plus import args_mix +from demo.pure_python.functions_3_9_plus import generic_alias_annotation __all__: list[str] = [ "accept_frozenset", "args_mix", "builtin_function_as_default_arg", "function_as_default_arg", + "generic_alias_annotation", "lambda_as_default_arg", "search", "static_method_as_default_arg", diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions_3_8_plus.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions_3_8_plus.pyi diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions_3_9_plus.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions_3_9_plus.pyi new file mode 100644 index 00000000..59b9b80c --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/functions_3_9_plus.pyi @@ -0,0 +1,5 @@ +from __future__ import annotations + +__all__: list[str] = ["generic_alias_annotation"] + +def generic_alias_annotation(a: list[tuple[int]], b: dict[int, str]) -> list[float]: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/values.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-use-type-var/demo/pure_python/values.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/__init__.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/__init__.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi new file mode 100644 index 00000000..8d6f4ceb --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi @@ -0,0 +1,53 @@ +from __future__ import annotations + +import typing + +import numpy +from numpy import random + +import demo._bindings.enum +from demo._bindings.aliases.foreign_method_arg import Bar2 as foreign_type_alias +from demo._bindings.aliases.foreign_return import get_foo as foreign_class_alias + +from . import ( + foreign_arg, + foreign_attr, + foreign_class_member, + foreign_method_arg, + foreign_method_return, + foreign_return, + missing_self_arg, +) + +__all__: list[str] = [ + "Color", + "Dummy", + "foreign_arg", + "foreign_attr", + "foreign_class_alias", + "foreign_class_member", + "foreign_enum_default", + "foreign_method_arg", + "foreign_method_return", + "foreign_return", + "foreign_type_alias", + "func", + "local_func_alias", + "local_type_alias", + "missing_self_arg", + "random", +] + +class Color: + pass + +class Dummy: + linalg = numpy.linalg + +def foreign_enum_default( + color: typing.Any = demo._bindings.enum.ConsoleForegroundColor.Blue, +) -> None: ... +def func(arg0: typing.SupportsInt) -> int: ... + +local_func_alias = func +local_type_alias = Color diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi new file mode 100644 index 00000000..5578ccd3 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi @@ -0,0 +1,63 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = ["Base", "CppException", "Derived", "Foo", "Outer"] + +class Base: + class Inner: + pass + + name: str + +class CppException(Exception): + pass + +class Derived(Base): + @property + def count(self) -> int: ... + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: ... + +class Foo: + class FooChild: + def __init__(self) -> None: ... + def g(self) -> None: ... + + def __init__(self) -> None: ... + def f(self) -> None: ... + +class Outer: + class Inner: + class NestedEnum: + """ + Members: + + ONE + + TWO + """ + + ONE: typing.ClassVar[Outer.Inner.NestedEnum] # value = + TWO: typing.ClassVar[Outer.Inner.NestedEnum] # value = + __members__: typing.ClassVar[ + dict[str, Outer.Inner.NestedEnum] + ] # value = {'ONE': , 'TWO': } + def __eq__(self, other: typing.Any) -> bool: ... + def __getstate__(self) -> int: ... + def __hash__(self) -> int: ... + def __index__(self) -> int: ... + def __init__(self, value: typing.SupportsInt) -> None: ... + def __int__(self) -> int: ... + def __ne__(self, other: typing.Any) -> bool: ... + def __repr__(self) -> str: ... + def __setstate__(self, state: typing.SupportsInt) -> None: ... + def __str__(self) -> str: ... + @property + def name(self) -> str: ... + @property + def value(self) -> int: ... + + value: Outer.Inner.NestedEnum + + inner: Outer.Inner diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi new file mode 100644 index 00000000..afe7ccb3 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi @@ -0,0 +1,75 @@ +from __future__ import annotations + +import typing + +import numpy +import numpy.typing +import scipy.sparse + +__all__: list[str] = [ + "accept_matrix_int", + "accept_vector_float64", + "dense_matrix_c", + "dense_matrix_r", + "fixed_mutator_a", + "fixed_mutator_c", + "fixed_mutator_r", + "four_col_matrix_r", + "four_row_matrix_r", + "get_matrix_int", + "get_vector_float64", + "sparse_matrix_c", + "sparse_matrix_r", +] + +def accept_matrix_int( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.int32, "[3, 3]"], +) -> None: ... +def accept_vector_float64( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"], +) -> None: ... +def dense_matrix_c( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, n]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]: ... +def dense_matrix_r( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, n]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]: ... +def fixed_mutator_a( + arg0: typing.Annotated[ + numpy.typing.NDArray[numpy.float32], "[5, 6]", "flags.writeable" + ], +) -> None: ... +def fixed_mutator_c( + arg0: typing.Annotated[ + numpy.typing.NDArray[numpy.float32], + "[5, 6]", + "flags.writeable", + "flags.f_contiguous", + ], +) -> None: ... +def fixed_mutator_r( + arg0: typing.Annotated[ + numpy.typing.NDArray[numpy.float32], + "[5, 6]", + "flags.writeable", + "flags.c_contiguous", + ], +) -> None: ... +def four_col_matrix_r( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, 4]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, 4]"]: ... +def four_row_matrix_r( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[4, n]"], +) -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[4, n]"]: ... +def get_matrix_int() -> ( + typing.Annotated[numpy.typing.NDArray[numpy.int32], "[3, 3]"] +): ... +def get_vector_float64() -> ( + typing.Annotated[numpy.typing.NDArray[numpy.float64], "[3, 1]"] +): ... +def sparse_matrix_c( + arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32], +) -> typing.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... +def sparse_matrix_r( + arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32], +) -> typing.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi new file mode 100644 index 00000000..a994e39a --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi @@ -0,0 +1,71 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = [ + "Blue", + "ConsoleForegroundColor", + "Green", + "Magenta", + "None_", + "Yellow", + "accept_defaulted_enum", +] + +class ConsoleForegroundColor: + """ + Members: + + Green + + Yellow + + Blue + + Magenta + + None_ + """ + + Blue: typing.ClassVar[ + ConsoleForegroundColor + ] # value = + Green: typing.ClassVar[ + ConsoleForegroundColor + ] # value = + Magenta: typing.ClassVar[ + ConsoleForegroundColor + ] # value = + None_: typing.ClassVar[ + ConsoleForegroundColor + ] # value = + Yellow: typing.ClassVar[ + ConsoleForegroundColor + ] # value = + __members__: typing.ClassVar[ + dict[str, ConsoleForegroundColor] + ] # value = {'Green': , 'Yellow': , 'Blue': , 'Magenta': , 'None_': } + def __eq__(self, other: typing.Any) -> bool: ... + def __getstate__(self) -> int: ... + def __hash__(self) -> int: ... + def __index__(self) -> int: ... + def __init__(self, value: typing.SupportsInt) -> None: ... + def __int__(self) -> int: ... + def __ne__(self, other: typing.Any) -> bool: ... + def __repr__(self) -> str: ... + def __setstate__(self, state: typing.SupportsInt) -> None: ... + def __str__(self) -> str: ... + @property + def name(self) -> str: ... + @property + def value(self) -> int: ... + +def accept_defaulted_enum( + color: ConsoleForegroundColor = ConsoleForegroundColor.None_, +) -> None: ... + +Blue: ConsoleForegroundColor # value = +Green: ConsoleForegroundColor # value = +Magenta: ConsoleForegroundColor # value = +None_: ConsoleForegroundColor # value = +Yellow: ConsoleForegroundColor # value = diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi new file mode 100644 index 00000000..d95bbb35 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi @@ -0,0 +1,25 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = [ + "Enum", + "Unbound", + "accept_unbound_enum", + "accept_unbound_enum_defaulted", + "accept_unbound_type", + "accept_unbound_type_defaulted", + "get_unbound_type", +] + +class Enum: + pass + +class Unbound: + pass + +def accept_unbound_enum(arg0: ...) -> int: ... +def accept_unbound_enum_defaulted(x: Enum = ...) -> int: ... +def accept_unbound_type(arg0: tuple[..., typing.SupportsInt]) -> int: ... +def accept_unbound_type_defaulted(x: Unbound = ...) -> int: ... +def get_unbound_type() -> ...: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi new file mode 100644 index 00000000..99710ab0 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi @@ -0,0 +1,74 @@ +from __future__ import annotations + +import collections.abc +import typing + +__all__: list[str] = [ + "Foo", + "accept_annotated_callable", + "accept_callable", + "accept_frozenset", + "accept_py_handle", + "accept_py_object", + "accept_set", + "add", + "default_custom_arg", + "default_int_arg", + "default_list_arg", + "default_optional_arg", + "func_w_anon_args", + "func_w_named_pos_args", + "generic", + "mul", + "pass_callback", + "pos_kw_only_mix", + "pos_kw_only_variadic_mix", +] + +class Foo: + def __init__(self, arg0: typing.SupportsInt) -> None: ... + +def accept_annotated_callable( + arg0: collections.abc.Callable[[typing.SupportsInt, typing.SupportsInt], int], +) -> typing.Any: ... +def accept_callable(arg0: collections.abc.Callable) -> typing.Any: ... +def accept_frozenset(arg0: frozenset) -> None: ... +def accept_py_handle(arg0: typing.Any) -> str: ... +def accept_py_object(arg0: typing.Any) -> str: ... +def accept_set(arg0: set) -> None: ... +def add(arg0: typing.SupportsInt, arg1: typing.SupportsInt) -> int: ... +def default_custom_arg(foo: Foo = Foo(5)) -> None: ... +def default_int_arg(n: typing.SupportsInt = 5) -> None: ... +def default_list_arg(l: list = [1, 2, 6, 18]) -> None: ... +def default_optional_arg(n: typing.SupportsInt | None = None) -> None: ... +def func_w_anon_args( + arg0: typing.SupportsInt, arg1: typing.SupportsInt, arg2: typing.SupportsInt +) -> None: ... +def func_w_named_pos_args( + x: typing.SupportsInt, y: typing.SupportsInt, z: typing.SupportsInt +) -> None: ... +def generic(*args, **kwargs) -> None: ... +@typing.overload +def mul(x: typing.SupportsInt, y: typing.SupportsInt) -> int: + """ + Multiply x and y (int) + """ + +@typing.overload +def mul(p: typing.SupportsFloat, q: typing.SupportsFloat) -> float: + """ + Multiply p and q (double) + """ + +def pass_callback(arg0: collections.abc.Callable[[Foo], Foo]) -> Foo: ... +def pos_kw_only_mix( + i: typing.SupportsInt, /, j: typing.SupportsInt, *, k: typing.SupportsInt +) -> tuple: ... +def pos_kw_only_variadic_mix( + i: typing.SupportsInt, + /, + j: typing.SupportsInt, + *args, + k: typing.SupportsInt, + **kwargs, +) -> tuple: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi new file mode 100644 index 00000000..165940ce --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi @@ -0,0 +1,39 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = [ + "backslashes_should_be_escaped", + "issue_51_catastrophic_regex", + "issue_73_utf8_doc_chars", +] + +def backslashes_should_be_escaped() -> None: + """ + \\brief A brief description of this function. + + A detailed description of this function. + + Here's some reStructuredText: :math:`x = [x, y, \\theta]^T` + """ + +def issue_51_catastrophic_regex( + arg0: typing.SupportsInt, arg1: typing.SupportsInt +) -> None: + """ + Use-case: + issue_51(os.get_handle_inheritable, os.set_handle_inheritable) + """ + +def issue_73_utf8_doc_chars() -> None: + """ + Construct a Ramsete unicycle controller. + + Tuning parameter (b > 0 rad²/m²) for which larger values make + + convergence more aggressive like a proportional term. + Tuning parameter (0 rad⁻¹ < zeta < 1 rad⁻¹) for which larger + values provide more damping in response. + """ + +_cleanup: typing.Any # value = diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi new file mode 100644 index 00000000..406a3011 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi @@ -0,0 +1,10 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = ["Dummy"] + +class Dummy: + @staticmethod + def static_method(arg0: typing.SupportsInt) -> int: ... + def regular_method(self, arg0: typing.SupportsInt) -> int: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi new file mode 100644 index 00000000..ca0a64b9 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi @@ -0,0 +1,24 @@ +from __future__ import annotations + +import typing + +import numpy +import numpy.typing + +__all__: list[str] = [ + "accept_ndarray_float64", + "accept_ndarray_int", + "get_ndarray_float64", + "get_ndarray_int", + "return_dtype", +] + +def accept_ndarray_float64( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float64], +) -> None: ... +def accept_ndarray_int( + arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.int32], +) -> None: ... +def get_ndarray_float64() -> numpy.typing.NDArray[numpy.float64]: ... +def get_ndarray_int() -> numpy.typing.NDArray[numpy.int32]: ... +def return_dtype() -> numpy.dtype[typing.Any]: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi new file mode 100644 index 00000000..0c9632ad --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi @@ -0,0 +1,112 @@ +from __future__ import annotations + +import typing + +__all__: list[str] = [ + "WithGetterSetterDoc", + "WithPropAndGetterSetterDoc", + "WithPropDoc", + "WithoutDoc", +] + +class WithGetterSetterDoc: + """ + User docstring provided via pybind11::cpp_function(..., doc) to getters/setters, but NOT to `def_*(..., doc)` calls + """ + + def_property_readonly_static: typing.ClassVar[int] = 0 + def_property_static: typing.ClassVar[int] = 0 + @property + def def_property(self) -> int: + """ + getter doc token + """ + + @def_property.setter + def def_property(self, arg1: typing.SupportsInt) -> None: + """ + setter doc token + """ + + @property + def def_property_readonly(self) -> int: + """ + getter doc token + """ + +class WithPropAndGetterSetterDoc: + """ + User docstring provided via pybind11::cpp_function(..., doc) to getters/setters and to `def_*(, doc)` calls + """ + + def_property_readonly_static: typing.ClassVar[int] = 0 + def_property_static: typing.ClassVar[int] = 0 + @property + def def_property(self) -> int: + """ + prop doc token + """ + + @def_property.setter + def def_property(self, arg1: typing.SupportsInt) -> None: ... + @property + def def_property_readonly(self) -> int: + """ + prop doc token + """ + +class WithPropDoc: + """ + User docstring provided only to `def_` calls + """ + + def_property_readonly_static: typing.ClassVar[int] = 0 + def_property_static: typing.ClassVar[int] = 0 + @property + def def_property(self) -> int: + """ + prop doc token + """ + + @def_property.setter + def def_property(self, arg1: typing.SupportsInt) -> None: ... + @property + def def_property_readonly(self) -> int: + """ + prop doc token + """ + + @property + def def_readonly(self) -> int: + """ + prop doc token + """ + + @property + def def_readwrite(self) -> int: + """ + prop doc token + """ + + @def_readwrite.setter + def def_readwrite(self, arg0: typing.SupportsInt) -> None: ... + +class WithoutDoc: + """ + No user docstring provided + """ + + def_property_readonly_static: typing.ClassVar[int] = 0 + def_property_static: typing.ClassVar[int] = 0 + @property + def def_property(self) -> int: ... + @def_property.setter + def def_property(self, arg1: typing.SupportsInt) -> None: ... + @property + def def_property_readonly(self) -> int: ... + @property + def def_readonly(self) -> int: ... + @property + def def_readwrite(self) -> int: ... + @def_readwrite.setter + def def_readwrite(self, arg0: typing.SupportsInt) -> None: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi new file mode 100644 index 00000000..12833c68 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi @@ -0,0 +1,28 @@ +from __future__ import annotations + +import collections.abc +import typing + +__all__: list[str] = [ + "std_array", + "std_map", + "std_optional", + "std_variant", + "std_vector", +] + +def std_array( + arg0: typing.Annotated[ + collections.abc.Sequence[typing.SupportsInt], "FixedSize(3)" + ], +) -> typing.Annotated[list[int], "FixedSize(3)"]: ... +def std_map() -> dict[int, complex]: ... +def std_optional(arg0: typing.SupportsInt | None) -> None: ... +def std_variant( + arg0: ( + typing.SupportsInt + | typing.SupportsFloat + | tuple[typing.SupportsInt, typing.SupportsInt] + ), +) -> None: ... +def std_vector() -> list[tuple[int, float]]: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi new file mode 100644 index 00000000..32f31d42 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi @@ -0,0 +1,146 @@ +from __future__ import annotations + +import collections.abc +import typing + +__all__: list[str] = [ + "MapStringComplex", + "VectorPairStringDouble", + "get_complex_map", + "get_vector_of_pairs", +] + +class MapStringComplex: + def __bool__(self) -> bool: + """ + Check whether the map is nonempty + """ + + @typing.overload + def __contains__(self, arg0: str) -> bool: ... + @typing.overload + def __contains__(self, arg0: typing.Any) -> bool: ... + def __delitem__(self, arg0: str) -> None: ... + def __getitem__(self, arg0: str) -> complex: ... + def __init__(self) -> None: ... + def __iter__(self) -> collections.abc.Iterator[str]: ... + def __len__(self) -> int: ... + def __repr__(self) -> str: + """ + Return the canonical string representation of this map. + """ + + def __setitem__(self, arg0: str, arg1: complex) -> None: ... + def items(self) -> typing.ItemsView: ... + def keys(self) -> typing.KeysView: ... + def values(self) -> typing.ValuesView: ... + +class VectorPairStringDouble: + __hash__: typing.ClassVar[None] = None + def __bool__(self) -> bool: + """ + Check whether the list is nonempty + """ + + def __contains__(self, x: tuple[str, typing.SupportsFloat]) -> bool: + """ + Return true the container contains ``x`` + """ + + @typing.overload + def __delitem__(self, arg0: typing.SupportsInt) -> None: + """ + Delete the list elements at index ``i`` + """ + + @typing.overload + def __delitem__(self, arg0: slice) -> None: + """ + Delete list elements using a slice object + """ + + def __eq__(self, arg0: VectorPairStringDouble) -> bool: ... + @typing.overload + def __getitem__(self, s: slice) -> VectorPairStringDouble: + """ + Retrieve list elements using a slice object + """ + + @typing.overload + def __getitem__(self, arg0: typing.SupportsInt) -> tuple[str, float]: ... + @typing.overload + def __init__(self) -> None: ... + @typing.overload + def __init__(self, arg0: VectorPairStringDouble) -> None: + """ + Copy constructor + """ + + @typing.overload + def __init__(self, arg0: collections.abc.Iterable) -> None: ... + def __iter__(self) -> collections.abc.Iterator[tuple[str, float]]: ... + def __len__(self) -> int: ... + def __ne__(self, arg0: VectorPairStringDouble) -> bool: ... + @typing.overload + def __setitem__( + self, arg0: typing.SupportsInt, arg1: tuple[str, typing.SupportsFloat] + ) -> None: ... + @typing.overload + def __setitem__(self, arg0: slice, arg1: VectorPairStringDouble) -> None: + """ + Assign list elements using a slice object + """ + + def append(self, x: tuple[str, typing.SupportsFloat]) -> None: + """ + Add an item to the end of the list + """ + + def clear(self) -> None: + """ + Clear the contents + """ + + def count(self, x: tuple[str, typing.SupportsFloat]) -> int: + """ + Return the number of times ``x`` appears in the list + """ + + @typing.overload + def extend(self, L: VectorPairStringDouble) -> None: + """ + Extend the list by appending all the items in the given list + """ + + @typing.overload + def extend(self, L: collections.abc.Iterable) -> None: + """ + Extend the list by appending all the items in the given list + """ + + def insert( + self, i: typing.SupportsInt, x: tuple[str, typing.SupportsFloat] + ) -> None: + """ + Insert an item at a given position. + """ + + @typing.overload + def pop(self) -> tuple[str, float]: + """ + Remove and return the last item + """ + + @typing.overload + def pop(self, i: typing.SupportsInt) -> tuple[str, float]: + """ + Remove and return the item at index ``i`` + """ + + def remove(self, x: tuple[str, typing.SupportsFloat]) -> None: + """ + Remove the first item from the list whose value is x. It is an error if there is no such item. + """ + +def get_complex_map() -> MapStringComplex: ... +def get_vector_of_pairs() -> VectorPairStringDouble: ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi new file mode 100644 index 00000000..98fd047b --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi @@ -0,0 +1,8 @@ +from __future__ import annotations + +import collections.abc + +__all__: list[str] = ["get_buffer", "get_sequence"] + +def get_buffer(arg0: collections.abc.Buffer) -> collections.abc.Buffer: ... +def get_sequence(arg0: collections.abc.Sequence) -> collections.abc.Sequence: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/core.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/core.pyi diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi new file mode 100644 index 00000000..10d343e0 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi @@ -0,0 +1,11 @@ +from __future__ import annotations + +from . import classes, functions, functions_3_8_plus, functions_3_9_plus, values + +__all__: list[str] = [ + "classes", + "functions", + "functions_3_8_plus", + "functions_3_9_plus", + "values", +] diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi similarity index 79% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi index ce1e49d1..5ed9ef3c 100644 --- a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi @@ -3,10 +3,15 @@ from __future__ import annotations import sys as sys import typing as typing +from demo.pure_python.functions_3_8_plus import args_mix +from demo.pure_python.functions_3_9_plus import generic_alias_annotation + __all__: list[str] = [ "accept_frozenset", + "args_mix", "builtin_function_as_default_arg", "function_as_default_arg", + "generic_alias_annotation", "lambda_as_default_arg", "search", "static_method_as_default_arg", diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi new file mode 100644 index 00000000..e9164220 --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi @@ -0,0 +1,15 @@ +from __future__ import annotations + +import typing as typing + +__all__: list[str] = ["args_mix", "typing"] + +def args_mix( + a: int, + b: float = 0.5, + c: str = "", + *args: int, + x: int = 1, + y=int, + **kwargs: typing.Dict[int, str], +): ... diff --git a/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_9_plus.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_9_plus.pyi new file mode 100644 index 00000000..59b9b80c --- /dev/null +++ b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_9_plus.pyi @@ -0,0 +1,5 @@ +from __future__ import annotations + +__all__: list[str] = ["generic_alias_annotation"] + +def generic_alias_annotation(a: list[tuple[int]], b: dict[int, str]) -> list[float]: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi b/tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi rename to tests/stubs/python-3.12/pybind11-v3.0/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi diff --git a/tests/stubs/python-3.12/requirements.txt b/tests/stubs/python-3.12/requirements.txt index 7c84e9c8..b5a3f6b2 100644 --- a/tests/stubs/python-3.12/requirements.txt +++ b/tests/stubs/python-3.12/requirements.txt @@ -1,4 +1,4 @@ -black==22.8.0 +black==25.1.0 cmeel-eigen==3.4.0.2 isort==5.10.1 numpy~=1.20 diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi b/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi deleted file mode 100644 index eebf4a5c..00000000 --- a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import annotations - -import typing - -__all__: list[str] = [ - "Foo", - "accept_annotated_callable", - "accept_callable", - "accept_frozenset", - "accept_py_handle", - "accept_py_object", - "accept_set", - "add", - "default_custom_arg", - "default_int_arg", - "default_list_arg", - "default_optional_arg", - "func_w_anon_args", - "func_w_named_pos_args", - "generic", - "mul", - "pass_callback", - "pos_kw_only_mix", - "pos_kw_only_variadic_mix", -] - -class Foo: - def __init__(self, arg0: int) -> None: ... - -def accept_annotated_callable(arg0: typing.Callable[[int, int], int]) -> typing.Any: ... -def accept_callable(arg0: typing.Callable) -> typing.Any: ... -def accept_frozenset(arg0: frozenset) -> None: ... -def accept_py_handle(arg0: typing.Any) -> str: ... -def accept_py_object(arg0: typing.Any) -> str: ... -def accept_set(arg0: set) -> None: ... -def add(arg0: int, arg1: int) -> int: ... -def default_custom_arg(foo: Foo = Foo(5)) -> None: ... -def default_int_arg(n: int = 5) -> None: ... -def default_list_arg(l: list = [1, 2, 6, 18]) -> None: ... -def default_optional_arg(n: int | None = None) -> None: ... -def func_w_anon_args(arg0: int, arg1: int, arg2: int) -> None: ... -def func_w_named_pos_args(x: int, y: int, z: int) -> None: ... -def generic(*args, **kwargs) -> None: ... -@typing.overload -def mul(x: int, y: int) -> int: - """ - Multiply x and y (int) - """ - -@typing.overload -def mul(p: float, q: float) -> float: - """ - Multiply p and q (double) - """ - -def pass_callback(arg0: typing.Callable[[Foo], Foo]) -> Foo: ... -def pos_kw_only_mix(i: int, j: int, *, k: int) -> tuple: ... -def pos_kw_only_variadic_mix(i: int, j: int, *args, k: int, **kwargs) -> tuple: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi b/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi deleted file mode 100644 index f61888ee..00000000 --- a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from . import classes, functions, values - -__all__: list[str] = ["classes", "functions", "values"] diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi b/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi deleted file mode 100644 index 6c115cd1..00000000 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import annotations - -__all__: list[str] = ["Dummy"] - -class Dummy: - @staticmethod - def static_method(arg0: int) -> int: ... - def regular_method(self, arg0: int) -> int: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi b/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi deleted file mode 100644 index f2c4ab95..00000000 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import annotations - -import typing - -import typing_extensions - -__all__: list[str] = ["get_buffer", "get_sequence"] - -def get_buffer(arg0: typing_extensions.Buffer) -> typing_extensions.Buffer: ... -def get_sequence(arg0: typing.Sequence) -> typing.Sequence: ... diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi b/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi deleted file mode 100644 index c0243fb7..00000000 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from . import classes, functions, functions_3_8_plus, values - -__all__: list[str] = ["classes", "functions", "functions_3_8_plus", "values"] diff --git a/tests/stubs/python-3.8/requirements.txt b/tests/stubs/python-3.8/requirements.txt deleted file mode 100644 index 7c84e9c8..00000000 --- a/tests/stubs/python-3.8/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -black==22.8.0 -cmeel-eigen==3.4.0.2 -isort==5.10.1 -numpy~=1.20 -scipy~=1.0 -typing_extensions==4.7.1 diff --git a/tests/stubs/python-3.9 b/tests/stubs/python-3.9 deleted file mode 120000 index f31904fc..00000000 --- a/tests/stubs/python-3.9 +++ /dev/null @@ -1 +0,0 @@ -python-3.10 \ No newline at end of file diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi new file mode 100644 index 00000000..86fb6b84 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/__init__.pyi @@ -0,0 +1,41 @@ +from __future__ import annotations + +from demo._bindings import ( + aliases, + classes, + eigen, + enum, + flawed_bindings, + functions, + issues, + methods, + numpy, + properties, + stl, + stl_bind, + typing, + values, +) + +from . import _bindings, core, pure_python + +__all__: list[str] = [ + "aliases", + "classes", + "core", + "eigen", + "enum", + "flawed_bindings", + "functions", + "issues", + "methods", + "numpy", + "properties", + "pure_python", + "stl", + "stl_bind", + "typing", + "values", + "version", +] +version: str = "0.0.0" diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi new file mode 100644 index 00000000..c263078f --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi @@ -0,0 +1,35 @@ +from __future__ import annotations + +from . import ( + aliases, + classes, + eigen, + enum, + flawed_bindings, + functions, + issues, + methods, + numpy, + properties, + stl, + stl_bind, + typing, + values, +) + +__all__: list[str] = [ + "aliases", + "classes", + "eigen", + "enum", + "flawed_bindings", + "functions", + "issues", + "methods", + "numpy", + "properties", + "stl", + "stl_bind", + "typing", + "values", +] diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi new file mode 100644 index 00000000..de75e6fb --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi @@ -0,0 +1,7 @@ +from __future__ import annotations + +import demo._bindings.classes + +__all__: list[str] = ["set_foo"] + +def set_foo(arg0: demo._bindings.classes.Foo) -> int: ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi new file mode 100644 index 00000000..10c4a712 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi @@ -0,0 +1,6 @@ +from __future__ import annotations + +import demo._bindings.classes + +__all__: list[str] = ["value"] +value: demo._bindings.classes.Foo # value = diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi new file mode 100644 index 00000000..497a4e2a --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi @@ -0,0 +1,12 @@ +from __future__ import annotations + +import typing + +import demo._bindings.classes + +__all__: list[str] = ["Bar1"] + +class Bar1: + foo: typing.ClassVar[ + demo._bindings.classes.Foo + ] # value = diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi new file mode 100644 index 00000000..8d4ed4ac --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi @@ -0,0 +1,8 @@ +from __future__ import annotations + +import demo._bindings.classes + +__all__: list[str] = ["Bar2"] + +class Bar2: + def set_foo(self, arg0: demo._bindings.classes.Foo) -> int: ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi new file mode 100644 index 00000000..95d218e1 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi @@ -0,0 +1,9 @@ +from __future__ import annotations + +import demo._bindings.classes + +__all__: list[str] = ["Bar3"] + +class Bar3: + @staticmethod + def get_foo() -> demo._bindings.classes.Foo: ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi new file mode 100644 index 00000000..7b5b428f --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi @@ -0,0 +1,7 @@ +from __future__ import annotations + +import demo._bindings.classes + +__all__: list[str] = ["get_foo"] + +def get_foo() -> demo._bindings.classes.Foo: ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi new file mode 100644 index 00000000..ee1a09ee --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/aliases/missing_self_arg.pyi @@ -0,0 +1,8 @@ +from __future__ import annotations + +import demo._bindings.classes + +__all__: list[str] = ["Bar4"] + +class Bar4: + def set_foo(self: demo._bindings.classes.Foo) -> int: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/classes.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi similarity index 71% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi index a75e8c15..8e453374 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/eigen.pyi @@ -1,9 +1,10 @@ from __future__ import annotations +import typing + import numpy import pybind11_stubgen.typing_ext import scipy.sparse -import typing_extensions __all__: list[str] = [ "accept_matrix_int", @@ -22,31 +23,31 @@ __all__: list[str] = [ ] def accept_matrix_int( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) ] ) -> None: ... def accept_vector_float64( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) ] ) -> None: ... def dense_matrix_c( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ] -) -> typing_extensions.Annotated[ +) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... def dense_matrix_r( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ] -) -> typing_extensions.Annotated[ +) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", "n") ]: ... def fixed_mutator_a( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), @@ -54,7 +55,7 @@ def fixed_mutator_a( ] ) -> None: ... def fixed_mutator_c( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), @@ -63,7 +64,7 @@ def fixed_mutator_c( ] ) -> None: ... def fixed_mutator_r( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.FixedSize(5, 6), @@ -72,28 +73,28 @@ def fixed_mutator_r( ] ) -> None: ... def four_col_matrix_r( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) ] -) -> typing_extensions.Annotated[ +) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize("m", 4) ]: ... def four_row_matrix_r( - arg0: typing_extensions.Annotated[ + arg0: typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") ] -) -> typing_extensions.Annotated[ +) -> typing.Annotated[ numpy.ndarray, numpy.float32, pybind11_stubgen.typing_ext.DynamicSize(4, "n") ]: ... -def get_matrix_int() -> typing_extensions.Annotated[ +def get_matrix_int() -> typing.Annotated[ numpy.ndarray, numpy.int32, pybind11_stubgen.typing_ext.FixedSize(3, 3) ]: ... -def get_vector_float64() -> typing_extensions.Annotated[ +def get_vector_float64() -> typing.Annotated[ numpy.ndarray, numpy.float64, pybind11_stubgen.typing_ext.FixedSize(3, 1) ]: ... def sparse_matrix_c( - arg0: typing_extensions.Annotated[scipy.sparse.csc_matrix, numpy.float32] -) -> typing_extensions.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... + arg0: typing.Annotated[scipy.sparse.csc_matrix, numpy.float32] +) -> typing.Annotated[scipy.sparse.csc_matrix, numpy.float32]: ... def sparse_matrix_r( - arg0: typing_extensions.Annotated[scipy.sparse.csr_matrix, numpy.float32] -) -> typing_extensions.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... + arg0: typing.Annotated[scipy.sparse.csr_matrix, numpy.float32] +) -> typing.Annotated[scipy.sparse.csr_matrix, numpy.float32]: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/enum.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/flawed_bindings.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi similarity index 100% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/functions.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/issues.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/methods.pyi diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi new file mode 100644 index 00000000..e211caaf --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/numpy.pyi @@ -0,0 +1,21 @@ +from __future__ import annotations + +import typing + +import numpy + +__all__: list[str] = [ + "accept_ndarray_float64", + "accept_ndarray_int", + "get_ndarray_float64", + "get_ndarray_int", + "return_dtype", +] + +def accept_ndarray_float64( + arg0: typing.Annotated[numpy.ndarray, numpy.float64] +) -> None: ... +def accept_ndarray_int(arg0: typing.Annotated[numpy.ndarray, numpy.int32]) -> None: ... +def get_ndarray_float64() -> typing.Annotated[numpy.ndarray, numpy.float64]: ... +def get_ndarray_int() -> typing.Annotated[numpy.ndarray, numpy.int32]: ... +def return_dtype() -> numpy.dtype[typing.Any]: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/properties.pyi diff --git a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi similarity index 64% rename from tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi index 906037e7..bd5bb496 100644 --- a/tests/stubs/python-3.8/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import typing import pybind11_stubgen.typing_ext -import typing_extensions __all__: list[str] = [ "std_array", @@ -14,12 +13,8 @@ __all__: list[str] = [ ] def std_array( - arg0: typing_extensions.Annotated[ - list[int], pybind11_stubgen.typing_ext.FixedSize(3) - ] -) -> typing_extensions.Annotated[ - list[int], pybind11_stubgen.typing_ext.FixedSize(3) -]: ... + arg0: typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)] +) -> typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(3)]: ... def std_map() -> dict[int, complex]: ... def std_optional(arg0: int | None) -> None: ... def std_variant(arg0: int | float | tuple[int, int]) -> None: ... diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/stl_bind.pyi diff --git a/tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi similarity index 100% rename from tests/stubs/python-3.7/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi rename to tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/typing.pyi diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi new file mode 100644 index 00000000..7c36d3fd --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/_bindings/values.pyi @@ -0,0 +1,36 @@ +from __future__ import annotations + +import datetime + +import numpy +from numpy import random + +__all__: list[str] = [ + "Dummy", + "Foo", + "add_day", + "foolist", + "foovar", + "list_with_none", + "none", + "random", + "t_10ms", + "t_20ns", + "t_30s", +] + +class Dummy: + linalg = numpy.linalg + +class Foo: + pass + +def add_day(arg0: datetime.datetime) -> datetime.datetime: ... + +foolist: list # value = [, ] +foovar: Foo # value = +list_with_none: list = [None, 2, {}] +none = None +t_10ms: datetime.timedelta # value = datetime.timedelta(microseconds=10000) +t_20ns: datetime.timedelta # value = datetime.timedelta(0) +t_30s: datetime.timedelta # value = datetime.timedelta(seconds=30) diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi new file mode 100644 index 00000000..95c16467 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/core.pyi @@ -0,0 +1,35 @@ +from __future__ import annotations + +from demo._bindings import ( + aliases, + classes, + eigen, + enum, + flawed_bindings, + functions, + issues, + methods, + numpy, + properties, + stl, + stl_bind, + typing, + values, +) + +__all__: list[str] = [ + "aliases", + "classes", + "eigen", + "enum", + "flawed_bindings", + "functions", + "issues", + "methods", + "numpy", + "properties", + "stl", + "stl_bind", + "typing", + "values", +] diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi new file mode 100644 index 00000000..10d343e0 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/__init__.pyi @@ -0,0 +1,11 @@ +from __future__ import annotations + +from . import classes, functions, functions_3_8_plus, functions_3_9_plus, values + +__all__: list[str] = [ + "classes", + "functions", + "functions_3_8_plus", + "functions_3_9_plus", + "values", +] diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi new file mode 100644 index 00000000..32aa068b --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/classes.pyi @@ -0,0 +1,21 @@ +from __future__ import annotations + +__all__: list[str] = ["A", "B", "C", "X"] + +class A: + """ + A + """ + +class B(A): + """ + B + """ + +class C(B): + """ + C + """ + +class X: + pass diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi new file mode 100644 index 00000000..5ed9ef3c --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions.pyi @@ -0,0 +1,31 @@ +from __future__ import annotations + +import sys as sys +import typing as typing + +from demo.pure_python.functions_3_8_plus import args_mix +from demo.pure_python.functions_3_9_plus import generic_alias_annotation + +__all__: list[str] = [ + "accept_frozenset", + "args_mix", + "builtin_function_as_default_arg", + "function_as_default_arg", + "generic_alias_annotation", + "lambda_as_default_arg", + "search", + "static_method_as_default_arg", + "sys", + "typing", +] + +class _Dummy: + @staticmethod + def foo(): ... + +def accept_frozenset(arg: frozenset[int | float]) -> int | None: ... +def builtin_function_as_default_arg(func: type(len) = len): ... +def function_as_default_arg(func: type(search) = search): ... +def lambda_as_default_arg(callback=...): ... +def search(a: int, b: list[int]) -> int: ... +def static_method_as_default_arg(callback=_Dummy.foo): ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi new file mode 100644 index 00000000..e9164220 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi @@ -0,0 +1,15 @@ +from __future__ import annotations + +import typing as typing + +__all__: list[str] = ["args_mix", "typing"] + +def args_mix( + a: int, + b: float = 0.5, + c: str = "", + *args: int, + x: int = 1, + y=int, + **kwargs: typing.Dict[int, str], +): ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_9_plus.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_9_plus.pyi new file mode 100644 index 00000000..59b9b80c --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_9_plus.pyi @@ -0,0 +1,5 @@ +from __future__ import annotations + +__all__: list[str] = ["generic_alias_annotation"] + +def generic_alias_annotation(a: list[tuple[int]], b: dict[int, str]) -> list[float]: ... diff --git a/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi new file mode 100644 index 00000000..07913391 --- /dev/null +++ b/tests/stubs/python-3.9/pybind11-v2.13/numpy-array-wrap-with-annotated/demo/pure_python/values.pyi @@ -0,0 +1,4 @@ +from __future__ import annotations + +__all__: list[str] = ["callables_dict"] +callables_dict: dict = {"len": len, "int": int} diff --git a/tests/stubs/python-3.7/requirements.txt b/tests/stubs/python-3.9/requirements.txt similarity index 100% rename from tests/stubs/python-3.7/requirements.txt rename to tests/stubs/python-3.9/requirements.txt