Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
[MNT] Typing: correct typing overloads forFigure.subfigures
#30314
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
@overload | ||
def subfigures( | ||
self, | ||
nrows: int, | ||
ncols: int, | ||
squeeze: Literal[False], | ||
wspace: float | None = ..., | ||
hspace: float | None = ..., | ||
width_ratios: ArrayLike | None = ..., | ||
height_ratios: ArrayLike | None = ..., | ||
**kwargs | ||
) -> np.ndarray: ... | ||
@overload | ||
def subfigures( | ||
self, | ||
nrows: int = ..., | ||
ncols: int = ..., | ||
squeeze: Literal[False] = ..., | ||
*, | ||
squeeze: Literal[False], | ||
wspace: float | None = ..., | ||
hspace: float | None = ..., | ||
width_ratios: ArrayLike | None = ..., |
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.
the previous overloads hadsqueeze: Literal[False] = ...
, indicating thatFalse
is the default, even though the default isTrue
We can't just remove the= ...
part, because Python doesn't allow default arguments (nrows
,ncols
) to be followed by non-default ones
So, we need two extra overloads:
- when
squeeze
is passed positionally - when
squeeze
is passed by name
Figure.subfigures
Figure.subfigures
PR summary
closes#30313
PR checklist