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

Skip to content

[TYP] Remove some stubtest allowlist entries #26927

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
Sep 28, 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: 0 additions & 18 deletions ci/mypy-stubtest-allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ matplotlib.ticker.LogitLocator.nonsingular
matplotlib.backend_bases._Mode.__new__
matplotlib.units.Number.__hash__

# Property read-write vs read-only weirdness, fix if possible
matplotlib.offsetbox.DraggableBase.canvas
matplotlib.offsetbox.DraggableBase.cids
matplotlib.transforms.BboxTransform.is_separable
matplotlib.transforms.BboxTransformFrom.is_separable
matplotlib.transforms.BboxTransformTo.is_separable
matplotlib.transforms.BlendedAffine2D.is_separable
matplotlib.transforms.CompositeGenericTransform.is_separable
matplotlib.transforms.TransformWrapper.input_dims
matplotlib.transforms.TransformWrapper.is_separable
matplotlib.transforms.TransformWrapper.output_dims

# 3.6 Pending deprecations
matplotlib.figure.Figure.set_constrained_layout
matplotlib.figure.Figure.set_constrained_layout_pads
Expand Down Expand Up @@ -148,16 +136,10 @@ matplotlib.text.Text.set_weight
matplotlib.axes._base._AxesBase.get_fc
matplotlib.axes._base._AxesBase.set_fc

# Other dynamic python behaviors not type hinted
matplotlib.rcsetup.defaultParams

# Maybe should be abstractmethods, required for subclasses, stubs define once
matplotlib.tri.*TriInterpolator.__call__
matplotlib.tri.*TriInterpolator.gradient

# Functionally a method call, but actually a class instance, type hinted as former
matplotlib.rcsetup.validate_fillstyle

# TypeVar used only in type hints
matplotlib.backend_bases.FigureCanvasBase._T
matplotlib.backend_managers.ToolManager._T
Expand Down
8 changes: 6 additions & 2 deletions lib/matplotlib/offsetbox.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,15 @@ class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
class DraggableBase:
ref_artist: martist.Artist
got_artist: bool
canvas: FigureCanvasBase
cids: list[int]
mouse_x: int
mouse_y: int
background: Any

@property
def canvas(self) -> FigureCanvasBase: ...
@property
def cids(self) -> list[int]: ...

def __init__(self, ref_artist: martist.Artist, use_blit: bool = ...) -> None: ...
def on_motion(self, evt: Event) -> None: ...
def on_pick(self, evt: Event) -> None: ...
Expand Down
9 changes: 6 additions & 3 deletions lib/matplotlib/rcsetup.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ def validate_fontstretch(
def validate_font_properties(s: Any) -> dict[str, Any]: ...
def validate_whiskers(s: Any) -> list[float] | float: ...
def validate_ps_distiller(s: Any) -> None | Literal["ghostscript", "xpdf"]: ...
def validate_fillstyle(
s: Any,
) -> Literal["full", "left", "right", "bottom", "top", "none"]: ...

validate_fillstyle: ValidateInStrings

def validate_fillstylelist(
s: Any,
) -> list[Literal["full", "left", "right", "bottom", "top", "none"]]: ...
Expand All @@ -152,3 +152,6 @@ def validate_hist_bins(
) -> Literal["auto", "sturges", "fd", "doane", "scott", "rice", "sqrt"] | int | list[
float
]: ...

# At runtime is added in __init__.py
defaultParams: dict[str, Any]
20 changes: 9 additions & 11 deletions lib/matplotlib/transforms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,17 @@ class LockableBbox(BboxBase):
def locked_y1(self, y1: float | None) -> None: ...

class Transform(TransformNode):
input_dims: int | None
output_dims: int | None
is_separable: bool
# Implemented as a standard attr in base class, but functionally readonly and some subclasses implement as such

# Implemented as a standard attrs in base class, but functionally readonly and some subclasses implement as such
@property
def input_dims(self) -> int | None: ...
@property
def output_dims(self) -> int | None: ...
@property
def is_separable(self) -> bool: ...
@property
def has_inverse(self) -> bool: ...

def __add__(self, other: Transform) -> Transform: ...
@property
def depth(self) -> int: ...
Expand Down Expand Up @@ -225,8 +230,6 @@ class Affine2DBase(AffineBase):
input_dims: Literal[2]
output_dims: Literal[2]
def frozen(self) -> Affine2D: ...
@property
def is_separable(self): ...
def to_values(self) -> tuple[float, float, float, float, float, float]: ...

class Affine2D(Affine2DBase):
Expand Down Expand Up @@ -255,7 +258,6 @@ class _BlendedMixin:
class BlendedGenericTransform(_BlendedMixin, Transform):
input_dims: Literal[2]
output_dims: Literal[2]
is_separable: bool
pass_through: bool
def __init__(
self, x_transform: Transform, y_transform: Transform, **kwargs
Expand All @@ -265,8 +267,6 @@ class BlendedGenericTransform(_BlendedMixin, Transform):
def contains_branch(self, other: Transform) -> Literal[False]: ...
@property
def is_affine(self) -> bool: ...
@property
def has_inverse(self) -> bool: ...

class BlendedAffine2D(_BlendedMixin, Affine2DBase):
def __init__(
Expand All @@ -279,8 +279,6 @@ def blended_transform_factory(

class CompositeGenericTransform(Transform):
pass_through: bool
input_dims: int | None
output_dims: int | None
def __init__(self, a: Transform, b: Transform, **kwargs) -> None: ...

class CompositeAffine2D(Affine2DBase):
Expand Down