diff --git a/challenges/advanced-typeguard/question.py b/challenges/advanced-typeguard/question.py index 7f0924c..dde05bf 100644 --- a/challenges/advanced-typeguard/question.py +++ b/challenges/advanced-typeguard/question.py @@ -1,16 +1,14 @@ """ TODO: -is_string is a function that takes an argument value of arbitrary type, and returns a boolean. -You should make is_string be able to narrow the type of the argument based on its return value: -when it's true, narrow value's type to str. -Basically, it should work like `isinstance(value, str)` from the perspective of a type checker. +`is_string` determines whether the input value is a string. +Your job is to make the type checker be aware of this information. """ from typing import Any def is_string(value: Any): - ... + return isinstance(value, str) ## End of your code ## diff --git a/challenges/advanced-typeguard/solution.py b/challenges/advanced-typeguard/solution.py index 301ff68..e848bce 100644 --- a/challenges/advanced-typeguard/solution.py +++ b/challenges/advanced-typeguard/solution.py @@ -1,10 +1,8 @@ """ TODO: -is_string is a function that takes an argument value of arbitrary type, and returns a boolean. -You should make is_string be able to narrow the type of the argument based on its return value: -when it's true, narrow value's type to str. -Basically, it should work like `isinstance(value, str)` from the perspective of a type checker. +`is_string` determines whether the input value is a string. +Your job is to make the type checker be aware of this information. """ from typing import Any, TypeGuard diff --git a/challenges/extreme-self-casting/solution.py b/challenges/extreme-self-casting/solution.py index be906ad..93822ba 100644 --- a/challenges/extreme-self-casting/solution.py +++ b/challenges/extreme-self-casting/solution.py @@ -13,8 +13,8 @@ from typing import Callable, Concatenate, Generic, ParamSpec, TypeVar -R = TypeVar('R') -P = ParamSpec('P') +R = TypeVar("R") +P = ParamSpec("P") class Fn(Generic[R, P]):