Skip to content

Conversation

Rogdham
Copy link

@Rogdham Rogdham commented Jan 15, 2025

I was not sure what the minimal Python version for type hints is supported, so I tried to be the most compatible. However, I believe it still needs Python 3.5 to be able to import Type from typing.

Things that could be simplified/improved:

  • the import of Protocol (Python 3.8)
  • using PEP 570 for the arguments to .read and .write (Python 3.8)
  • using builtin type instead of Type (Python 3.9)
  • importing Callable from collections.abc (Python 3.10)

Things not treated in this PR:

  • simplfying bytes | bytearray to bytes (mypy doc): it does not hurt to keep it this way
  • proper typing of the **options params: it does not bring a lot to type them properly, and it adds maintainability burden (e.g. you would need to modify the type hints each time you add a new param)

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