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
Pytype 2024.02.13 Python 3.8.18
This file:
from contextlib import asynccontextmanager from typing import AsyncGenerator from attrs import define @define class Thing: instance: int @asynccontextmanager async def context(self) -> AsyncGenerator[None, None]: yield
produces this output from pytype-single --output - repro.py:
pytype-single --output - repro.py
import attr import contextlib from typing import Annotated, AsyncIterator, Callable, ParamSpec, TypeVar define: Annotated[Callable, 'pytype_metadata', {'tag': 'attr.s', 'init': True, 'kw_only': False, 'auto_attribs': None}] _P = ParamSpec('_P') _T_co = TypeVar('_T_co') @attr.s class Thing: instance: int def __init__(self) -> None: ... def context(self) -> contextlib._AsyncGeneratorContextManager[None]: ... def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, contextlib._AsyncGeneratorContextManager[_T_co]]: ...
Note __init__(self) -> None: ... is incorrect, should be __init__(self, instance: int) -> None: ...
__init__(self) -> None: ...
__init__(self, instance: int) -> None: ...
If you remove `context:
from contextlib import asynccontextmanager from typing import AsyncGenerator from attrs import define @define class Thing: instance: int
this gives:
import attr import contextlib from typing import Annotated, AsyncIterator, Callable, ParamSpec, TypeVar define: Annotated[Callable, 'pytype_metadata', {'tag': 'attr.s', 'init': True, 'kw_only': False, 'auto_attribs': None}] _P = ParamSpec('_P') _T_co = TypeVar('_T_co') @attr.s class Thing: instance: int def __init__(self, instance: int) -> None: ... def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, contextlib._AsyncGeneratorContextManager[_T_co]]: ...
which has the correct signature for __init__.
__init__
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Pytype 2024.02.13
Python 3.8.18
This file:
produces this output from
pytype-single --output - repro.py
:Note
__init__(self) -> None: ...
is incorrect, should be__init__(self, instance: int) -> None: ...
If you remove `context:
this gives:
which has the correct signature for
__init__
.The text was updated successfully, but these errors were encountered: