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

Skip to content

Commit d2cbfe1

Browse files
committed
Review and CI warnings
1 parent 966d185 commit d2cbfe1

5 files changed

Lines changed: 19 additions & 10 deletions

File tree

.coveragerc

Lines changed: 2 additions & 0 deletions
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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@
103103
104104
"""
105105

106-
__all__ = [
106+
__all_ignore__ = [
107107
"__bibtex__",
108+
"__version__",
108109
"__version_info__",
109110
"set_loglevel",
110111
"ExecutableNotFoundError",

lib/matplotlib/__init__.pyi

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,8 @@ def sca(ax: Axes) -> None:
12151215
Set the current Axes to *ax* and the current Figure to the parent of *ax*.
12161216
"""
12171217
figure(ax.figure)
1218+
# Mypy sees ax.figure as potentially None,
1219+
# but if you are calling this, it won't be None
12181220
ax.figure.sca(ax) # type: ignore
12191221

12201222

@@ -1227,7 +1229,7 @@ def cla() -> None:
12271229
## More ways of creating axes ##
12281230

12291231
@_docstring.dedent_interpd
1230-
def subplot(*args, **kwargs) -> matplotlib.axes.Axes:
1232+
def subplot(*args, **kwargs) -> Axes:
12311233
"""
12321234
Add an Axes to the current figure or retrieve an existing Axes.
12331235
@@ -1437,7 +1439,7 @@ def subplots(
14371439
subplot_kw: dict[str, Any] | None = None,
14381440
gridspec_kw: dict[str, Any] | None = None,
14391441
**fig_kw
1440-
) -> tuple[Figure, matplotlib.axes.Axes | np.ndarray | SubplotBase]:
1442+
) -> tuple[Figure, Axes | np.ndarray | SubplotBase]:
14411443
"""
14421444
Create a figure and a set of subplots.
14431445
@@ -1601,7 +1603,7 @@ def subplot_mosaic(
16011603
gridspec_kw: dict[str, Any] | None = None,
16021604
per_subplot_kw: dict[Any, dict[str, Any]] | None = None,
16031605
**fig_kw
1604-
) -> tuple[Figure, dict[Any, matplotlib.axes.Axes]]:
1606+
) -> tuple[Figure, dict[Any, Axes]]:
16051607
"""
16061608
Build a layout of Axes based on ASCII art or nested lists.
16071609
@@ -1780,7 +1782,7 @@ def subplot2grid(
17801782
return ax
17811783

17821784

1783-
def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
1785+
def twinx(ax: Axes | None = None) -> _AxesBase:
17841786
"""
17851787
Make and return a second axes that shares the *x*-axis. The new axes will
17861788
overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -1796,7 +1798,7 @@ def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
17961798
return ax1
17971799

17981800

1799-
def twiny(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
1801+
def twiny(ax: Axes | None = None) -> _AxesBase:
18001802
"""
18011803
Make and return a second axes that shares the *y*-axis. The new axes will
18021804
overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -2251,8 +2253,8 @@ def _get_pyplot_commands() -> list[str]:
22512253
@_copy_docstring_and_deprecators(Figure.colorbar)
22522254
def colorbar(
22532255
mappable: ScalarMappable | None = None,
2254-
cax: matplotlib.axes.Axes | None = None,
2255-
ax: matplotlib.axes.Axes | Iterable[matplotlib.axes.Axes] | None = None,
2256+
cax: Axes | None = None,
2257+
ax: Axes | Iterable[Axes] | None = None,
22562258
**kwargs
22572259
) -> Colorbar:
22582260
if mappable is None:

0 commit comments

Comments
 (0)