Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c689fa

Browse filesBrowse files
committed
Fix return value of Text.update
The return value of `Artist.update` is a list of the results from calling the setters. However, while `Text` overrides `update`, it does not preserve that return value.
1 parent d073a36 commit 8c689fa
Copy full SHA for 8c689fa

File tree

Expand file treeCollapse file tree

2 files changed

+6
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-4
lines changed

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,19 @@ def _reset_visual_defaults(
193193

194194
def update(self, kwargs):
195195
# docstring inherited
196+
ret = []
196197
kwargs = cbook.normalize_kwargs(kwargs, Text)
197198
sentinel = object() # bbox can be None, so use another sentinel.
198199
# Update fontproperties first, as it has lowest priority.
199200
fontproperties = kwargs.pop("fontproperties", sentinel)
200201
if fontproperties is not sentinel:
201-
self.set_fontproperties(fontproperties)
202+
ret.append(self.set_fontproperties(fontproperties))
202203
# Update bbox last, as it depends on font properties.
203204
bbox = kwargs.pop("bbox", sentinel)
204-
super().update(kwargs)
205+
ret.extend(super().update(kwargs))
205206
if bbox is not sentinel:
206-
self.set_bbox(bbox)
207+
ret.append(self.set_bbox(bbox))
208+
return ret
207209

208210
def __getstate__(self):
209211
d = super().__getstate__()

‎lib/matplotlib/text.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/text.pyi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Text(Artist):
4343
antialiased: bool | None = ...,
4444
**kwargs
4545
) -> None: ...
46-
def update(self, kwargs: dict[str, Any]) -> None: ...
46+
def update(self, kwargs: dict[str, Any]) -> list[Any]: ...
4747
def get_rotation(self) -> float: ...
4848
def get_transform_rotates_text(self) -> bool: ...
4949
def set_rotation_mode(self, m: None | Literal["default", "anchor"]) -> None: ...

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.