diff --git a/challenges/extreme-self-casting/question.py b/challenges/extreme-self-casting/question.py index b1f9373..b8bb43d 100644 --- a/challenges/extreme-self-casting/question.py +++ b/challenges/extreme-self-casting/question.py @@ -19,7 +19,7 @@ def transform_callable(self): ## End of your code ## -from typing import assert_type +from typing import assert_type, Any @Fn diff --git a/challenges/extreme-self-casting/solution.py b/challenges/extreme-self-casting/solution.py index 5fa7d26..be906ad 100644 --- a/challenges/extreme-self-casting/solution.py +++ b/challenges/extreme-self-casting/solution.py @@ -10,25 +10,23 @@ """ -from typing import Callable, Concatenate, ParamSpec, TypeVar, Generic, Any +from typing import Callable, Concatenate, Generic, ParamSpec, TypeVar -P = ParamSpec("P") -R = TypeVar("R", covariant=True) -VnCallable = TypeVar("VnCallable", bound=Callable) +R = TypeVar('R') +P = ParamSpec('P') -class Fn(Generic[VnCallable]): - def __init__(self, f: VnCallable) -> None: + +class Fn(Generic[R, P]): + def __init__(self, f: Callable[P, R]): self.f = f - def transform_callable( - self: "Fn[Callable[P, R]]", - ) -> Callable[Concatenate[Any, P], R]: + def transform_callable(self) -> Callable[Concatenate[object, P], R]: ... ## End of your code ## -from typing import assert_type +from typing import assert_type, Any @Fn diff --git a/challenges/extreme-self-casting/solution2.py b/challenges/extreme-self-casting/solution2.py index 8bdeeca..8744a65 100644 --- a/challenges/extreme-self-casting/solution2.py +++ b/challenges/extreme-self-casting/solution2.py @@ -22,7 +22,7 @@ def transform_callable(self) -> Callable[Concatenate[Any, P], R]: ## End of your code ## -from typing import assert_type +from typing import assert_type, Any @Fn