Skip to content

Commit 44c57b4

Browse files
committed
Fix type hints for undeprecated contour APIs
They whad been in the limbo land of deprecated APIs that I didn't bother to ensure were the _best_ type hints because they were deprecated. So I just added them to the allowlist for stubtest, but now that they are undeprecated, make sure that they are correct. While I'm here, may as well get rid of the allow list entries for all of them, even the ones that are still deprecated, as that is documented standard practice going forward that pyi match implementation for deprecations as well
1 parent 3ecb148 commit 44c57b4

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

ci/mypy-stubtest-allowlist.txt

-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ matplotlib.figure.Figure.set_tight_layout
4141
matplotlib.cm.register_cmap
4242
matplotlib.cm.unregister_cmap
4343

44-
# 3.8 deprecations
45-
matplotlib.contour.ContourSet.allkinds
46-
matplotlib.contour.ContourSet.allsegs
47-
matplotlib.contour.ContourSet.tcolors
48-
matplotlib.contour.ContourSet.tlinewidths
49-
5044
# positional-only argument name lacking leading underscores
5145
matplotlib.axes._base._AxesBase.axis
5246

lib/matplotlib/contour.pyi

+8-3
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,17 @@ class ContourSet(ContourLabeler, Collection):
103103
clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None
104104
labelTexts: list[Text]
105105
labelCValues: list[ColorType]
106-
allkinds: list[np.ndarray]
107-
tcolors: list[tuple[float, float, float, float]]
106+
@property
107+
def tcolors(self) -> list[tuple[tuple[float, float, float, float]]]: ...
108108

109109
# only for not filled
110-
tlinewidths: list[tuple[float]]
110+
@property
111+
def tlinewidths(self) -> list[tuple[float]]: ...
111112

113+
@property
114+
def allkinds(self) -> list[list[np.ndarray | None]]: ...
115+
@property
116+
def allsegs(self) -> list[list[np.ndarray]]: ...
112117
@property
113118
def alpha(self) -> float | None: ...
114119
@property

lib/matplotlib/path.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Path:
3030
@vertices.setter
3131
def vertices(self, vertices: ArrayLike) -> None: ...
3232
@property
33-
def codes(self) -> ArrayLike: ...
33+
def codes(self) -> ArrayLike | None: ...
3434
@codes.setter
3535
def codes(self, codes: ArrayLike) -> None: ...
3636
@property

0 commit comments

Comments
 (0)