]> git.madduck.net Git - etc/vim.git/blob - tests/data/preview/dummy_implementations.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

[pre-commit.ci] pre-commit autoupdate (#3837)
[etc/vim.git] / tests / data / preview / dummy_implementations.py
1 from typing import NoReturn, Protocol, Union, overload
2
3
4 def dummy(a): ...
5 def other(b): ...
6
7
8 @overload
9 def a(arg: int) -> int: ...
10 @overload
11 def a(arg: str) -> str: ...
12 @overload
13 def a(arg: object) -> NoReturn: ...
14 def a(arg: Union[int, str, object]) -> Union[int, str]:
15     if not isinstance(arg, (int, str)):
16         raise TypeError
17     return arg
18
19 class Proto(Protocol):
20     def foo(self, a: int) -> int:
21         ...
22
23     def bar(self, b: str) -> str: ...
24     def baz(self, c: bytes) -> str:
25         ...
26
27
28 def dummy_two():
29     ...
30 @dummy
31 def dummy_three():
32     ...
33
34 def dummy_four():
35     ...
36
37 @overload
38 def b(arg: int) -> int: ...
39
40 @overload
41 def b(arg: str) -> str: ...
42 @overload
43 def b(arg: object) -> NoReturn: ...
44
45 def b(arg: Union[int, str, object]) -> Union[int, str]:
46     if not isinstance(arg, (int, str)):
47         raise TypeError
48     return arg
49
50 # output
51
52 from typing import NoReturn, Protocol, Union, overload
53
54
55 def dummy(a): ...
56 def other(b): ...
57
58
59 @overload
60 def a(arg: int) -> int: ...
61 @overload
62 def a(arg: str) -> str: ...
63 @overload
64 def a(arg: object) -> NoReturn: ...
65 def a(arg: Union[int, str, object]) -> Union[int, str]:
66     if not isinstance(arg, (int, str)):
67         raise TypeError
68     return arg
69
70
71 class Proto(Protocol):
72     def foo(self, a: int) -> int: ...
73
74     def bar(self, b: str) -> str: ...
75     def baz(self, c: bytes) -> str: ...
76
77
78 def dummy_two(): ...
79 @dummy
80 def dummy_three(): ...
81
82
83 def dummy_four(): ...
84
85
86 @overload
87 def b(arg: int) -> int: ...
88
89
90 @overload
91 def b(arg: str) -> str: ...
92 @overload
93 def b(arg: object) -> NoReturn: ...
94
95
96 def b(arg: Union[int, str, object]) -> Union[int, str]:
97     if not isinstance(arg, (int, str)):
98         raise TypeError
99     return arg