Skip to content

Commit 562ada4

Browse files
committed
chore: Update stubs
1 parent 37feafd commit 562ada4

File tree

60 files changed

+713
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+713
-214
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from __future__ import annotations
22

3+
import pybind11_stubgen.typing_ext
4+
35
import demo._bindings.classes
46

57
__all__ = ["value"]
6-
value: demo._bindings.classes.Foo # value = <demo._bindings.classes.Foo object>
8+
value: demo._bindings.classes.Foo = pybind11_stubgen.typing_ext.ValueExpr(
9+
"<demo._bindings.classes.Foo object>"
10+
)

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/aliases/foreign_class_member.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ from __future__ import annotations
22

33
import typing
44

5+
import pybind11_stubgen.typing_ext
6+
57
import demo._bindings.classes
68

79
__all__ = ["Bar1"]
810

911
class Bar1:
1012
foo: typing.ClassVar[
1113
demo._bindings.classes.Foo
12-
] # value = <demo._bindings.classes.Foo object>
14+
] = pybind11_stubgen.typing_ext.ValueExpr("<demo._bindings.classes.Foo object>")

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/classes.pyi

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from __future__ import annotations
22

33
import typing
44

5+
import pybind11_stubgen.typing_ext
6+
57
__all__ = ["Base", "CppException", "Derived", "Foo", "Outer"]
68

