-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve types beyond what typeshed has.
- Typeshed has argument types as `bytes` to substitute for buffers since buffers didn't have a representation in the type system for a long time. Now that `collections.abc.Buffer` exists, there's a better alternative. - This means that memoryview, bytarray, etc. won't show up as type-checker errors when given as inputs. - Tests actually type-check as a result. No changes to logic were made, just type annotations. - TODO: Consider upstreaming to typeshed? Reference material: - https://docs.python.org/3/library/typing.html#typing.ByteString - https://docs.python.org/3/library/collections.abc.html#collections.abc.Buffer - https://peps.python.org/pep-0688 - "No special meaning for bytes" mentions why these were annotated with `bytes` before. - https://typing.readthedocs.io/en/latest/source/modernizing.html#typing-bytestring
- Loading branch information
1 parent
e1526b6
commit c867062
Showing
3 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters