Debian Codegraph @

tests/data/cases/type_params.py

raw
1 # flags: --minimum-version=3.12
2 def func [T ](): pass
3 async def func [ T ] (): pass
4 class C[ T ] : pass
5
6 def all_in[T : int,U : (bytes, str),* Ts,**P](): pass
7
8 def really_long[WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine](): pass
9
10 def even_longer[WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine: WhatIfItHadABound](): pass
11
12 def it_gets_worse[WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine, ItCouldBeGenericOverMultipleTypeVars](): pass
13
14 def magic[Trailing, Comma,](): pass
15
16 def weird_syntax[T: lambda: 42, U: a or b](): pass
17
18 def name_3[name_0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if aaaaaaaaaaa else name_3](): pass
19
20 # output
21
22
23 def func[T]():
24 pass
25
26
27 async def func[T]():
28 pass
29
30
31 class C[T]:
32 pass
33
34
35 def all_in[T: int, U: (bytes, str), *Ts, **P]():
36 pass
37
38
39 def really_long[
40 WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine
41 ]():
42 pass
43
44
45 def even_longer[
46 WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine: WhatIfItHadABound
47 ]():
48 pass
49
50
51 def it_gets_worse[
52 WhatIsTheLongestTypeVarNameYouCanThinkOfEnoughToMakeBlackSplitThisLine,
53 ItCouldBeGenericOverMultipleTypeVars,
54 ]():
55 pass
56
57
58 def magic[
59 Trailing,
60 Comma,
61 ]():
62 pass
63
64
65 def weird_syntax[T: lambda: 42, U: a or b]():
66 pass
67
68
69 def name_3[
70 name_0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if aaaaaaaaaaa else name_3
71 ]():
72 pass