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
This issue should be marked with "topic-ternary-expression" label.
Mypy doesn't understand TYPE_CHECKING checked in a ternary expression.
Example 1
fromtypingimportTYPE_CHECKINGfromredis.asyncioimportConnectionPoolfromredis.asyncioimportRedisasOGRedisfrom . importsettingsRedis=OGRedis[bytes] ifTYPE_CHECKINGelseOGRedis# Redis is Generic in stubsasyncdeffunc() ->None:
connection_pool=ConnectionPool.from_url(settings.redis_url)
asyncwithRedis(connection_pool=connection_pool) asredis:
awaitredis.set(
name="test",
value="Hello World",
)
$ mypy project/
project/code.py:13: error: "object" has no attribute "__aenter__" [attr-defined]
project/code.py:13: error: "object" has no attribute "__aexit__" [attr-defined]
Found 2 errors in 1 file (checked 3 source files)
$ mypy project/
Success: no issues found in 3 source files
That's either a bug or an expected behavior that can be documented. I can imagine a programmer spending an hour debugging and searching why his/her code isn't validated properly.
The text was updated successfully, but these errors were encountered:
This issue should be marked with "topic-ternary-expression" label.
Mypy doesn't understand
TYPE_CHECKING
checked in a ternary expression.Example 1
Example 2
That's either a bug or an expected behavior that can be documented. I can imagine a programmer spending an hour debugging and searching why his/her code isn't validated properly.
The text was updated successfully, but these errors were encountered: