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
|
# fmt: off
type TA = int
type TA1[A] = lambda A: A
class Outer[A]:
type TA1[A] = None
type TA1[A, B] = dict[A, B]
class Outer[A]:
def inner[B](self):
type TA1[C] = TA1[A, B] | int
return TA1
def more_generic[T, *Ts, **P]():
type TA[T2, *Ts2, **P2] = tuple[Callable[P, tuple[T, *Ts]], Callable[P2, tuple[T2, *Ts2]]]
return TA
type Recursive = Recursive
def func[A](A): return A
class ClassA:
def func[__A](self, __A): return __A
class ClassA[A, B](dict[A, B]):
...
class ClassA[A]:
def funcB[B](self):
class ClassC[C]:
def funcD[D](self):
return lambda: (A, B, C, D)
return ClassC
class Child[T](Base[lambda: (int, outer_var, T)]): ...
type Alias[T: ([T for T in (T, [1])[1]], T)] = [T for T in T.__name__]
type Alias[T: [lambda: T for T in (T, [1])[1]]] = [lambda: T for T in T.__name__]
class Foo[T: Foo, U: (Foo, Foo)]:
pass
def func[T](a: T = "a", *, b: T = "b"):
return (a, b)
def func1[A: str, B: str | int, C: (int, str)]():
return (A, B, C)
type A [ T , * V ] =foo;type B=A
def AAAAAAAAAAAAAAAAAA [ T : int ,*Ts , ** TT ] ():pass
class AAAAAAAAAAAAAAAAAA [ T : int ,*Ts , ** TT ] :pass
def yikes[A:int,*B,**C](*d:*tuple[A,*B,...])->A:pass
def func[T=int, **U=float, *V=None](): pass
class C[T=int, **U=float, *V=None]: pass
type Alias[T = int, **U = float, *V = None] = int
default = tuple[int, str]
type Alias[*Ts = *default] = Ts
type Foo[ * T = * default ] = int
type Foo[*T=*default ]=int
type Foo [ * T = * default ] = int
|