-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
Details
typing-ty: commands[0]> ty check error[invalid-argument-type]: Argument to function `asynccontextmanager` is incorrect
--> src/svcs/fastapi.py:62:49
|
60 | ]
61 | if inspect.isasyncgenfunction(self._lifespan):
62 | cm = contextlib.asynccontextmanager(self._lifespan)
| ^^^^^^^^^^^^^^ Expected `(...) -> AsyncIterator[Unknown]`, found `((FastAPI, Registry, /) -> AbstractAsyncContextManager[dict[str, object], bool | None]) | ((FastAPI, Registry, /) -> AbstractAsyncContextManager[None, bool | None]) | ((FastAPI, Registry, /) -> AsyncGenerator[dict[str, object], None]) | ((FastAPI, Registry, /) -> AsyncGenerator[None, None])`
63 | else:
64 | cm = self._lifespan # type: ignore[assignment]
|
info: Union elements `(FastAPI, Registry, /) -> AbstractAsyncContextManager[dict[str, object], bool | None]` and `(FastAPI, Registry, /) -> AbstractAsyncContextManager[None, bool | None]` are not assignable to `(...) -> AsyncIterator[Unknown]`
info: Function defined here
--> stdlib/contextlib.pyi:177:5
|
175 | ) -> bool | None: ...
176 |
177 | def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]:
| ^^^^^^^^^^^^^^^^^^^ ---------------------------------------- Parameter declared here
178 | """@asynccontextmanager decorator.
|
info: rule `invalid-argument-type` is enabled by default
error[invalid-argument-type]: Argument to function `asynccontextmanager` is incorrect
--> src/svcs/starlette.py:84:49
|
82 | ]
83 | if inspect.isasyncgenfunction(self._lifespan):
84 | cm = contextlib.asynccontextmanager(self._lifespan)
| ^^^^^^^^^^^^^^ Expected `(...) -> AsyncIterator[Unknown]`, found `((Starlette, Registry, /) -> AbstractAsyncContextManager[dict[str, object], bool | None]) | ((Starlette, Registry, /) -> AbstractAsyncContextManager[None, bool | None]) | ((Starlette, Registry, /) -> AsyncGenerator[dict[str, object], None]) | ((Starlette, Registry, /) -> AsyncGenerator[None, None])`
85 | else:
86 | cm = self._lifespan # type: ignore[assignment]
|
info: Union elements `(Starlette, Registry, /) -> AbstractAsyncContextManager[dict[str, object], bool | None]` and `(Starlette, Registry, /) -> AbstractAsyncContextManager[None, bool | None]` are not assignable to `(...) -> AsyncIterator[Unknown]`
info: Function defined here
--> stdlib/contextlib.pyi:177:5
|
175 | ) -> bool | None: ...
176 |
177 | def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]:
| ^^^^^^^^^^^^^^^^^^^ ---------------------------------------- Parameter declared here
178 | """@asynccontextmanager decorator.
|
info: rule `invalid-argument-type` is enabled by default
Found 2 diagnostics
Currently, we've added a pin to 0.0.1a25.
Reactions are currently unavailable