Skip to content

Improve some smaller typing issues - #26407

Merged
tacaswell merged 18 commits into
matplotlib:mainfrom
QuLogic:better-typing
Aug 3, 2023
Merged

tacaswell merged 18 commits into
matplotlib:mainfrom
QuLogic:better-typing

Conversation

@QuLogic

@QuLogic QuLogic commented Jul 28, 2023

Copy link
Copy Markdown
Member

PR summary

Various and sundry things that I've come across trawling through mypy --strict. This is incomplete at the moment, and also based on #26403.

PR checklist

QuLogic added 15 commits August 2, 2023 15:51
It has had types since 1.0.7, which is slightly newer than our
requirement, but this change is only the test files anyway.
These can be set to `None` in their `__init__` or the property setter.
It's only there for `__init__` and immediately changed right after.
Mostly because these might be `TransformedBbox`.
The resample function from `_image` was missing, and bbox is allowed to
be a function like `get_window_extent`.
Most calls use a single type.
Internally, a `PillowWriter` is sometimes used, and this should be
supported from user code as well.
It is only ever created in `GridSpecBase.__getitem__` with `self` as
argument, so must accept those instead of `GridSpec`.
QuLogic added 3 commits August 2, 2023 17:02
We only ever pass a list internally.
Instead, fall back to the `object.__init_subclass__` definition.
This change is not strictly correct, as these style classes don't
actually inherit from the surrounding class, but it allows one to pass
an instance of the style classes directly.
@QuLogic
QuLogic marked this pull request as ready for review August 2, 2023 21:43
@tacaswell
tacaswell merged commit 427392e into matplotlib:main Aug 3, 2023
@QuLogic
QuLogic deleted the better-typing branch August 3, 2023 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants