Added type hints to additional tests#7769
Merged
hugovk merged 5 commits intopython-pillow:mainfrom Feb 6, 2024
Merged
Conversation
hugovk
reviewed
Jan 31, 2024
Tests/test_imagedraw.py
Outdated
Comment on lines
78
to
81
| bbox: tuple[tuple[int, int], tuple[int, int]] | ||
| | list[tuple[int, int]] | ||
| | list[int] | ||
| | tuple[int, int, int, int], |
Member
There was a problem hiding this comment.
This monster would be a good one to define as a type alias in _typing.py.
Contributor
There was a problem hiding this comment.
Would tuple[list[int], list[int]] also be a valid option in this location?
Member
Author
There was a problem hiding this comment.
I've pushed a commit to just simplify it down to Sequence[int | Sequence[int]] instead.
Member
There was a problem hiding this comment.
Would that also be useful as an alias, for clearer re-use?
hugovk
reviewed
Feb 5, 2024
src/PIL/_typing.py
Outdated
| return bool | ||
|
|
||
|
|
||
| CoordList = Union[Sequence[float], Sequence[Sequence[float]]] |
Member
There was a problem hiding this comment.
Maybe just Coords? It's shorter, and a sequence can be a not-a-list such as a tuple:
Suggested change
| CoordList = Union[Sequence[float], Sequence[Sequence[float]]] | |
| Coords = Union[Sequence[float], Sequence[Sequence[float]]] |
Member
Author
There was a problem hiding this comment.
Sure, I've made this change.
Member
|
Thanks! |
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.