redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.12k stars 112 forks source link

Use TypeVars for return types of RedisModel and its subtype's methods #476

Closed marianhlavac closed 1 year ago

marianhlavac commented 1 year ago

Classes RedisModel, HashModel and JsonModel had wrong return type definitions on some of their methods.
This effectively prevented static type checking and typehinting on all objects returned by these methods.

This PR adds correct type hints using TypeVars.

Before before1 before2
After after1 after2

This superseeds PR https://github.com/redis/redis-om-python/pull/472

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 :tada:

Comparison is base (70f6401) 78.94% compared to head (a8710a5) 78.96%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #476 +/- ## ========================================== + Coverage 78.94% 78.96% +0.01% ========================================== Files 14 14 Lines 1178 1179 +1 ========================================== + Hits 930 931 +1 Misses 248 248 ``` | Flag | Coverage Δ | | |---|---|---| | unit | `78.96% <100.00%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=redis#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/redis/redis-om-python/pull/476?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=redis) | Coverage Δ | | |---|---|---| | [aredis\_om/model/model.py](https://app.codecov.io/gh/redis/redis-om-python/pull/476?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=redis#diff-YXJlZGlzX29tL21vZGVsL21vZGVsLnB5) | `87.10% <100.00%> (+0.01%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

marianhlavac commented 1 year ago

I've rebased the PR on latest main from upstream. The checks should pass now.

marianhlavac commented 1 year ago

Is anything else blocking this PR?

frozenBranch commented 1 year ago

I think this is a necessary change, is there a reason it was not merged?

marianhlavac commented 1 year ago

Well very obviously this project is beyond being unmaintained, which is really shame.