Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/matplotlib/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ from matplotlib.typing import RcKeyType, RcGroupKeyType
from typing import Any, Literal, NamedTuple, overload
from matplotlib.typing import LogLevel


class _VersionInfo(NamedTuple):
major: int
minor: int
Expand Down
6 changes: 0 additions & 6 deletions lib/matplotlib/_docstring.pyi
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
from collections.abc import Callable
from typing import Any, overload


def kwarg_doc[T](text: str) -> Callable[[T], T]: ...


class Substitution:
@overload
def __init__(self, *args: str): ...
@overload
def __init__(self, **kwargs: str): ...
def __call__[T](self, func: T) -> T: ...


class _ArtistKwdocLoader(dict[str, str]):
def __missing__(self, key: str) -> str: ...


class _ArtistPropertiesSubstitution:
def __init__(self) -> None: ...
def register(self, **kwargs) -> None: ...
def __call__[T](self, obj: T) -> T: ...


def copy[T](source: Any) -> Callable[[T], T]: ...


dedent_interpd: _ArtistPropertiesSubstitution
interpd: _ArtistPropertiesSubstitution
2 changes: 0 additions & 2 deletions lib/matplotlib/_enums.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from enum import Enum


class JoinStyle(str, Enum):
miter = "miter"
round = "round"
bevel = "bevel"
@staticmethod
def demo() -> None: ...


class CapStyle(str, Enum):
butt = "butt"
projecting = "projecting"
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/artist.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ class ArtistInspector:
def properties(self) -> dict[str, Any]: ...
def pprint_getters(self) -> list[str]: ...


