10000 TYP: Move some things from Bbox to BboxBase · matplotlib/matplotlib@f268b74 · GitHub
[go: up one dir, main page]

Skip to content

Commit f268b74

Browse files
committed
TYP: Move some things from Bbox to BboxBase
Mostly because these might be `TransformedBbox`.
1 parent 8366bf4 commit f268b74

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def set_clip_box(self, clipbox):
757757
758758
Parameters
759759
----------
760-
clipbox : `.Bbox` or None
760+
clipbox : `.BboxBase` or None
761761
Typically would be created from a `.TransformedBbox`. For
762762
instance ``TransformedBbox(Bbox([[0, 0], [1, 1]]), ax.transAxes)``
763763
is the default clipping for an artist added to an Axes.

lib/matplotlib/artist.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from .path import Path
55
from .patches import Patch
66
from .patheffects import AbstractPathEffect
77
from .transforms import (
8+
BboxBase,
89
Bbox,
910
Transform,
1011
TransformedPatchPath,
@@ -30,7 +31,7 @@ class Artist:
3031
def __init_subclass__(cls): ...
3132
stale_callback: Callable[[Artist, bool], None] | None
3233
figure: Figure | SubFigure | None
33-
clipbox: Bbox | None
34+
clipbox: BboxBase | None
3435
def __init__(self) -> None: ...
3536
def remove(self) -> None: ...
3637
def have_units(self) -> bool: ...
@@ -87,7 +88,7 @@ class Artist:
8788
def get_path_effects(self) -> list[AbstractPathEffect]: ...
8889
def get_figure(self) -> Figure | None: ...
8990
def set_figure(self, fig: Figure) -> None: ...
90-
def set_clip_box(self, clipbox: Bbox | None) -> None: ...
91+
def set_clip_box(self, clipbox: BboxBase | None) -> None: ...
9192
def set_clip_path(
9293
self,
9394
path: Patch | Path | TransformedPath | TransformedPatchPath | None,

lib/matplotlib/backend_bases.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ from matplotlib.font_manager import FontProperties
1616
from matplotlib.path import Path
1717
from matplotlib.texmanager import TexManager
1818
from matplotlib.text import Text
19-
from matplotlib.transforms import Transform, TransformedPath, Bbox
19+
from matplotlib.transforms import Bbox, BboxBase, Transform, TransformedPath
2020

2121
from collections.abc import Callable, Iterable, Sequence
2222
from typing import Any, IO, Literal, NamedTuple, TypeVar
@@ -323,7 +323,7 @@ class FigureCanvasBase:
323323
@classmethod
324324
def new_manager(cls, figure: Figure, num: int | str): ...
325325
def is_saving(self) -> bool: ...
326-
def blit(self, bbox: Bbox | None = ...) -> None: ...
326+
def blit(self, bbox: BboxBase | None = ...) -> None: ...
327327
def inaxes(self, xy: tuple[float, float]) -> Axes | None: ...
328328
def grab_mouse(self, ax: Axes) -> None: ...
329329
def release_mouse(self, ax: Axes) -> None: ...

lib/matplotlib/backend_managers.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class ToolManager:
5252
def add_tool(self, name: str, tool: type[_T], *args, **kwargs) -> _T: ...
5353
def trigger_tool(
5454
self,
55-
name: str,
55+
name: str | backend_tools.ToolBase,
5656
sender: Any | None = ...,
5757
canvasevent: ToolEvent | None = ...,
5858
data: Any | None = ...,
5959
) -> None: ...
6060
@property
6161
def tools(self) -> dict[str, backend_tools.ToolBase]: ...
6262
def get_tool(
63-
self, name: str, warn: bool = ...
63+
self, name: str | backend_tools.ToolBase, warn: bool = ...
6464
) -> backend_tools.ToolBase | None: ...

lib/matplotlib/figure.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from matplotlib.legend import Legend
1818
from matplotlib.lines import Line2D
1919
from matplotlib.patches import Rectangle, Patch
2020
from matplotlib.text import Text
21-
from matplotlib.transforms import Affine2D, Bbox, Transform
21+
from matplotlib.transforms import Affine2D, Bbox, BboxBase, Transform
2222

2323
import numpy as np
2424
from numpy.typing import ArrayLike
@@ -249,8 +249,8 @@ class SubFigure(FigureBase):
249249
canvas: FigureCanvasBase
250250
transFigure: Transform
251251
bbox_relative: Bbox
252-
figbbox: Bbox
253-
bbox: Bbox
252+
figbbox: BboxBase
253+
bbox: BboxBase
254254
transSubfigure: Transform
255255
patch: Rectangle
256256
def __init__(
@@ -283,8 +283,8 @@ class Figure(FigureBase):
283283
figure: Figure
284284
bbox_inches: Bbox
285285
dpi_scale_trans: Affine2D
286-
bbox: Bbox
287-
figbbox: Bbox
286+
bbox: BboxBase
287+
figbbox: BboxBase
288288
transFigure: Transform
289289
transSubfigure: Transform
290290
patch: Rectangle

lib/matplotlib/offsetbox.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class AnchoredOffsetbox(OffsetBox):
179179
def get_children(self) -> list[martist.Artist]: ...
180180
def get_bbox_to_anchor(self) -> Bbox: ...
181181
def set_bbox_to_anchor(
182-
self, bbox: Bbox, transform: Transform | None = ...
182+
self, bbox: BboxBase, transform: Transform | None = ...
183183
) -> None: ...
184184
def update_frame(self, bbox: Bbox, fontsize: float | None = ...) -> None: ...
185185

0 commit comments

Comments
 (0)
0