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

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
2 changes: 1 addition & 1 deletion galleries/examples/widgets/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from matplotlib.typing import ColorType


@dataclass
@dataclass(frozen=True, kw_only=True, slots=True)
class ItemProperties:
fontsize: float = 14
labelcolor: ColorType = 'black'
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/dviread.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ def _mul1220(num1, num2):
return (num1*num2) >> 20


@dataclasses.dataclass(frozen=True, kw_only=True)
@dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
class TexMetrics:
"""
Metrics of a glyph, with TeX semantics.
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/dviread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Vf(Dvi):
def __init__(self, filename: str | os.PathLike) -> None: ...
def __getitem__(self, code: int) -> Page: ...

@dataclasses.dataclass(frozen=True, kw_only=True)
@dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
class TexMetrics:
tex_width: int
tex_height: int
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def __repr__(self):
return f'FontPath{self._as_tuple()}'


@dataclasses.dataclass(frozen=True)
@dataclasses.dataclass(frozen=True, slots=True)
class FontEntry:
"""
A class for storing Font properties.
Expand Down Expand Up @@ -1076,7 +1076,7 @@ def default(self, o):
if isinstance(o, FontManager):
return dict(o.__dict__, __class__='FontManager')
elif isinstance(o, FontEntry):
d = dict(o.__dict__, __class__='FontEntry')
d = dict(dataclasses.asdict(o), __class__='FontEntry')
try:
# Cache paths of fonts shipped with Matplotlib relative to the
# Matplotlib data path, which helps in the presence of venvs.
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/font_manager.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FontPath(str):
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...

@dataclass
@dataclass(frozen=True, slots=True)
class FontEntry:
fname: str = ...
index: int = ...
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ def _convert_validator_spec(key, conv):
type _MarkerType = int | str


@dataclass
@dataclass(eq=False, frozen=True, slots=True)
class _Param:
name: str
default: Any
Expand All @@ -1535,13 +1535,13 @@ class _Param:
description: str | None = None


@dataclass
@dataclass(eq=False, frozen=True, slots=True)
class _Section:
title: str
description: str | None = None


@dataclass
@dataclass(eq=False, frozen=True, slots=True)
class _Subsection:
title: str
description: str | None = None
Expand Down
10 changes: 5 additions & 5 deletions lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ def _tick_update_position(tick, tickxs, tickys, labelpos):
tick.gridline.set_data([0], [0])


@dataclass
@dataclass(eq=False, frozen=True, slots=True)
class _UpdatedArtists:
"""
Class to supply artists that have been updated ready to draw.

We track the types of artists individually, because they need
different handling in the tightbox calculation.
"""
line: mlines.Line2D = None
ticks: list = None
offset_text: mtext.Text = None
label: mtext.Text = None
line: mlines.Line2D | None = None
ticks: list | None = None
offset_text: mtext.Text | None = None
label: mtext.Text | None = None

def __iter__(self):
"""Yield all updated artists in the correct order for drawing"""
Expand Down
Loading