79
class Base:
@@ -34,11 +36,17 @@ class Outer:
3436
TWO
3537
"""
3638

37-
ONE: typing.ClassVar[Outer.Inner.NestedEnum] # value = <NestedEnum.ONE: 1>
38-
TWO: typing.ClassVar[Outer.Inner.NestedEnum] # value = <NestedEnum.TWO: 2>
39+
ONE: typing.ClassVar[
40+
Outer.Inner.NestedEnum
41+
] = pybind11_stubgen.typing_ext.ValueExpr("<NestedEnum.ONE: 1>")
42+
TWO: typing.ClassVar[
43+
Outer.Inner.NestedEnum
44+
] = pybind11_stubgen.typing_ext.ValueExpr("<NestedEnum.TWO: 2>")
3945
__members__: typing.ClassVar[
4046
dict[str, Outer.Inner.NestedEnum]
41-
] # value = {'ONE': <NestedEnum.ONE: 1>, 'TWO': <NestedEnum.TWO: 2>}
47+
] = pybind11_stubgen.typing_ext.ValueExpr(
48+
"{'ONE': <NestedEnum.ONE: 1>, 'TWO': <NestedEnum.TWO: 2>}"
49+
)
4250
def __eq__(self, other: typing.Any) -> bool: ...
4351
def __getstate__(self) -> int: ...
4452
def __hash__(self) -> int: ...

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/duplicate_enum.pyi

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from __future__ import annotations
22

33
import typing
44

5+
import pybind11_stubgen.typing_ext
6+
57
__all__ = ["ConsoleForegroundColor", "Magenta", "accepts_ambiguous_enum"]
68

79
class ConsoleForegroundColor:
@@ -13,10 +15,12 @@ class ConsoleForegroundColor:
1315

1416
Magenta: typing.ClassVar[
1517
ConsoleForegroundColor
16-
] # value = <ConsoleForegroundColor.Magenta: 35>
18+
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Magenta: 35>")
1719
__members__: typing.ClassVar[
1820
dict[str, ConsoleForegroundColor]
19-
] # value = {'Magenta': <ConsoleForegroundColor.Magenta: 35>}
21+
] = pybind11_stubgen.typing_ext.ValueExpr(
22+
"{'Magenta': <ConsoleForegroundColor.Magenta: 35>}"
23+
)
2024
def __eq__(self, other: typing.Any) -> bool: ...
2125
def __getstate__(self) -> int: ...
2226
def __hash__(self) -> int: ...
@@ -32,6 +36,12 @@ class ConsoleForegroundColor:
3236
@property
3337
def value(self) -> int: ...
3438

35-
def accepts_ambiguous_enum(color: ConsoleForegroundColor = ...) -> None: ...
39+
def accepts_ambiguous_enum(
40+
color: ConsoleForegroundColor = pybind11_stubgen.typing_ext.InvalidExpr(
41+
"<ConsoleForegroundColor.Magenta: 35>"
42+
),
43+
) -> None: ...
3644

37-
Magenta: ConsoleForegroundColor # value = <ConsoleForegroundColor.Magenta: 35>
45+
Magenta: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
46+
"<ConsoleForegroundColor.Magenta: 35>"
47+
)

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/eigen.pyi

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from __future__ import annotations
33
import typing
44

55
import numpy
6+
import pybind11_stubgen.typing_ext
67
import scipy.sparse
78

89
__all__ = [
@@ -25,12 +26,20 @@ N = typing.TypeVar("N", bound=int)
2526

2627
def accept_matrix_int(
2728
arg0: numpy.ndarray[
28-
tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32]
29+
tuple[
30+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
31+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
32+
],
33+
numpy.dtype[numpy.int32],
2934
]
3035
) -> None: ...
3136
def accept_vector_float64(
3237
arg0: numpy.ndarray[
33-
tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64]
38+
tuple[
39+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
40+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("1")],
41+
],
42+
numpy.dtype[numpy.float64],
3443
]
3544
) -> None: ...
3645
def dense_matrix_c(
@@ -41,30 +50,62 @@ def dense_matrix_r(
4150
) -> numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]]: ...
4251
def fixed_mutator_a(
4352
arg0: numpy.ndarray[
44-
tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32]
53+
tuple[
54+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("5")],
55+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("6")],
56+
],
57+
numpy.dtype[numpy.float32],
4558
]
4659
) -> None: ...
4760
def fixed_mutator_c(
4861
arg0: numpy.ndarray[
49-
tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32]
62+
tuple[
63+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("5")],
64+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("6")],
65+
],
66+
numpy.dtype[numpy.float32],
5067
]
5168
) -> None: ...
5269
def fixed_mutator_r(
5370
arg0: numpy.ndarray[
54-
tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32]
71+
tuple[
72+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("5")],
73+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("6")],
74+
],
75+
numpy.dtype[numpy.float32],
5576
]
5677
) -> None: ...
5778
def four_col_matrix_r(
58-
arg0: numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]]
59-
) -> numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]]: ...
79+
arg0: numpy.ndarray[
80+
tuple[M, typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")]],
81+
numpy.dtype[numpy.float32],
82+
]
83+
) -> numpy.ndarray[
84+
tuple[M, typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")]],
85+
numpy.dtype[numpy.float32],
86+
]: ...
6087
def four_row_matrix_r(
61-
arg0: numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]]
62-
) -> numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]]: ...
88+
arg0: numpy.ndarray[
89+
tuple[typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")], N],
90+
numpy.dtype[numpy.float32],
91+
]
92+
) -> numpy.ndarray[
93+
tuple[typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")], N],
94+
numpy.dtype[numpy.float32],
95+
]: ...
6396
def get_matrix_int() -> numpy.ndarray[
64-
tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32]
97+
tuple[
98+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
99+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
100+
],
101+
numpy.dtype[numpy.int32],
65102
]: ...
66103
def get_vector_float64() -> numpy.ndarray[
67-
tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64]
104+
tuple[
105+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
106+
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("1")],
107+
],
108+
numpy.dtype[numpy.float64],
68109
]: ...
69110
def sparse_matrix_c(arg0: scipy.sparse.csc_matrix) -> scipy.sparse.csc_matrix: ...
70111
def sparse_matrix_r(arg0: scipy.sparse.csr_matrix) -> scipy.sparse.csr_matrix: ...

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/enum.pyi

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from __future__ import annotations
22

33
import typing
44

5+
import pybind11_stubgen.typing_ext
6+
57
__all__ = [
68
"Blue",
79
"ConsoleForegroundColor",
@@ -29,22 +31,24 @@ class ConsoleForegroundColor:
2931

3032
Blue: typing.ClassVar[
3133
ConsoleForegroundColor
32-
] # value = <ConsoleForegroundColor.Blue: 34>
34+
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Blue: 34>")
3335
Green: typing.ClassVar[
3436
ConsoleForegroundColor
35-
] # value = <ConsoleForegroundColor.Green: 32>
37+
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Green: 32>")
3638
Magenta: typing.ClassVar[
3739
ConsoleForegroundColor
38-
] # value = <ConsoleForegroundColor.Magenta: 35>
40+
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Magenta: 35>")
3941
None_: typing.ClassVar[
4042
ConsoleForegroundColor
41-
] # value = <ConsoleForegroundColor.None_: -1>
43+
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.None_: -1>")
4244
Yellow: typing.ClassVar[
4345
ConsoleForegroundColor
44-
] # value = <ConsoleForegroundColor.Yellow: 33>
46+
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Yellow: 33>")
4547
__members__: typing.ClassVar[
4648
dict[str, ConsoleForegroundColor]
47-
] # value = {'Green': <ConsoleForegroundColor.Green: 32>, 'Yellow': <ConsoleForegroundColor.Yellow: 33>, 'Blue': <ConsoleForegroundColor.Blue: 34>, 'Magenta': <ConsoleForegroundColor.Magenta: 35>, 'None_': <ConsoleForegroundColor.None_: -1>}
49+
] = pybind11_stubgen.typing_ext.ValueExpr(
50+
"{'Green': <ConsoleForegroundColor.Green: 32>, 'Yellow': <ConsoleForegroundColor.Yellow: 33>, 'Blue': <ConsoleForegroundColor.Blue: 34>, 'Magenta': <ConsoleForegroundColor.Magenta: 35>, 'None_': <ConsoleForegroundColor.None_: -1>}"
51+
)
4852
def __eq__(self, other: typing.Any) -> bool: ...
4953
def __getstate__(self) -> int: ...
5054
def __hash__(self) -> int: ...
@@ -64,8 +68,18 @@ def accept_defaulted_enum(
6468
color: ConsoleForegroundColor = ConsoleForegroundColor.None_,
6569
) -> None: ...
6670

67-
Blue: ConsoleForegroundColor # value = <ConsoleForegroundColor.Blue: 34>
68-
Green: ConsoleForegroundColor # value = <ConsoleForegroundColor.Green: 32>
69-
Magenta: ConsoleForegroundColor # value = <ConsoleForegroundColor.Magenta: 35>
70-
None_: ConsoleForegroundColor # value = <ConsoleForegroundColor.None_: -1>
71-
Yellow: ConsoleForegroundColor # value = <ConsoleForegroundColor.Yellow: 33>
71+
Blue: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
72+
"<ConsoleForegroundColor.Blue: 34>"
73+
)
74+
Green: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
75+
"<ConsoleForegroundColor.Green: 32>"
76+
)
77+
Magenta: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
78+
"<ConsoleForegroundColor.Magenta: 35>"
79+
)
80+
None_: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
81+
"<ConsoleForegroundColor.None_: -1>"
82+
)
83+
Yellow: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
84+
"<ConsoleForegroundColor.Yellow: 33>"
85+
)

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/flawed_bindings.pyi

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from __future__ import annotations
22

33
import typing
44

5+
import pybind11_stubgen.typing_ext
6+
57
__all__ = [
68
"Enum",
79
"Unbound",
@@ -18,8 +20,32 @@ class Enum:
1820
class Unbound:
1921
pass
2022

21-
def accept_unbound_enum(arg0: typing.Annotated[typing.Any, ...]) -> int: ...
22-
def accept_unbound_enum_defaulted(x: Enum = ...) -> int: ...
23-
def accept_unbound_type(arg0: tuple[typing.Annotated[typing.Any, ...], int]) -> int: ...
24-
def accept_unbound_type_defaulted(x: Unbound = ...) -> int: ...
25-
def get_unbound_type() -> typing.Annotated[typing.Any, ...]: ...
23+
def accept_unbound_enum(
24+
arg0: typing.Annotated[
25+
typing.Any,
26+
pybind11_stubgen.typing_ext.InvalidExpr("(anonymous namespace)::Enum"),
27+
]
28+
) -> int: ...
29+
def accept_unbound_enum_defaulted(
30+
x: Enum = pybind11_stubgen.typing_ext.InvalidExpr(
31+
"<demo._bindings.flawed_bindings.Enum object>"
32+
),
33+
) -> int: ...
34+
def accept_unbound_type(
35+
arg0: tuple[
36+
typing.Annotated[
37+
typing.Any,
38+
pybind11_stubgen.typing_ext.InvalidExpr("(anonymous namespace)::Unbound"),
39+
],
40+
int,
41+
]
42+
) -> int: ...
43+
def accept_unbound_type_defaulted(
44+
x: Unbound = pybind11_stubgen.typing_ext.InvalidExpr(
45+
"<demo._bindings.flawed_bindings.Unbound object>"
46+
),
47+
) -> int: ...
48+
def get_unbound_type() -> typing.Annotated[
49+
typing.Any,
50+
pybind11_stubgen.typing_ext.InvalidExpr("(anonymous namespace)::Unbound"),
51+
]: ...

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/issues.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from __future__ import annotations
22

33
import typing
44

5+
import pybind11_stubgen.typing_ext
6+
57
__all__ = ["issue_51_catastrophic_regex", "issue_73_utf8_doc_chars"]
68

79
def issue_51_catastrophic_regex(arg0: int, arg1: int) -> None:
@@ -21,4 +23,4 @@ def issue_73_utf8_doc_chars() -> None:
2123
values provide more damping in response.
2224
"""
2325

