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

[TYP] Reduce stubtest ignores #25844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2023
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
18 changes: 3 additions & 15 deletions 18 ci/mypy-stubtest-allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ matplotlib.*\.set$
matplotlib.pyplot.*
matplotlib.typing.*

# Other decorator modifying signature (maybe investigate)
# Other decorator modifying signature
# Runtime picks up *args **kwargs, but only decorated by a decorator that uses @wraps so?
matplotlib.axis.Axis.draw
# Backcompat decorator which does not modify runtime reported signature
matplotlib.offsetbox.*Offset[Bb]ox.get_offset

# Inconsistent super/sub class signatures (other than just arg name)
matplotlib.ticker.MultipleLocator.set_params
matplotlib.text.Annotation.get_window_extent

# Inconsistent super/sub class parameter name (maybe rename for consistency)
matplotlib.projections.polar.RadialLocator.nonsingular
matplotlib.ticker.LogLocator.nonsingular
Expand Down Expand Up @@ -163,12 +161,6 @@ matplotlib.axes._base._AxesBase.get_fc
matplotlib.axes._base._AxesBase.set_fc

# Other dynamic python behaviors not type hinted
matplotlib.projections.polar.PolarAxes.InvertedPolarTransform
matplotlib.projections.polar.PolarAxes.PolarAffine
matplotlib.projections.polar.PolarAxes.PolarTransform
matplotlib.projections.polar.PolarAxes.RadialLocator
matplotlib.projections.polar.PolarAxes.ThetaFormatter
matplotlib.projections.polar.PolarAxes.ThetaLocator
matplotlib.rcsetup.defaultParams

# Maybe should be abstractmethods, required for subclasses, stubs define once
Expand All @@ -178,10 +170,6 @@ matplotlib.tri.*TriInterpolator.gradient
# Functionally a method call, but actually a class instance, type hinted as former
matplotlib.rcsetup.validate_fillstyle

# C-defined method without docstring indicating signature
matplotlib.transforms.count_bboxes_overlapping_bbox
matplotlib.transforms.update_path_extents

# TypeVar used only in type hints
matplotlib.backend_bases.FigureCanvasBase._T
matplotlib.backend_managers.ToolManager._T
Expand Down
4 changes: 2 additions & 2 deletions 4 lib/matplotlib/_path.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import numpy as np
from .transforms import BboxBase

def affine_transform(points: np.ndarray, trans: np.ndarray) -> np.ndarray: ...
def count_bboxes_overlapping_bbox(a: BboxBase, bboxes: Sequence[BboxBase]) -> int: ...
def update_path_extents(*args, **kwargs): ...
def count_bboxes_overlapping_bbox(bbox: BboxBase, bboxes: Sequence[BboxBase]) -> int: ...
def update_path_extents(path, trans, rect, minpos, ignore): ...
10 changes: 9 additions & 1 deletion 10 lib/matplotlib/projections/polar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from matplotlib.ticker import _DummyAxis
import numpy as np
from numpy.typing import ArrayLike
from collections.abc import Sequence
from typing import Any, Literal, overload
from typing import Any, ClassVar, Literal, overload

class PolarTransform(mtransforms.Transform):
input_dims: int
Expand Down Expand Up @@ -84,6 +84,14 @@ class _WedgeBbox(mtransforms.Bbox):
) -> None: ...

class PolarAxes(Axes):

PolarTransform: ClassVar[type] = PolarTransform
PolarAffine: ClassVar[type] = PolarAffine
InvertedPolarTransform: ClassVar[type] = InvertedPolarTransform
ThetaFormatter: ClassVar[type] = ThetaFormatter
RadialLocator: ClassVar[type] = RadialLocator
ThetaLocator: ClassVar[type] = ThetaLocator

name: str
use_sticky_edges: bool
def __init__(
Expand Down
2 changes: 2 additions & 0 deletions 2 lib/matplotlib/text.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ class Annotation(Text, _AnnotationBase):
| Callable[[RendererBase], Bbox | Transform],
) -> None: ...
def update_positions(self, renderer: RendererBase) -> None: ...
# Drops `dpi` parameter from superclass
def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... # type: ignore[override]
5 changes: 4 additions & 1 deletion 5 lib/matplotlib/ticker.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ class PercentFormatter(Formatter):
class Locator(TickHelper):
MAXTICKS: int
def tick_values(self, vmin: float, vmax: float) -> Sequence[float]: ...
# Implementation accepts **kwargs, but is a no-op other than a warning
# Typing as **kwargs would require each subclass to accept **kwargs for mypy
def set_params(self) -> None: ...
def __call__(self) -> Sequence[float]: ...
def raise_if_exceeds(self, locs: Sequence[float]) -> Sequence[float]: ...
Expand Down Expand Up @@ -211,7 +213,8 @@ class LinearLocator(Locator):

class MultipleLocator(Locator):
def __init__(self, base: float = ...) -> None: ...
def set_params(self, base: float | None = ...) -> None: ...
# Makes set_params `base` argument mandatory
def set_params(self, base: float | None) -> None: ... # type: ignore[override]
def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ...

class _Edge_integer:
Expand Down
5 changes: 0 additions & 5 deletions 5 lib/matplotlib/transforms.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
from .path import Path
from .patches import Patch
from .figure import Figure
from matplotlib._path import (
affine_transform as affine_transform,
count_bboxes_overlapping_bbox as count_bboxes_overlapping_bbox,
update_path_extents as update_path_extents,
)
import numpy as np
from numpy.typing import ArrayLike
from collections.abc import Iterable, Sequence
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.