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
|
from __future__ import annotations
from typing import Any, overload
@overload
def sum(x: int, y: int = 0) -> int:
...
@overload
def sum(x: float, y: float = 0.0) -> float:
...
@overload
def sum(x: str, y: str = ...) -> str:
...
def sum(x, y=None):
"""docstring"""
return x + y
class Math:
"""docstring"""
@overload
def sum(self, x: int, y: int = 0) -> int:
...
@overload
def sum(self, x: float, y: float = 0.0) -> float:
...
@overload
def sum(self, x: str, y: str = ...) -> str:
...
def sum(self, x, y=None):
"""docstring"""
return x + y
class Foo:
"""docstring"""
@overload
def __new__(cls, x: int, y: int) -> Foo:
...
@overload
def __new__(cls, x: str, y: str) -> Foo:
...
def __new__(cls, x, y):
pass
class Bar:
"""docstring"""
@overload
def __init__(cls, x: int, y: int) -> None:
...
@overload
def __init__(cls, x: str, y: str) -> None:
...
def __init__(cls, x, y):
pass
class Meta(type):
@overload
def __call__(cls, x: int, y: int) -> Any:
...
@overload
def __call__(cls, x: str, y: str) -> Any:
...
def __call__(cls, x, y):
pass
class Baz(metaclass=Meta):
"""docstring"""
|