Added type hints to additional tests by radarhere · Pull Request #7769 · python-pillow/Pillow

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],

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.

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?

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.

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?