-
-
Notifications
You must be signed in to change notification settings - Fork 301
feat: add comprehensive type annotations #856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ff479d3 to
86f03cf
Compare
|
Hi @bckohan and @JohananOppongAmoateng, this PR is based on the type annotations I added in the |
|
Hi @bckohan, could you re-approve the workflow run? I’ve updated the tests, so I expect it should pass now. There are still quite a few typing errors, but I think we can address them in future commits in this PR—either when I have more time, or with the help of @JohananOppongAmoateng. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #856 +/- ##
==========================================
+ Coverage 90.98% 91.11% +0.13%
==========================================
Files 28 28
Lines 1730 1868 +138
Branches 267 274 +7
==========================================
+ Hits 1574 1702 +128
- Misses 104 110 +6
- Partials 52 56 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @bckohan , could you re-approve the workflow run? |
|
Hi @bckohan, cc @JohananOppongAmoateng I’ve finished addressing all remaining typing issues in the recent commits on this branch. Here’s a brief summary of the current state and some context around the decisions made: Summary
Rationale
Supporting both typed and non-typed users I’ve tried to ensure compatibility for both typed and non-typed users. For example: _ModelT = TypeVar(
"_ModelT",
bound=PolymorphicModel,
default=PolymorphicModel,
)
if TYPE_CHECKING:
_ModelAdminBase = admin.ModelAdmin[_ModelT]
else:
_ModelAdminBase = admin.ModelAdmin
class PolymorphicChildModelAdmin(_ModelAdminBase, Generic[_ModelT]):
...
On cast(...) vs type: ignore
return cast(type[BaseGenericPolymorphicInlineFormSet], FormSet)
Looking forward to your feedback. Thanks a lot for taking the time to review this — I hope we can get this PR merged soon. |
3e89b53 to
9e80624
Compare
Close #647