1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
from __future__ import annotations
import pathlib
from typing import Any, Tuple, TypeVar, Union
CONST1: int
#: docstring
CONST2: int = 1
#: docstring
CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c")
#: docstring
T = TypeVar("T", bound=pathlib.PurePosixPath)
def incr(a: int, b: int = 1) -> int:
return a + b
def decr(a, b = 1):
# type: (int, int) -> int
return a - b
class Math:
CONST1: int
CONST2: int = 1
CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c")
def __init__(self, s: str, o: Any = None) -> None:
pass
def incr(self, a: int, b: int = 1) -> int:
return a + b
def decr(self, a, b = 1):
# type: (int, int) -> int
return a - b
def nothing(self):
# type: () -> None
pass
def horse(self,
a, # type: str
b, # type: int
):
# type: (...) -> None
return
@property
def prop(self) -> int:
return 0
@property
def path(self) -> pathlib.PurePosixPath:
return pathlib.PurePosixPath("/a/b/c")
def tuple_args(x: tuple[int, int | str]) -> tuple[int, int]:
pass
class NewAnnotation:
def __new__(cls, i: int) -> NewAnnotation:
pass
class NewComment:
def __new__(cls, i):
# type: (int) -> NewComment
pass
class _MetaclassWithCall(type):
def __call__(cls, a: int):
pass
class SignatureFromMetaclass(metaclass=_MetaclassWithCall):
pass
def complex_func(arg1, arg2, arg3=None, *args, **kwargs):
# type: (str, List[int], Tuple[int, Union[str, Unknown]], *str, **str) -> None
pass
def missing_attr(c,
a, # type: str
b=None # type: Optional[str]
):
# type: (...) -> str
return a + (b or "")
class _ClassWithDocumentedInit:
"""Class docstring."""
def __init__(self, x: int, *args: int, **kwargs: int) -> None:
"""Init docstring.
:param x: Some integer
:param args: Some integer
:param kwargs: Some integer
"""
|