Skip to content

Commit a634dee

Browse files
author
Marcel Weiler
committed
Updated stub files for stubgen test
1 parent feebc70 commit a634dee

File tree

2 files changed

+41
-18
lines changed

2 files changed

+41
-18
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import basics as basics

test-data/pybind11_mypy_demo/stubgen-include-docs/pybind11_mypy_demo/basics.pyi

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
from typing import ClassVar
1+
from typing import ClassVar, overload
22

3-
from typing import overload
43
PI: float
4+
__version__: str
5+
6+
class Foo:
7+
def __init__(self, *args, **kwargs) -> None:
8+
"""Initialize self. See help(type(self)) for accurate signature."""
9+
@overload
10+
@staticmethod
11+
def overloaded_static_method(value: int) -> int:
12+
"""overloaded_static_method(*args, **kwargs)
13+
Overloaded function.
14+
15+
1. overloaded_static_method(value: int) -> int
16+
17+
2. overloaded_static_method(value: float) -> float"""
18+
@overload
19+
@staticmethod
20+
def overloaded_static_method(value: float) -> float:
21+
"""overloaded_static_method(*args, **kwargs)
22+
Overloaded function.
23+
24+
1. overloaded_static_method(value: int) -> int
25+
26+
2. overloaded_static_method(value: float) -> float"""
27+
@staticmethod
28+
def some_static_method(a: int, b: int) -> int:
29+
"""some_static_method(a: int, b: int) -> int
30+
31+
None"""
532

633
class Point:
734
class AngleUnit:
@@ -13,8 +40,6 @@ class Point:
1340
"""__init__(self: pybind11_mypy_demo.basics.Point.AngleUnit, value: int) -> None"""
1441
def __eq__(self, other: object) -> bool:
1542
"""__eq__(self: object, other: object) -> bool"""
16-
def __getstate__(self) -> int:
17-
"""__getstate__(self: object) -> int"""
1843
def __hash__(self) -> int:
1944
"""__hash__(self: object) -> int"""
2045
def __index__(self) -> int:
@@ -23,8 +48,6 @@ class Point:
2348
"""__int__(self: pybind11_mypy_demo.basics.Point.AngleUnit) -> int"""
2449
def __ne__(self, other: object) -> bool:
2550
"""__ne__(self: object, other: object) -> bool"""
26-
def __setstate__(self, state: int) -> None:
27-
"""__setstate__(self: pybind11_mypy_demo.basics.Point.AngleUnit, state: int) -> None"""
2851
@property
2952
def name(self) -> str: ...
3053
@property
@@ -40,8 +63,6 @@ class Point:
4063
"""__init__(self: pybind11_mypy_demo.basics.Point.LengthUnit, value: int) -> None"""
4164
def __eq__(self, other: object) -> bool:
4265
"""__eq__(self: object, other: object) -> bool"""
43-
def __getstate__(self) -> int:
44-
"""__getstate__(self: object) -> int"""
4566
def __hash__(self) -> int:
4667
"""__hash__(self: object) -> int"""
4768
def __index__(self) -> int:
@@ -50,8 +71,6 @@ class Point:
5071
"""__int__(self: pybind11_mypy_demo.basics.Point.LengthUnit) -> int"""
5172
def __ne__(self, other: object) -> bool:
5273
"""__ne__(self: object, other: object) -> bool"""
53-
def __setstate__(self, state: int) -> None:
54-
"""__setstate__(self: pybind11_mypy_demo.basics.Point.LengthUnit, state: int) -> None"""
5574
@property
5675
def name(self) -> str: ...
5776
@property
@@ -70,43 +89,46 @@ class Point:
7089
7190
1. __init__(self: pybind11_mypy_demo.basics.Point) -> None
7291
73-
2. __init__(self: pybind11_mypy_demo.basics.Point, x: float, y: float) -> None"""
92+
2. __init__(self: pybind11_mypy_demo.basics.Point, x: float, y: float) -> None
93+
"""
7494
@overload
7595
def __init__(self, x: float, y: float) -> None:
7696
"""__init__(*args, **kwargs)
7797
Overloaded function.
7898
7999
1. __init__(self: pybind11_mypy_demo.basics.Point) -> None
80100
81-
2. __init__(self: pybind11_mypy_demo.basics.Point, x: float, y: float) -> None"""
101+
2. __init__(self: pybind11_mypy_demo.basics.Point, x: float, y: float) -> None
102+
"""
82103
@overload
83104
def distance_to(self, x: float, y: float) -> float:
84105
"""distance_to(*args, **kwargs)
85106
Overloaded function.
86107
87108
1. distance_to(self: pybind11_mypy_demo.basics.Point, x: float, y: float) -> float
88109
89-
2. distance_to(self: pybind11_mypy_demo.basics.Point, other: pybind11_mypy_demo.basics.Point) -> float"""
110+
2. distance_to(self: pybind11_mypy_demo.basics.Point, other: pybind11_mypy_demo.basics.Point) -> float
111+
"""
90112
@overload
91113
def distance_to(self, other: Point) -> float:
92114
"""distance_to(*args, **kwargs)
93115
Overloaded function.
94116
95117
1. distance_to(self: pybind11_mypy_demo.basics.Point, x: float, y: float) -> float
96118
97-
2. distance_to(self: pybind11_mypy_demo.basics.Point, other: pybind11_mypy_demo.basics.Point) -> float"""
119+
2. distance_to(self: pybind11_mypy_demo.basics.Point, other: pybind11_mypy_demo.basics.Point) -> float
120+
"""
98121
@property
99122
def length(self) -> float: ...
100123

101124
def answer() -> int:
102-
'''answer() -> int
125+
"""answer() -> int"""
103126

104-
answer docstring, with end quote"'''
105127
def midpoint(left: float, right: float) -> float:
106128
"""midpoint(left: float, right: float) -> float"""
129+
107130
def sum(arg0: int, arg1: int) -> int:
108-
'''sum(arg0: int, arg1: int) -> int
131+
"""sum(arg0: int, arg1: int) -> int"""
109132

110-
multiline docstring test, edge case quotes """\'\'\''''
111133
def weighted_midpoint(left: float, right: float, alpha: float = ...) -> float:
112134
"""weighted_midpoint(left: float, right: float, alpha: float = 0.5) -> float"""

0 commit comments

Comments
 (0)