We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I noticed that contextmanager doesn't preserve signatures of decorated methods:
reveal_type(db.executemany) # mypy: Revealed type is "def (*Any, **Any) -> aiosqlite.context.Result[aiosqlite.cursor.Cursor]"
Consider using ParamSpec to preserve them:
from typing_extensions import ParamSpec _P = ParamSpec("_P") def contextmanager( method: Callable[_P, Coroutine[Any, Any, _T]] ) -> Callable[_P, Result[_T]]: @wraps(method) def wrapper(self, *args: _P.args, **kwargs: _P.kwargs) -> Result[_T]: return Result(method(self, *args, **kwargs)) return wrapper
reveal_type(db.executemany) # mypy: Revealed type is "def (sql: builtins.str, parameters: typing.Iterable[typing.Iterable[Any]]) # -> aiosqlite.context.Result[aiosqlite.cursor.Cursor]"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I noticed that contextmanager doesn't preserve signatures of decorated methods:
Consider using ParamSpec to preserve them:
The text was updated successfully, but these errors were encountered: