You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When function that has Any in it's signature, the safe decorator will generate a function with type hints def (*Any, **Any) -> Any.
Example:
@safedefsend(text: str) ->Any:
return"test"reveal_type(send) # Revealed type is 'def (*Any, **Any) -> Any'
If the return type hint is str the safe decorator will produce a correctly typed function.
The problem isn't strictly related to the return type, sometimes if we have an argument that is Dict[str, Any] the function signature would be wrong. This doesn't always occur, it takes that there are other arguments defined too (?) EDIT: it looks like it only happens with async functions.
Is this a known issue? i.e. if Any is present the safe decorator makes the function arguments and return type Any too? This may be the issue with other decorators too, I haven't tested it.
I would be glad to help to solve the issue.
The text was updated successfully, but these errors were encountered:
I will remove async@safe case and replace it with @safe_future or similar decorator
add this regression case into the test spec
Thanks a lot for the reporting. Sadly, but you have to wait for 0.14 release of returns.
It will bring many new awesome features like typed partial, Task monad, and new composition helpers.
When function that has
Any
in it's signature, thesafe
decorator will generate a function with type hintsdef (*Any, **Any) -> Any
.Example:
If the return type hint is
str
thesafe
decorator will produce a correctly typed function.The problem isn't strictly related to the return type, sometimes if we have an argument that is
Dict[str, Any]
the function signature would be wrong. This doesn't always occur, it takes that there are other arguments defined too (?) EDIT: it looks like it only happens withasync
functions.Is this a known issue? i.e. if
Any
is present thesafe
decorator makes the function arguments and return typeAny
too? This may be the issue with other decorators too, I haven't tested it.I would be glad to help to solve the issue.
The text was updated successfully, but these errors were encountered: