8000 DOC: Update sphinx to include typing module (and remove aliases which… · matplotlib/matplotlib@97ad790 · GitHub
[go: up one dir, main page]

Skip to content

Commit 97ad790

Browse files
committed
DOC: Update sphinx to include typing module (and remove aliases which moved)
Fix sphinx build ignores Add HashableList for subplot_mosaic, change subplots return to Any HashableList ignore missing reference for sphinx
1 parent 3580507 commit 97ad790

9 files changed

+27
-16
lines changed

doc/api/colors_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Other classes
5252

5353
ColorSequenceRegistry
5454
LightSource
55-
Color
5655

5756
Functions
5857
---------

doc/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Alphabetical list of modules:
153153
transformations.rst
154154
tri_api.rst
155155
type1font.rst
156+
typing_api.rst
156157
units_api.rst
157158
widgets_api.rst
158159
_api_api.rst

doc/api/lines_api.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ Classes
1717

1818
Line2D
1919
VertexSelector
20-
LineStyleType
21-
DrawStyleType
22-
MarkEveryType
2320

2421
Functions
2522
---------

doc/api/markers_api.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ Classes
1616
:template: autosummary.rst
1717

1818
MarkerStyle
19-
MarkerType
20-
FillStyleType

doc/api/typing_api.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*********************
2+
``matplotlib.typing``
3+
*********************
4+
5+
.. autodata:: matplotlib.typing.ColorType
6+
.. autodata:: matplotlib.typing.ColourType
7+
.. autodata:: matplotlib.typing.LineStyleType
8+
.. autodata:: matplotlib.typing.DrawStyleType
9+
.. autodata:: matplotlib.typing.MarkEveryType
10+
.. autodata:: matplotlib.typing.FillStyleType
11+
.. autodata:: matplotlib.typing.RcStyleType

doc/missing-references.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.twinx:1",
147147
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.twiny:1"
148148
],
149-
"Color": [
149+
"ColorType": [
150150
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.errorbar:1",
151151
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.eventplot:1",
152152
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.hist:1",
@@ -155,6 +155,9 @@
155155
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.scatter:1",
156156
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.vlines:1"
157157
],
158+
"HashableList": [
159+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.subplot_mosaic:1"
160+
],
158161
"LineStyleType": [
159162
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.eventplot:1",
160163
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.hlines:1",

lib/matplotlib/figure.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ from numpy.typing import ArrayLike
4141

4242
from collections.abc import Callable, Iterable
4343
from typing import Any, Literal, overload
44-
from .typing import ColorType
44+
from .typing import ColorType, HashableList
4545

4646
class SubplotParams:
4747
def __init__(
@@ -237,7 +237,7 @@ class FigureBase(Artist):
237237
# Any in list of list is recursive list[list[Hashable | list[Hashable | ...]]] but that can't really be type checked
238238
def subplot_mosaic(
239239
self,
240-
mosaic: str | list[list[Any]],
240+
mosaic: str | HashableList,
241241
*,
242242
sharex: bool = ...,
243243
sharey: bool = ...,

lib/matplotlib/pyplot.py

Copy file name to clipboard
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
from matplotlib.quiver import Barbs, Quiver, QuiverKey
124124
from matplotlib.scale import ScaleBase
125125
from matplotlib.transforms import Transform, Bbox
126-
from matplotlib.typing import ColorType, LineStyleType, MarkerType
126+
from matplotlib.typing import ColorType, LineStyleType, MarkerType, HashableList
127127
from matplotlib.widgets import SubplotTool
128128

129129
# We may not need the following imports here:
@@ -1415,7 +1415,7 @@ def subplots(
14151415
subplot_kw: dict[str, Any] | None = None,
14161416
gridspec_kw: dict[str, Any] | None = None,
14171417
**fig_kw
1418-
) -> tuple[Figure, Axes | np.ndarray | SubplotBase]:
1418+
) -> tuple[Figure, Any]:
14191419
"""
14201420
Create a figure and a set of subplots.
14211421
@@ -1568,7 +1568,7 @@ def subplots(
15681568

15691569

15701570
def subplot_mosaic(
1571-
mosaic: str | list[list[Any]],
1571+
mosaic: str | HashableList,
15721572
*,
15731573
sharex: bool = False,
15741574
sharey: bool = False,

lib/matplotlib/typing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
This module contains Type aliases which are useful for Matplotlib and potentially
55
downstream libraries.
66
7-
.. admonition::
7+
.. admonition:: Provisional status of typing
88
9-
The ``typing`` module is considered provisional and may change at any time without
10-
a deprecation period.
9+
The ``typing`` module and type stub files are considered provisional and may change
10+
at any time without a deprecation period.
1111
"""
1212
from collections.abc import Sequence
1313
import pathlib
14-
from typing import Any, Literal, Union
14+
from typing import Any, Hashable, Literal, Union
1515

1616
from . import path
1717
from .markers import MarkerStyle
@@ -41,3 +41,5 @@
4141
RcStyleType = Union[
4242
str, dict[str, Any], pathlib.Path, list[Union[str, pathlib.Path, dict[str, Any]]]
4343
]
44+
45+
HashableList = list[Union[Hashable, "HashableList"]]

0 commit comments

Comments
 (0)
0