-
-
Notifications
You must be signed in to change notification settings - Fork 2k
-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
Missing type annotations in pyi files #3240
Comments
Heh, the full list is many times longer. |
While fixing this, I have noted that Signal can't be type-safe in the current form, as far as I understand. The only way to make signal type-safe I've found is to only allow single argument. I.e. like this: from typing import Any, Generic, TypeVar, Callable
from aiohttp.frozenlist import FrozenList
__all__ = ('Signal',)
_T = TypeVar('_T')
class Signal(FrozenList[Callable[[_T], None]], Generic[_T]):
def __init__(self, owner: Any) -> None: ...
def __repr__(self) -> str: ...
async def send(self, arg: _T) -> None: ... From quick grepping it looks like Signal is only used with a single argument in the aiohttp codebase, so it might make sense to fix it. What do you think? |
|
Hm. Is there any chance that this will be fixed in mypy/typing? (and even if it is, will it be backported to previous python versions?)
Note, that while unergonomic (and breaking change) tuple will work for this signal. Otherwise, it looks like we're stuck with non-type-safe signals. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Mypy's errors are:
My
mypy.ini
:I would make a PR, but I'm not sure how to test it. I see these errors in project using mypy and aiohttp. When I run mypy against aiohttp itself I get lots of errors, much more than what I'm willing to fix in a single PR :)
The text was updated successfully, but these errors were encountered: