Skip to content
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

[3.15] Add __class_getitem__ of classes #582

Closed
wants to merge 5 commits into from
Closed

[3.15] Add __class_getitem__ of classes #582

wants to merge 5 commits into from

Conversation

JaeHyuckSa
Copy link
Contributor

@JaeHyuckSa JaeHyuckSa commented Apr 14, 2024

I have made things!

I added __class_getitem__ of classes in DRF version 3.15.

The following are class items with __class_getitem__ added.

  • fields.Field.__class_getitem__
  • generics.GenericAPIView.__class_getitem__
  • request.Request.__class_getitem__
  • response.Response.__class_getitem__

Related issues

Upstream PR: encode/django-rest-framework#8825

@@ -22,6 +23,7 @@ class Response(SimpleTemplateResponse):
exception: bool = ...,
content_type: str | None = ...,
) -> None: ...
def __class_getitem__(cls, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ...
Copy link
Member

Choose a reason for hiding this comment

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

Please, provide correct types, Incomplete is not a good solution :(

Copy link
Contributor Author

@JaeHyuckSa JaeHyuckSa Apr 15, 2024

Choose a reason for hiding this comment

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

Thank you for letting me know the shortcomings! Is it okay to change only the response part for that type, or should I revise the other parts as well?

Please, provide correct types, Incomplete is not a good solution :(

Copy link
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.

@JaeHyuckSa
Copy link
Contributor Author

JaeHyuckSa commented Apr 15, 2024

All places, please :)
Here are examples: https://github.com/search?q=repo%3Apython%2Ftypeshed%20__class_getitem__&type=code

Oh... I sincerely appreciate you providing an example!!
I will repost the PR once the necessary modifications are completed.

@JaeHyuckSa JaeHyuckSa closed this by deleting the head repository Apr 15, 2024
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