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

Skip to content

Commit 23ec48d

Browse files
authored
Merge pull request #27220 from rcomer/backport-contour-typehints
Backport PR #27217 on branch v3.8.x: Fix type hints for undeprecated contour APIs
2 parents 27cec21 + ea695ee commit 23ec48d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

ci/mypy-stubtest-allowlist.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ matplotlib.widgets.MultiCursor.needclear
4646

4747
# 3.8 deprecations
4848
matplotlib.cbook.get_sample_data
49-
matplotlib.contour.ContourSet.allkinds
50-
matplotlib.contour.ContourSet.allsegs
51-
matplotlib.contour.ContourSet.tcolors
52-
matplotlib.contour.ContourSet.tlinewidths
5349
matplotlib.ticker.LogLocator.__init__
5450
matplotlib.ticker.LogLocator.set_params
5551

lib/matplotlib/contour.pyi

Lines changed: 8 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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)