24-
_cleanup: typing.Any # value = <capsule object>
26+
_cleanup: typing.Any = pybind11_stubgen.typing_ext.ValueExpr("<capsule object>")

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/_bindings/values.pyi

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from __future__ import annotations
33
import datetime
44

55
import numpy
6+
import pybind11_stubgen.typing_ext
67
from numpy import random
78

89
__all__ = [
@@ -27,10 +28,14 @@ class Foo:
2728

2829
def add_day(arg0: datetime.datetime) -> datetime.datetime: ...
2930

30-
foolist: list # value = [<demo._bindings.values.Foo object>, <demo._bindings.values.Foo object>]
31-
foovar: Foo # value = <demo._bindings.values.Foo object>
31+
foolist: list = pybind11_stubgen.typing_ext.ValueExpr(
32+
"[<demo._bindings.values.Foo object>, <demo._bindings.values.Foo object>]"
33+
)
34+
foovar: Foo = pybind11_stubgen.typing_ext.ValueExpr(
35+
"<demo._bindings.values.Foo object>"
36+
)
3237
list_with_none: list = [None, 2, {}]
3338
none = None
34-
t_10ms: datetime.timedelta # value = datetime.timedelta(microseconds=10000)
35-
t_20ns: datetime.timedelta # value = datetime.timedelta(0)
36-
t_30s: datetime.timedelta # value = datetime.timedelta(seconds=30)
39+
t_10ms: datetime.timedelta = datetime.timedelta(microseconds=10000)
40+
t_20ns: datetime.timedelta = datetime.timedelta(0)
41+
t_30s: datetime.timedelta = datetime.timedelta(seconds=30)

tests/stubs/python-3.12/pybind11-master/numpy-array-use-type-var/demo/pure_python/functions.pyi

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ from __future__ import annotations
33
import sys as sys
44
import typing as typing
55

6+
import pybind11_stubgen.typing_ext
7+
68
from demo.pure_python.functions_3_8_plus import args_mix
79
from demo.pure_python.functions_3_9_plus import generic_alias_annotation
810

@@ -24,8 +26,12 @@ class _Dummy:
2426
def foo(): ...
2527

2628
def accept_frozenset(arg: frozenset[int | float]) -> int | None: ...
27-
def builtin_function_as_default_arg(func: type(len) = len): ...
28-
def function_as_default_arg(func: type(search) = search): ...
29+
def builtin_function_as_default_arg(
30+
func: pybind11_stubgen.typing_ext.ValueExpr("type(len)") = len,
31+
): ...
32+
def function_as_default_arg(
33+
func: pybind11_stubgen.typing_ext.ValueExpr("type(search)") = search,
34+
): ...
2935
def lambda_as_default_arg(callback=...): ...
3036
def search(a: int, b: list[int]) -> int: ...
3137
def static_method_as_default_arg(callback=_Dummy.foo): ...

0 commit comments

Comments
 (0)