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

Type annotations, checked with MyPy #366

Merged
merged 22 commits into from Nov 6, 2023
Merged

Type annotations, checked with MyPy #366

merged 22 commits into from Nov 6, 2023

Conversation

twm
Copy link
Contributor

@twm twm commented Apr 18, 2023

  • Add type annotations to public APIs.
  • Add MyPy and get it passing.

There are tons of unions of concrete types in the APIs because treq does tons of isinstance() checks internally. It's pretty gross.

This targets Python 3.8 for MyPy to match what Twisted uses, so the 3.7 build is busted.

Fixes #302.

@twm twm force-pushed the typing branch 2 times, most recently from 2836f28 to 0a49042 Compare April 30, 2023 23:02
This is necessary on Python 3.7 because type is not subscriptable.
Copy link
Member

@glyph glyph left a comment

Choose a reason for hiding this comment

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

This looks good, and gets us to a place where we can start actually fixing things type-wise; please feel free to fix the CI configuration issues (do feel free to drop 3.7 but let's get rid of the broken alpha for now) and land.

@glyph
Copy link
Member

glyph commented May 3, 2023

@glyph glyph merged commit 5128572 into trunk Nov 6, 2023
18 checks passed
@glyph glyph deleted the typing branch November 6, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reject non-string header values
2 participants