-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added type hints to additional tests #7769
Conversation
Tests/test_imagedraw.py
Outdated
bbox: tuple[tuple[int, int], tuple[int, int]] | ||
| list[tuple[int, int]] | ||
| list[int] | ||
| tuple[int, int, int, int], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This monster would be a good one to define as a type alias in _typing.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would tuple[list[int], list[int]]
also be a valid option in this location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit to just simplify it down to Sequence[int | Sequence[int]]
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that also be useful as an alias, for clearer re-use?
src/PIL/_typing.py
Outdated
@@ -15,4 +16,7 @@ def __class_getitem__(cls, item: Any) -> type[bool]: | |||
return bool | |||
|
|||
|
|||
CoordList = Union[Sequence[float], Sequence[Sequence[float]]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just Coords
? It's shorter, and a sequence can be a not-a-list such as a tuple:
CoordList = Union[Sequence[float], Sequence[Sequence[float]]] | |
Coords = Union[Sequence[float], Sequence[Sequence[float]]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've made this change.
Thanks! |
No description provided.