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

Add type hints #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add type hints #148

wants to merge 2 commits into from

Conversation

salty-horse
Copy link
Contributor

@salty-horse salty-horse commented Oct 10, 2024

This adds type hints to the library, so tools such as mypy will be able to check usage (and won't complain about missing types when importing it).

Tested with Python 3.8

Notes:

  1. I only added hints to what's defined in __init__.py.
  2. For stream_compress and stream_decompress I defined generic inputs / outputs since the provided de/compressor class can convert between bytes and str. I tested such a class and it passed type checking. I'm sure the typing of that section can be improved, perhaps by using Reader and Writer protocols instead of IO, but this is beyond my very limited proficiency.

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.

1 participant