Closed rdar-lab closed 6 months ago
To clarify the changes:
Would this problem not occur for the async storage?
For the linting errors, try running make lint-fix
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.02%. Comparing base (
e84f8f5
) to head (7e2e8c8
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
For the linting errors, try running
make lint-fix
Done
Would this problem not occur for the async storage?
I wouldn't know. Did not work with the async version
I was able to resolve the lint errors in the MongoDB, but only with the ignore statement:
Therefore the only solution I found was:
@alisaifee Did you happen to see my latest comments?
Hi @alisaifee I saw a few issues regarding lint on files I did not touch:
limits/aio/storage/base.py:30: error: Type of decorated function contains type "Any" ("_Wrapped[P, Awaitable[R], P, Coroutine[Any, Any, R]]") [misc] Found 1 error in 1 file (checked 27 source files)
I don't believe it is related to my changes. Can you verify the base version does not have the same issue?
Hi @alisaifee I saw a few issues regarding lint on files I did not touch:
limits/aio/storage/base.py:30: error: Type of decorated function contains type "Any" ("_Wrapped[P, Awaitable[R], P, Coroutine[Any, Any, R]]") [misc] Found 1 error in 1 file (checked 27 source files)
I don't believe it is related to my changes. Can you verify the base version does not have the same issue?
Apologies for the delay in getting to this PR. I'm looking at this at the moment - it's definitely not related to your change and exists in master
(with an updated version of mypy)
@rdar-lab if you want to try rebasing from master I've added a temporary workaround for the typing issue.
I was able to resolve the lint errors in the MongoDB, but only with the ignore statement:
- I cannot use ("") types for methods. Seems reasonable limitation, but required me to use Any
- Any is configured to not be supported - this seems logical, but in my use case I need to either use direct import on Mongo types or Any
- Using direct typing of course is wrong since the import will fail for users that do not have Mongo in their requirements.txt
Therefore the only solution I found was:
- Switch all methods to use "Any" (or simply do not provide the return type indication)
- Add ignore instructions on the file level
For the other storage types I've done something like this - I wonder if something similar could be applied?
Generally this looks fine to me. If it's too tricky to resolve the type errors, I can take a crack at that post merge / as a follow up as well.
@alisaifee , I rebased it. Can you run the checks again
@rdar-lab have you verified this branch works for the failing scenario you had?
@alisaifee yes I did. I used the modified code and checked it
Awesome, I'll merge this and look at making a release tomorrow!
Just FYI: https://github.com/alisaifee/limits/commit/171b412afe7e2c09b907635b6f6cf45501e0b8d7 makes the type annotations a bit better though there is still some need for Any
and type ignores.