Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e5ecf9

Browse files
committed
Fix type hint for SubplotSpec init
It is only ever created in `GridSpecBase.__getitem__` with `self` as argument, so must accept those instead of `GridSpec`.
1 parent 011cc68 commit 3e5ecf9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/gridspec.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class GridSpecBase:
3434
) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: ...
3535
@staticmethod
3636
def _check_gridspec_exists(figure, nrows, ncols): ...
37-
def __getitem__(self, key: tuple[int | slice, int | slice] | slice | int) -> SubplotSpec: ...
37+
def __getitem__(
38+
self, key: tuple[int | slice, int | slice] | slice | int
39+
) -> SubplotSpec: ...
3840
@overload
3941
def subplots(
4042
self,
@@ -105,7 +107,7 @@ class GridSpecFromSubplotSpec(GridSpecBase):
105107
class SubplotSpec:
106108
num1: int
107109
def __init__(
108-
self, gridspec: GridSpec, num1: int, num2: int | None = ...
110+
self, gridspec: GridSpecBase, num1: int, num2: int | None = ...
109111
) -> None: ...
110112
@staticmethod
111113
def _from_subplot_args(figure, args): ...

0 commit comments

Comments
 (0)