]> git.madduck.net Git - etc/vim.git/blob - tests/data/cases/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:

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