class ArtistList[T: Artist](Sequence[T]):
def __init__(
self,
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/axes/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from ._axes import Axes as Axes


# Backcompat.
Subplot = Axes

Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3939,7 +3939,6 @@ def pie_label(self, container, /, labels, *, distance=0.6,

return texts


@staticmethod
def _errorevery_to_mask(x, errorevery):
"""
Expand Down
7 changes: 3 additions & 4 deletions lib/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ from matplotlib.typing import (
ColorType, DataParamType, MarkerType, LegendLocType, LineStyleType)
import pandas as pd


class _GroupedBarReturn:
bar_containers: list[BarContainer]
def __init__(self, bar_containers: list[BarContainer]) -> None: ...
Expand Down Expand Up @@ -632,9 +631,9 @@ class Axes(_AxesBase):
x: ArrayLike,
weights: ArrayLike | None = ...,
*,
complementary: bool=...,
orientation: Literal["vertical", "horizontal"]=...,
compress: bool=...,
complementary: bool = ...,
orientation: Literal["vertical", "horizontal"] = ...,
compress: bool = ...,
data: DataParamType = ...,
**kwargs
) -> Line2D: ...
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/axis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ from matplotlib.transforms import Transform, Bbox
from matplotlib.typing import ColorType
from matplotlib.units import ConversionInterface


GRIDLINE_INTERPOLATION_STEPS: int

class Tick(martist.Artist):
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/backends/backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,6 @@ def _icon(self, name):
engine = _IconEngine(path_regular, self)
return QtGui.QIcon(engine)


def edit_parameters(self):
axes = self.canvas.figure.get_axes()
if not axes:
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/registry.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from enum import Enum
from types import ModuleType


class BackendFilter(Enum):
INTERACTIVE = 0
NON_INTERACTIVE = 1


class BackendRegistry:
_BUILTIN_BACKEND_TO_GUI_FRAMEWORK: dict[str, str]
_GUI_FRAMEWORK_TO_BACKEND: dict[str, str]
Expand All @@ -31,5 +29,4 @@ class BackendRegistry:
def resolve_backend(self, backend: str | None) -> tuple[str, str | None]: ...
def resolve_gui_or_backend(self, gui_or_backend: str | None) -> tuple[str, str | None]: ...


backend_registry: BackendRegistry
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/web_backend/nbagg_uat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@
"\n",
"manager = new_figure_manager(1000)\n",
"fig = manager.canvas.figure\n",
"ax = fig.add_subplot(1,1,1)\n",
"ax.plot([1,2,3])\n",
"ax = fig.add_subplot(1, 1, 1)\n",
"ax.plot([1, 2, 3])\n",
"fig.show()"
]
},
Expand Down Expand Up @@ -403,9 +403,9 @@
"source": [
"import itertools\n",
"fig, ax = plt.subplots()\n",
"x = np.linspace(0,10,10000)\n",
"x = np.linspace(0, 10, 10000)\n",
"y = np.sin(x)\n",
"ln, = ax.plot(x,y)\n",
"ln, = ax.plot(x, y)\n",
"evt = []\n",
"colors = iter(itertools.cycle(['r', 'g', 'b', 'k', 'c']))\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/cm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ from collections.abc import Iterator, Mapping
from matplotlib import colors
from matplotlib.colorizer import _ScalarMappable


class ColormapRegistry(Mapping[str, colors.Colormap]):
def __init__(self, cmaps: Mapping[str, colors.Colormap]) -> None: ...
def __getitem__(self, item: str) -> colors.Colormap: ...
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/collections.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ class LineCollection(Collection):
def get_colors(self) -> ColorType | Sequence[ColorType]: ...
def get_gapcolor(self) -> ColorType | Sequence[ColorType] | None: ...


class EventCollection(LineCollection):
def __init__(
self,
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/colorbar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ from collections.abc import Sequence
from typing import Any, Literal, overload
from .typing import ColorType


class _ColorbarSpine(mspines.Spine):
def __init__(self, axes: Axes): ...
def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
def set_xy(self, xy: ArrayLike) -> None: ...
def draw(self, renderer: RendererBase | None) -> None: ...


class Colorbar:
n_rasterize: int
mappable: cm.ScalarMappable | colorizer.ColorizingArtist
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/colorizer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from matplotlib import cbook, colorbar, colors, artist
import numpy as np
from numpy.typing import ArrayLike


class Colorizer:
colorbar: colorbar.Colorbar | None
callbacks: cbook.CallbackRegistry
Expand Down Expand Up @@ -45,7 +44,6 @@ class Colorizer:
@clip.setter
def clip(self, value: ArrayLike | bool | tuple[bool, ...]) -> None: ...


class _ColorizerInterface:
cmap: colors.Colormap | colors.BivarColormap | colors.MultivarColormap
colorbar: colorbar.Colorbar | None
Expand All @@ -70,7 +68,6 @@ class _ColorizerInterface:
def autoscale(self) -> None: ...
def autoscale_None(self) -> None: ...


class _ScalarMappable(_ColorizerInterface):
def __init__(
self,
Expand All @@ -84,7 +81,6 @@ class _ScalarMappable(_ColorizerInterface):
def get_array(self) -> np.ndarray | None: ...
def changed(self) -> None: ...


class ColorizingArtist(_ScalarMappable, artist.Artist):
callbacks: cbook.CallbackRegistry
def __init__(
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/colors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ class Norm(ABC):
@property
def n_components(self) -> int: ...


class Normalize(Norm):
def __init__(
self, vmin: float | None = ..., vmax: float | None = ..., clip: bool = ...
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/contour.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ from collections.abc import Callable, Iterable, Sequence
from typing import Literal
from .typing import ColorType



class ContourLabeler:
labelFmt: str | Formatter | Callable[[float], str] | dict[float, str]
labelManual: bool | Iterable[tuple[float, float]]
Expand Down
10 changes: 5 additions & 5 deletions lib/matplotlib/dates.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ import numpy.typing as npt

TZ = str | datetime.tzinfo

def _get_tzinfo(tz: TZ | None=None) -> datetime.tzinfo: ...
def _get_tzinfo(tz: TZ | None = None) -> datetime.tzinfo: ...
def _reset_epoch_test_example() -> None: ...
def set_epoch(epoch: str) -> None: ...
def get_epoch() -> str: ...
def _dt64_to_ordinalf(d: npt.NDArray[np.datetime64]) -> npt.NDArray[np.floating]: ...
def _from_ordinalf(x: float, tz: TZ | None=None) -> datetime.datetime: ...
def _from_ordinalf(x: float, tz: TZ | None = None) -> datetime.datetime: ...
# Ideally str | Sequence[str] would get an override, but because a str is a valid Sequence[str],
# it's not possible to distinguish between them in the type system
# See https://github.com/python/typing/issues/256
def datestr2num(d: str | Sequence[str], default: datetime.datetime | None=None) -> float | npt.NDArray[np.floating]: ...
def datestr2num(d: str | Sequence[str], default: datetime.datetime | None = None) -> float | npt.NDArray[np.floating]: ...

@overload
def date2num(d: datetime.datetime | np.datetime64) -> float: ...
@overload
def date2num(d: Sequence[datetime.datetime] | Sequence[np.datetime64]) -> npt.NDArray[np.floating]: ...

@overload
def num2date(x: float, tz: TZ | None=None) -> datetime.datetime: ...
def num2date(x: float, tz: TZ | None = None) -> datetime.datetime: ...
@overload
def num2date(x: Sequence[float], tz: TZ | None=None) -> list[datetime.datetime]: ...
def num2date(x: Sequence[float], tz: TZ | None = None) -> list[datetime.datetime]: ...

@overload
def num2timedelta(x: float) -> datetime.timedelta: ...
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/dviread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ from typing import Self

from .ft2font import CharacterCodeType, GlyphIndexType


class _dvistate(Enum):
pre = ...
outer = ...
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/legend.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ from matplotlib.transforms import (
)
from matplotlib.typing import ColorType, LegendLocType


import pathlib
from collections.abc import Iterable
from typing import Any, Literal, overload


class DraggableLegend(DraggableOffsetBox):
legend: Legend
def __init__(
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/patches.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ class Ellipse(Patch):
def get_vertices(self) -> list[tuple[float, float]]: ...
def get_co_vertices(self) -> list[tuple[float, float]]: ...


class Annulus(Patch):
a: float
b: float
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/quiver.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from matplotlib.figure import Figure, SubFigure
from matplotlib.text import Text
from matplotlib.transforms import Transform, Bbox


import numpy as np
from numpy.typing import ArrayLike
from collections.abc import Sequence
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/rcsetup.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ from collections.abc import Callable, Iterable
from typing import Any, Literal
from matplotlib.typing import ColorType, LineStyleType, MarkEveryType


def _listify_validator[T](
scalar_validator: Callable[[Any], T],
allow_stringlist: bool = ...,
Expand Down
6 changes: 5 additions & 1 deletion lib/matplotlib/tests/test_cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def dummy(self): pass

class Unhashable:
__hash__ = None # type: ignore[assignment]

def dummy(self): pass


Expand Down Expand Up @@ -660,12 +661,16 @@ def test_warn_external_collections_abc(recwarn):
class UselessSequence(MutableSequence):
def __len__(self):
return 2

def __getitem__(self, subscript):
return 'foo'

def __delitem__(self, index):
pass

def __setitem__(self, key, item):
pass

def insert(self, index, item):
_api.warn_external("This won't do anything")

Expand All @@ -677,7 +682,6 @@ def insert(self, index, item):
assert 'collection' not in recwarn[0].filename



def test_warn_external_frame_embedded_python():
with patch.object(cbook, "sys") as mock_sys:
mock_sys._getframe = Mock(return_value=None)
Expand Down
14 changes: 7 additions & 7 deletions lib/matplotlib/tests/test_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,15 +1893,15 @@ def scaled(self):
def n_components(self):
return 1

fig, axes = plt.subplots(2,2)
fig, axes = plt.subplots(2, 2)

r = np.linspace(-1, 3, 16*16).reshape((16,16))
r = np.linspace(-1, 3, 16*16).reshape((16, 16))
norm = CustomHalfNorm()
colorizer = mpl.colorizer.Colorizer(cmap='viridis', norm=norm)
c = axes[0,0].imshow(r, colorizer=colorizer)
axes[0,1].pcolor(r, colorizer=colorizer)
axes[1,0].contour(r, colorizer=colorizer)
axes[1,1].contourf(r, colorizer=colorizer)
c = axes[0, 0].imshow(r, colorizer=colorizer)
axes[0, 1].pcolor(r, colorizer=colorizer)
axes[1, 0].contour(r, colorizer=colorizer)
axes[1, 1].contourf(r, colorizer=colorizer)


def test_close_error_name():
Expand Down Expand Up @@ -2012,7 +2012,7 @@ def test_mult_norm_call_types():
mn.vmin = (-2, -2)
mn.vmax = (2, 2)

vals = np.arange(6).reshape((3,2))
vals = np.arange(6).reshape((3, 2))
target = np.ma.array([(0.5, 0.75),
(1., 1.25),
(1.5, 1.75)])
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def test_rcparams_path_sketch_from_file(tmp_path, value):
('font', 'sans-serif', 'sans', ["Verdana"])
])
def test_rc_aliases(group, option, alias, value):
rc_kwargs = {alias: value,}
rc_kwargs = {alias: value}
mpl.rc(group, **rc_kwargs)

rcParams_key = f"{group}.{option}"
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/transforms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ def offset_copy(
units: Literal["inches", "points", "dots"] = ...,
) -> Transform: ...


class _ScaledRotation(Affine2DBase):
def __init__(self, theta: float, trans_shift: Transform) -> None: ...
def get_matrix(self) -> np.ndarray: ...
Loading
Loading