You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy: comply with strict mode and resolve all 'type: ignore' cases
Tested with mypy 1.5.1 on Python 3.11.
This changes `ByteString` into `Union[bytes, bytearray, memoryview]`.
See python/cpython#91896.
Python 3.11 documentation on `typing.ByteString`:
> Deprecated since version 3.9, will be removed in version 3.14: Prefer
> typing_extensions.Buffer, or a union like
> `bytes | bytearray | memoryview`.
Python 3.8 documentation on `typing.ByteString` [2]:
> This type represents the types `bytes`, `bytearray`, and `memoryview`
> of byte sequences.
>
> As a shorthand for this type, `bytes` can be used to annotate
> arguments of any of the types mentioned above.
While at it, also add the return types for special methods which are
still optional in mypy strict mode (Ruff's ANN024 rule [3]).
[1]: https://docs.python.org/3.11/library/typing.html#typing.ByteString
[2]: https://docs.python.org/3.8/library/typing.html#typing.ByteString
[3]: https://docs.astral.sh/ruff/rules/missing-return-type-special-method/
0 commit comments