Skip to content

Commit 9e834d1

Browse files
authored
Fix the type annotation for __all__ (#261)
The lack of annotation makes mypy unhappy.
1 parent 59e0eb1 commit 9e834d1

File tree

205 files changed

+271
-205
lines changed

Some content is hidden

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

205 files changed

+271
-205
lines changed

pybind11_stubgen/parser/mixins/fix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def handle_module(
256256
Attribute(
257257
name=Identifier("__all__"),
258258
value=self.handle_value(all_names),
259-
# annotation=ResolvedType(name=QualifiedName.from_str("list")),
259+
annotation=ResolvedType(name=QualifiedName.from_str("list[str]")),
260260
)
261261
)
262262

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ from demo._bindings import (
1919

2020
from . import _bindings, core, pure_python
2121

22-
__all__ = [
22+
__all__: list[str] = [
2323
"aliases",
2424
"classes",
2525
"core",

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ from . import (
1717
values,
1818
)
1919

20-
__all__ = [
20+
__all__: list[str] = [
2121
"aliases",
2222
"classes",
2323
"eigen",

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ from . import (
1919
missing_self_arg,
2020
)
2121

22-
__all__ = [
22+
__all__: list[str] = [
2323
"Color",
2424
"Dummy",
2525
"foreign_arg",

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_arg.pyi

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

33
import demo._bindings.classes
44

5-
__all__ = ["set_foo"]
5+
__all__: list[str] = ["set_foo"]
66

77
def set_foo(arg0: demo._bindings.classes.Foo) -> int: ...

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_attr.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ from __future__ import annotations
22

33
import demo._bindings.classes
44

5-
__all__ = ["value"]
5+
__all__: list[str] = ["value"]
66
value: demo._bindings.classes.Foo # value = <demo._bindings.classes.Foo object>

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_class_member.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import typing
44

55
import demo._bindings.classes
66

7-
__all__ = ["Bar1"]
7+
__all__: list[str] = ["Bar1"]
88

99
class Bar1:
1010
foo: typing.ClassVar[

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_arg.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from __future__ import annotations
22

33
import demo._bindings.classes
44

5-
__all__ = ["Bar2"]
5+
__all__: list[str] = ["Bar2"]
66

77
class Bar2:
88
def set_foo(self, arg0: demo._bindings.classes.Foo) -> int: ...

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_method_return.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from __future__ import annotations
22

33
import demo._bindings.classes
44

5-
__all__ = ["Bar3"]
5+
__all__: list[str] = ["Bar3"]
66

77
class Bar3:
88
@staticmethod

tests/stubs/python-3.12/pybind11-v2.11/numpy-array-wrap-with-annotated/demo/_bindings/aliases/foreign_return.pyi

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

33
import demo._bindings.classes
44

5-
__all__ = ["get_foo"]
5+
__all__: list[str] = ["get_foo"]
66

77
def get_foo() -> demo._bindings.classes.Foo: ...

0 commit comments

Comments
 (0)