Skip to content

Commit 58dc382

Browse files
committed
chore: Update stubs
1 parent 37feafd commit 58dc382

File tree

10 files changed

+111
-34
lines changed

10 files changed

+111
-34
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-wrap-with-annotated/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-wrap-with-annotated/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-wrap-with-annotated/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-wrap-with-annotated/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-wrap-with-annotated/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-wrap-with-annotated/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-wrap-with-annotated/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-wrap-with-annotated/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): ...

tests/stubs/python-3.12/pybind11-master/numpy-array-wrap-with-annotated/demo/pure_python/functions_3_8_plus.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ def args_mix(
1111
*args: int,
1212
x: int = 1,
1313
y=int,
14-
**kwargs: typing.Dict[int, str],
14+
**kwargs: dict[int, str],
1515
): ...

0 commit comments

Comments
 (0)