Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Jul 9, 2024
1 parent fc4da30 commit 4682f44
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
6 changes: 3 additions & 3 deletions lib/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from matplotlib.axes._base import _AxesBase, _coords_type
from matplotlib.axes._base import _AxesBase, coords_type
from matplotlib.axes._secondary_axes import SecondaryAxis

from matplotlib.artist import Artist
Expand Down Expand Up @@ -122,8 +122,8 @@ class Axes(_AxesBase):
text: str,
xy: tuple[float, float],
xytext: tuple[float, float] | None = ...,
xycoords: _coords_type = ...,
textcoords: _coords_type = ...,
xycoords: coords_type = ...,
textcoords: coords_type | None = ...,
arrowprops: dict[str, Any] | None = ...,
annotation_clip: bool | None = ...,
**kwargs
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
_log = logging.getLogger(__name__)


_coords_type_base = (
coords_type_base = (
str |
martist.Artist |
mtransforms.Transform |
Callable[[backend_bases.RendererBase], mtransforms.Bbox | mtransforms.Transform]
)
_coords_type = _coords_type_base | tuple[_coords_type_base, _coords_type_base]
coords_type = coords_type_base | tuple[coords_type_base, coords_type_base]


class _axis_method_wrapper:
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/axes/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ from numpy.typing import ArrayLike
from typing import Any, Literal, TypeVar, overload
from matplotlib.typing import ColorType

coords_type_base = str | Artist | Transform | Callable[[RendererBase], Bbox | Transform]
coords_type = coords_type_base | tuple[coords_type_base, coords_type_base]

_T = TypeVar("_T", bound=Artist)

class _axis_method_wrapper:
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/offsetbox.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import matplotlib.artist as martist
from matplotlib.axes._base import _coords_type
from matplotlib.axes._base import coords_type
from matplotlib.backend_bases import RendererBase, Event, FigureCanvasBase
from matplotlib.colors import Colormap, Normalize
import matplotlib.text as mtext
Expand Down Expand Up @@ -220,7 +220,7 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
offsetbox: OffsetBox
arrowprops: dict[str, Any] | None
xybox: tuple[float, float]
boxcoords: _coords_type
boxcoords: coords_type
arrow_patch: FancyArrowPatch | None
patch: FancyBboxPatch
prop: FontProperties
Expand All @@ -229,8 +229,8 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
offsetbox: OffsetBox,
xy: tuple[float, float],
xybox: tuple[float, float] | None = ...,
xycoords: _coords_type = ...,
boxcoords: _coords_type = ...,
xycoords: coords_type = ...,
boxcoords: coords_type = ...,
*,
frameon: bool = ...,
pad: float = ...,
Expand All @@ -248,11 +248,11 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
@property
def anncoords(
self,
) -> _coords_type: ...
) -> coords_type: ...
@anncoords.setter
def anncoords(
self,
coords: _coords_type,
coords: coords_type,
) -> None: ...
def get_children(self) -> list[martist.Artist]: ...
def set_figure(self, fig: Figure) -> None: ...
Expand Down
9 changes: 4 additions & 5 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
import matplotlib.artist
import matplotlib.backend_bases
from matplotlib.axis import Tick
from matplotlib.axes._base import _AxesBase, _coords_type
from matplotlib.backend_bases import RendererBase, Event
from matplotlib.axes._base import _AxesBase, coords_type
from matplotlib.backend_bases import Event
from matplotlib.cm import ScalarMappable
from matplotlib.contour import ContourSet, QuadContourSet
from matplotlib.collections import (
Expand All @@ -119,7 +119,6 @@
from matplotlib.patches import FancyArrow, StepPatch, Wedge
from matplotlib.quiver import Barbs, Quiver, QuiverKey
from matplotlib.scale import ScaleBase
from matplotlib.transforms import Transform, Bbox
from matplotlib.typing import ColorType, LineStyleType, MarkerType, HashableList
from matplotlib.widgets import SubplotTool

Expand Down Expand Up @@ -2858,8 +2857,8 @@ def annotate(
text: str,
xy: tuple[float, float],
xytext: tuple[float, float] | None = None,
xycoords: _coords_type = "data",
textcoords: _coords_type = None,
xycoords: coords_type = "data",
textcoords: coords_type | None = None,
arrowprops: dict[str, Any] | None = None,
annotation_clip: bool | None = None,
**kwargs,
Expand Down
22 changes: 11 additions & 11 deletions lib/matplotlib/text.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .artist import Artist
from .axes._base import _coords_type
from .axes._base import coords_type
from .backend_bases import RendererBase
from .font_manager import FontProperties
from .offsetbox import DraggableAnnotation
Expand Down Expand Up @@ -121,11 +121,11 @@ class OffsetFrom:

class _AnnotationBase:
xy: tuple[float, float]
xycoords: _coords_type
xycoords: coords_type
def __init__(
self,
xy,
xycoords: _coords_type = ...,
xycoords: coords_type = ...,
annotation_clip: bool | None = ...,
) -> None: ...
def set_annotation_clip(self, b: bool | None) -> None: ...
Expand All @@ -142,40 +142,40 @@ class Annotation(Text, _AnnotationBase):
text: str,
xy: tuple[float, float],
xytext: tuple[float, float] | None = ...,
xycoords: _coords_type = ...,
textcoords: _coords_type = ...,
xycoords: coords_type = ...,
textcoords: coords_type | None = ...,
arrowprops: dict[str, Any] | None = ...,
annotation_clip: bool | None = ...,
**kwargs
) -> None: ...
@property
def xycoords(
self,
) -> _coords_type: ...
) -> coords_type: ...
@xycoords.setter
def xycoords(
self,
xycoords: _coords_type,
xycoords: coords_type,
) -> None: ...
@property
def xyann(self) -> tuple[float, float]: ...
@xyann.setter
def xyann(self, xytext: tuple[float, float]) -> None: ...
def get_anncoords(
self,
) -> _coords_type: ...
) -> coords_type: ...
def set_anncoords(
self,
coords: _coords_type,
coords: coords_type,
) -> None: ...
@property
def anncoords(
self,
) -> _coords_type: ...
) -> coords_type: ...
@anncoords.setter
def anncoords(
self,
coords: _coords_type,
coords: coords_type,
) -> None: ...
def update_positions(self, renderer: RendererBase) -> None: ...
# Drops `dpi` parameter from superclass
Expand Down

0 comments on commit 4682f44

Please sign in to comment.