Skip to content

Fix class hierachy and TypeVars of Serializer classes#520

Merged
intgr merged 2 commits intotypeddjango:masterfrom
intgr:fix-cleanup-serializer-typevars
May 2, 2024
Merged

Fix class hierachy and TypeVars of Serializer classes#520
intgr merged 2 commits intotypeddjango:masterfrom
intgr:fix-cleanup-serializer-typevars

Conversation

@intgr
Copy link
Copy Markdown
Contributor

@intgr intgr commented Dec 8, 2023

I have made thunks!

  • ModelSerializer was incorrectly deriving from Serializer[Any] and BaseSerializer[T]; replaced with Serializer[T].
    This brings it into sync with DRF upstream.

  • Added TypeVar to HyperlinkedModelSerializer class.

  • Removed unnecessary Generic[] where implicit TypeVars are sufficient.

    https://mypy.readthedocs.io/en/stable/generics.html#defining-subclasses-of-generic-classes

    If there are no Generic[...] in bases, then all type variables are collected in the lexicographic order (i.e. by first appearance).

@intgr intgr changed the title Fix and clean up TypeVars of Serializer classes Fix class hierachy and TypeVars of Serializer classes Mar 19, 2024
intgr added 2 commits April 27, 2024 13:02
* Remove unnecessary `Generic[]` where implicit TypeVars are sufficient.
* `ModelSerializer` was incorrectly deriving from `Serializer[Any]` and `BaseSerializer`
@intgr intgr force-pushed the fix-cleanup-serializer-typevars branch from b51d616 to 9179c7d Compare April 27, 2024 10:02
Copy link
Copy Markdown
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@intgr intgr merged commit 9970b74 into typeddjango:master May 2, 2024
@intgr intgr deleted the fix-cleanup-serializer-typevars branch May 2, 2024 08:12
@intgr
Copy link
Copy Markdown
Contributor Author

intgr commented May 2, 2024

Oops, I missed the notification that this got apprpoved. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants