Skip to content

Commit ef5713e

Browse files
committed
Review and CI warnings
1 parent fda8600 commit ef5713e

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

.coveragerc

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ exclude_lines =
1212
def __str__
1313
def __repr__
1414
if __name__ == .__main__.:
15+
if TYPE_CHECKING:
16+
if typing.TYPE_CHECKING:

doc/missing-references.json

+3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@
137137
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.vlines:1"
138138
],
139139
"Axes": [
140+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.axes:1",
140141
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.colorbar:1",
142+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.delaxes:1",
143+
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.subplot2grid:1",
141144
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.subplot_mosaic:1",
142145
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.subplots:1",
143146
"lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.twinx:1",

lib/matplotlib/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@
101101
102102
"""
103103

104-
__all__ = [
104+
__all_ignore__ = [
105105
"__bibtex__",
106+
"__version__",
106107
"__version_info__",
107108
"set_loglevel",
108109
"ExecutableNotFoundError",

lib/matplotlib/__init__.pyi

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
__all__ = [
22
"__bibtex__",
3+
"__version__",
34
"__version_info__",
45
"set_loglevel",
56
"ExecutableNotFoundError",
@@ -49,8 +50,8 @@ class _VersionInfo(NamedTuple):
4950
releaselevel: str
5051
serial: int
5152

52-
class __getattr__:
53-
__version_info__: _VersionInfo
53+
__version__: str
54+
__version_info__: _VersionInfo
5455

5556
def set_loglevel(level: str) -> None: ...
5657

lib/matplotlib/pyplot.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,8 @@ def sca(ax: Axes) -> None:
12051205
Set the current Axes to *ax* and the current Figure to the parent of *ax*.
12061206
"""
12071207
figure(ax.figure)
1208+
# Mypy sees ax.figure as potentially None,
1209+
# but if you are calling this, it won't be None
12081210
ax.figure.sca(ax) # type: ignore
12091211

12101212

@@ -1217,7 +1219,7 @@ def cla() -> None:
12171219
## More ways of creating axes ##
12181220

12191221
@_docstring.dedent_interpd
1220-
def subplot(*args, **kwargs) -> matplotlib.axes.Axes:
1222+
def subplot(*args, **kwargs) -> Axes:
12211223
"""
12221224
Add an Axes to the current figure or retrieve an existing Axes.
12231225
@@ -1414,7 +1416,7 @@ def subplots(
14141416
subplot_kw: dict[str, Any] | None = None,
14151417
gridspec_kw: dict[str, Any] | None = None,
14161418
**fig_kw
1417-
) -> tuple[Figure, matplotlib.axes.Axes | np.ndarray | SubplotBase]:
1419+
) -> tuple[Figure, Axes | np.ndarray | SubplotBase]:
14181420
"""
14191421
Create a figure and a set of subplots.
14201422
@@ -1578,7 +1580,7 @@ def subplot_mosaic(
15781580
gridspec_kw: dict[str, Any] | None = None,
15791581
per_subplot_kw: dict[Any, dict[str, Any]] | None = None,
15801582
**fig_kw
1581-
) -> tuple[Figure, dict[Any, matplotlib.axes.Axes]]:
1583+
) -> tuple[Figure, dict[Any, Axes]]:
15821584
"""
15831585
Build a layout of Axes based on ASCII art or nested lists.
15841586
@@ -1742,7 +1744,7 @@ def subplot2grid(
17421744
return fig.add_subplot(subplotspec, **kwargs)
17431745

17441746

1745-
def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
1747+
def twinx(ax: Axes | None = None) -> _AxesBase:
17461748
"""
17471749
Make and return a second axes that shares the *x*-axis. The new axes will
17481750
overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -1758,7 +1760,7 @@ def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
17581760
return ax1
17591761

17601762

1761-
def twiny(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
1763+
def twiny(ax: Axes | None = None) -> _AxesBase:
17621764
"""
17631765
Make and return a second axes that shares the *y*-axis. The new axes will
17641766
overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -2213,8 +2215,8 @@ def _get_pyplot_commands() -> list[str]:
22132215
@_copy_docstring_and_deprecators(Figure.colorbar)
22142216
def colorbar(
22152217
mappable: ScalarMappable | None = None,
2216-
cax: matplotlib.axes.Axes | None = None,
2217-
ax: matplotlib.axes.Axes | Iterable[matplotlib.axes.Axes] | None = None,
2218+
cax: Axes | None = None,
2219+
ax: Axes | Iterable[Axes] | None = None,
22182220
**kwargs
22192221
) -> Colorbar:
22202222
if mappable is None:

0 commit comments

Comments
 (0)