Closed russellcardullo closed 2 years ago
Looks like this is just a bug introduced by storage_from_string
returning either the aio or sync version of the storage.
Could you try this commit to see if it resolves the issue? https://github.com/alisaifee/limits/commit/4265c719de70172fabeadc966e0b5eac0d1345dc
Should be resolved in 2.2.0
Thanks! Just confirmed 2.2.0
fixes it.
Hi! I've started seeing this again starting in version 2.5.2 and all newer versions. I used the same reproducer in the description and got:
error: Argument 1 to "MovingWindowRateLimiter" has incompatible type "Union[limits.storage.base.Storage, limits.aio.storage.base.Storage]"; expected "limits.storage.base.Storage"
Tried 2.5.1 and the problem went away.
Ouch, sorry about that. 2.5.2
was actually supposed to improve type safety 😿
Hello! I've recently updated one of my projects from limits 2.0.3 to 2.1.1 and ran into an issue where mypy reports incompatible types for
MovingWindowRateLimiter
andFixedWindowRateLimiter
. A minimal reproducer:With this file and running mypy 0.930 I get:
I could also reproduce that by running mypy on the tests in this repo:
python3 -m mypy tests/test_strategy.py
.Any ideas what I could look at next?
Thanks!