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

Improve django.http types #208

Merged
merged 25 commits into from
Oct 31, 2023
Merged

Improve django.http types #208

merged 25 commits into from
Oct 31, 2023

Conversation

noelleleigh
Copy link

This PR adds polish to several classes in the django.http module:

  • django.http.request.HttpHeaders
  • django.http.request.HttpRequest
  • django.http.response.ResponseHeaders
  • django.http.response.HttpResponse
  • django.http.response.StreamingHttpResponse
  • django.http.response.FileResponse
  • django.utils.datastructures.CaseInsensitiveMapping

The changes broadly fall under:

  • More specific typing (replace Any with specific types, remove = ... for class attributes that are always defined, use typing.Never for methods and properties that always raise an exception)
  • Add missing methods and properties
  • Move methods and properties to the correct classes

Some of the changes here could definitely be interpreted as stylistic rather than functional, and I'll happily make any changes that are requested.

Change was made to CaseInsensitiveMapping in previous commit.
mypy doesn't like how the return types changed in HttpResponse.
Copy link
Owner

@sbdchd sbdchd 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!!

@kodiakhq kodiakhq bot merged commit d44899f into sbdchd:main Oct 31, 2023
2 checks passed
@noelleleigh noelleleigh deleted the improve-http branch November 1, 2023 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants