Skip to content

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