From 80c113e1d8f8018ec95db37f3b2b60ee920e0e61 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 26 Jan 2026 12:41:35 +0000 Subject: [PATCH] Update black and reformat The pinned version of Black was a few years old --- pybind11_stubgen/parser/interface.py | 60 +++++++------------ requirements-dev.txt | 2 +- tests/py-demo/demo/pure_python/functions.py | 15 ++--- .../demo/pure_python/functions_3_8_plus.py | 3 +- .../demo/pure_python/functions_3_9_plus.py | 3 +- .../demo/_bindings/classes.pyi | 3 + .../demo/_bindings/eigen.pyi | 38 ++++++------ .../demo/_bindings/numpy.pyi | 2 +- .../demo/_bindings/properties.pyi | 7 +++ .../demo/_bindings/stl.pyi | 2 +- .../demo/_bindings/stl_bind.pyi | 17 ++++++ .../demo/_bindings/classes.pyi | 3 + .../demo/_bindings/eigen.pyi | 38 ++++++------ .../demo/_bindings/numpy.pyi | 2 +- .../demo/_bindings/properties.pyi | 7 +++ .../demo/_bindings/stl.pyi | 2 +- .../demo/_bindings/stl_bind.pyi | 17 ++++++ .../demo/_bindings/classes.pyi | 3 + .../demo/_bindings/eigen.pyi | 32 +++++----- .../demo/_bindings/numpy.pyi | 4 +- .../demo/_bindings/properties.pyi | 7 +++ .../demo/_bindings/stl.pyi | 2 +- .../demo/_bindings/stl_bind.pyi | 17 ++++++ .../demo/_bindings/classes.pyi | 3 + .../demo/_bindings/eigen.pyi | 38 ++++++------ .../demo/_bindings/numpy.pyi | 2 +- .../demo/_bindings/properties.pyi | 7 +++ .../demo/_bindings/stl.pyi | 2 +- .../demo/_bindings/stl_bind.pyi | 17 ++++++ .../demo/_bindings/classes.pyi | 3 + .../demo/_bindings/eigen.pyi | 38 ++++++------ .../demo/_bindings/numpy.pyi | 2 +- .../demo/_bindings/properties.pyi | 7 +++ .../demo/_bindings/stl_bind.pyi | 17 ++++++ tests/stubs/python-3.12/requirements.txt | 2 +- 35 files changed, 275 insertions(+), 149 deletions(-) diff --git a/pybind11_stubgen/parser/interface.py b/pybind11_stubgen/parser/interface.py index 871d463b..86a4f882 100644 --- a/pybind11_stubgen/parser/interface.py +++ b/pybind11_stubgen/parser/interface.py @@ -26,93 +26,73 @@ class IParser(abc.ABC): @abc.abstractmethod - def handle_alias(self, path: QualifiedName, origin: Any) -> Alias | None: - ... + def handle_alias(self, path: QualifiedName, origin: Any) -> Alias | None: ... @abc.abstractmethod - def handle_attribute(self, path: QualifiedName, attr: Any) -> Attribute | None: - ... + def handle_attribute(self, path: QualifiedName, attr: Any) -> Attribute | None: ... @abc.abstractmethod def handle_bases( self, path: QualifiedName, bases: tuple[type, ...] - ) -> list[QualifiedName]: - ... + ) -> list[QualifiedName]: ... @abc.abstractmethod - def handle_class(self, path: QualifiedName, class_: type) -> Class | None: - ... + def handle_class(self, path: QualifiedName, class_: type) -> Class | None: ... @abc.abstractmethod def handle_class_member( self, path: QualifiedName, class_: type, obj: Any - ) -> Docstring | Alias | Class | list[Method] | Field | Property | None: - ... + ) -> Docstring | Alias | Class | list[Method] | Field | Property | None: ... @abc.abstractmethod - def handle_docstring(self, path: QualifiedName, doc: Any) -> Docstring | None: - ... + def handle_docstring(self, path: QualifiedName, doc: Any) -> Docstring | None: ... @abc.abstractmethod - def handle_field(self, path: QualifiedName, field: Any) -> Field | None: - ... + def handle_field(self, path: QualifiedName, field: Any) -> Field | None: ... @abc.abstractmethod - def handle_function(self, path: QualifiedName, func: Any) -> list[Function]: - ... + def handle_function(self, path: QualifiedName, func: Any) -> list[Function]: ... @abc.abstractmethod - def handle_import(self, path: QualifiedName, origin: Any) -> Import | None: - ... + def handle_import(self, path: QualifiedName, origin: Any) -> Import | None: ... @abc.abstractmethod - def handle_method(self, path: QualifiedName, method: Any) -> list[Method]: - ... + def handle_method(self, path: QualifiedName, method: Any) -> list[Method]: ... @abc.abstractmethod def handle_module( self, path: QualifiedName, module: types.ModuleType - ) -> Module | None: - ... + ) -> Module | None: ... @abc.abstractmethod def handle_module_member( self, path: QualifiedName, module: types.ModuleType, obj: Any ) -> ( Docstring | Import | Alias | Class | list[Function] | Attribute | Module | None - ): - ... + ): ... @abc.abstractmethod - def handle_property(self, path: QualifiedName, prop: Any) -> Property | None: - ... + def handle_property(self, path: QualifiedName, prop: Any) -> Property | None: ... @abc.abstractmethod - def handle_type(self, type_: type) -> QualifiedName: - ... + def handle_type(self, type_: type) -> QualifiedName: ... @abc.abstractmethod - def handle_value(self, value: Any) -> Value: - ... + def handle_value(self, value: Any) -> Value: ... @abc.abstractmethod - def parse_args_str(self, args_str: str) -> list[Argument]: - ... + def parse_args_str(self, args_str: str) -> list[Argument]: ... @abc.abstractmethod def parse_annotation_str( self, annotation_str: str - ) -> ResolvedType | InvalidExpression | Value: - ... + ) -> ResolvedType | InvalidExpression | Value: ... @abc.abstractmethod - def parse_value_str(self, value: str) -> Value | InvalidExpression: - ... + def parse_value_str(self, value: str) -> Value | InvalidExpression: ... @abc.abstractmethod - def report_error(self, error: ParserError) -> None: - ... + def report_error(self, error: ParserError) -> None: ... @abc.abstractmethod - def finalize(self): - ... + def finalize(self): ... diff --git a/requirements-dev.txt b/requirements-dev.txt index e4bea83c..c9ebf140 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -black==22.8.0 +black==26.1.0 flake8~=6.1.0 isort==5.10.1 numpy~=1.20 diff --git a/tests/py-demo/demo/pure_python/functions.py b/tests/py-demo/demo/pure_python/functions.py index 214c8394..c0177903 100644 --- a/tests/py-demo/demo/pure_python/functions.py +++ b/tests/py-demo/demo/pure_python/functions.py @@ -16,24 +16,19 @@ def foo(): return 42 -def search(a: int, b: list[int]) -> int: - ... +def search(a: int, b: list[int]) -> int: ... -def builtin_function_as_default_arg(func: type(len) = len): - ... +def builtin_function_as_default_arg(func: type(len) = len): ... -def function_as_default_arg(func: type(search) = search): - ... +def function_as_default_arg(func: type(search) = search): ... -def lambda_as_default_arg(callback=lambda val: 0): - ... +def lambda_as_default_arg(callback=lambda val: 0): ... -def static_method_as_default_arg(callback=_Dummy.foo): - ... +def static_method_as_default_arg(callback=_Dummy.foo): ... def accept_frozenset(arg: typing.FrozenSet[int | float]) -> int | None: diff --git a/tests/py-demo/demo/pure_python/functions_3_8_plus.py b/tests/py-demo/demo/pure_python/functions_3_8_plus.py index c1c38a9a..8dc4fc53 100644 --- a/tests/py-demo/demo/pure_python/functions_3_8_plus.py +++ b/tests/py-demo/demo/pure_python/functions_3_8_plus.py @@ -10,5 +10,4 @@ def args_mix( x: int = 1, y=int, **kwargs: typing.Dict[int, str], -): - ... +): ... diff --git a/tests/py-demo/demo/pure_python/functions_3_9_plus.py b/tests/py-demo/demo/pure_python/functions_3_9_plus.py index a44122c3..1add6f14 100644 --- a/tests/py-demo/demo/pure_python/functions_3_9_plus.py +++ b/tests/py-demo/demo/pure_python/functions_3_9_plus.py @@ -1,5 +1,4 @@ def generic_alias_annotation( a: list[tuple[int]], b: dict[int, str], -) -> list[float]: - ... +) -> list[float]: ... 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.12/requirements.txt b/tests/stubs/python-3.12/requirements.txt index 7c84e9c8..9406f160 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==26.1.0 cmeel-eigen==3.4.0.2 isort==5.10.1 numpy~=1.20