Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add type annotations to
compat.to_str()
and compat.to_bytes()
.
- I'm not sure if these functions are truly necessary if the library no longer supports Python 2, but the use of it with `encoding` is prevalant enough around the library that it seems worth typing. - The overloads are necessary to account for None being a passthrough value. - Two cases of this are `ParseResult.copy_with()` and `ParseResultBytes.copy_with()`. The `attrs_dict` dictionary in those methods is allowed to have None, and None is allowed for all of the component parameters (from what I can tell). Thus, whether intentional or not, `compat.to_(bytes|str)()`'s ability to let values pass through without modification, so long as they aren't bytes, is depended upon.
- Loading branch information