Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ jobs:
- name: Run Ruff Linter
uses: astral-sh/ruff-action@v3
with:
version: "0.9.*"
version: "0.11.*"
- run: ruff format --check
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ select = [
"FA", # flake8-future-annotations
"I", # isort
"PYI", # flake8-pyi
"UP", # pyupgrade
]
ignore = [
###
# Rules we don't want or don't agree with
###

# Typeshed doesn't want complex or non-literal defaults, or long strings, for maintenance and testing reasons.
# This doesn't affect us, let's have more complete stubs.
"PYI011",
Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
from typing import Generator, Literal
from collections.abc import Generator
from typing import Literal

import numpy as np
from packaging.version import parse as parse_version
Expand Down
5 changes: 3 additions & 2 deletions stubs/matplotlib/_api/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import functools
from typing import Any, Callable, Generator, Iterable, Type
from collections.abc import Generator, Iterable
from typing import Callable

from .deprecation import MatplotlibDeprecationWarning

Expand All @@ -19,5 +20,5 @@ def select_matching_signature(funcs: list[Callable], *args, **kwargs): ...
def recursive_subclasses(cls) -> Generator: ...
def warn_external(
message: MatplotlibDeprecationWarning | PendingDeprecationWarning | str,
category: None | Type[MatplotlibDeprecationWarning] = ...,
category: None | type[MatplotlibDeprecationWarning] = ...,
) -> None: ...
3 changes: 2 additions & 1 deletion stubs/matplotlib/_api/deprecation.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import contextlib
from collections.abc import Iterator
from functools import partial
from typing import Callable, Iterator
from typing import Callable

class MatplotlibDeprecationWarning(DeprecationWarning): ...

Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/_mathtext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DejaVuSansFonts(DejaVuFonts): ...

class StixFonts(UnicodeFonts):
def __init__(self, *args, **kwargs) -> None: ...
@functools.lru_cache()
@functools.lru_cache
def get_sized_alternatives_for_symbol(self, fontname, sym) -> list[tuple]: ...

class StixSansFonts(StixFonts): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/_pylab_helpers.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, OrderedDict
from collections import OrderedDict

from .backend_bases import FigureManagerBase
from .figure import Figure
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/_text_helpers.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generator
from collections.abc import Generator

LayoutItem = ...

Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/_tight_layout.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Sequence
from collections.abc import Sequence

from .axes import Axes, SubplotBase
from .backend_bases import RendererBase
Expand Down
26 changes: 13 additions & 13 deletions stubs/matplotlib/afm.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# COMPLETE

from typing import BinaryIO, List, Literal, NamedTuple, Optional, Tuple, Union, overload
from typing import BinaryIO, Literal, NamedTuple, overload

class CharMetrics(NamedTuple):
width: float
name: str
bbox: List[int]
bbox: list[int]

class CompositePart(NamedTuple):
name: str
Expand All @@ -20,11 +20,11 @@ class AFM:
def family_name(self) -> str: ...
def get_angle(self) -> float: ...
@overload
def get_bbox_char(self, c: str, isord: Literal[False] = ...) -> List[int]: ...
def get_bbox_char(self, c: str, isord: Literal[False] = ...) -> list[int]: ...
@overload
def get_bbox_char(self, c: int, isord: Literal[True] = ...) -> List[int]: ...
def get_bbox_char(self, c: int, isord: Literal[True] = ...) -> list[int]: ...
@overload
def get_bbox_char(self, c: Union[str, int], isord: bool = ...) -> List[int]: ...
def get_bbox_char(self, c: str | int, isord: bool = ...) -> list[int]: ...
def get_capheight(self) -> float: ...
def get_familyname(self) -> str: ...
def get_fontname(self) -> str: ...
Expand All @@ -34,27 +34,27 @@ class AFM:
@overload
def get_height_char(self, c: int, isord: Literal[True] = ...) -> int: ...
@overload
def get_height_char(self, c: Union[str, int], isord: bool = ...) -> int: ...
def get_height_char(self, c: str | int, isord: bool = ...) -> int: ...
def get_horizontal_stem_width(self) -> float: ...
def get_kern_dist(self, c1: Union[str, int], c2: Union[str, int]) -> float: ...
def get_kern_dist(self, c1: str | int, c2: str | int) -> float: ...
def get_kern_dist_from_name(self, name1: str, name2: str) -> float: ...
@overload
def get_name_char(self, c: str, isord: Literal[False] = ...) -> str: ...
@overload
def get_name_char(self, c: int, isord: Literal[True] = ...) -> str: ...
@overload
def get_name_char(self, c: Union[str, int], isord: bool = ...) -> str: ...
def get_str_bbox(self, s: Union[str, bytes]) -> Tuple[float, float, float, float, float]: ...
def get_str_bbox_and_descent(self, s: Union[str, bytes]) -> Tuple[float, float, float, float, float]: ...
def get_name_char(self, c: str | int, isord: bool = ...) -> str: ...
def get_str_bbox(self, s: str | bytes) -> tuple[float, float, float, float, float]: ...
def get_str_bbox_and_descent(self, s: str | bytes) -> tuple[float, float, float, float, float]: ...
def get_underline_thickness(self) -> float: ...
def get_vertical_stem_width(self) -> Optional[float]: ...
def get_vertical_stem_width(self) -> float | None: ...
def get_weight(self) -> str: ...
@overload
def get_width_char(self, c: str, isord: Literal[False] = ...) -> float: ...
@overload
def get_width_char(self, c: int, isord: Literal[True] = ...) -> float: ...
@overload
def get_width_char(self, c: Union[str, int], isord: bool = ...) -> float: ...
def get_width_char(self, c: str | int, isord: bool = ...) -> float: ...
def get_width_from_char_name(self, name: str) -> float: ...
def get_xheight(self) -> float: ...
def string_width_height(self, s: str) -> Tuple[float, float]: ...
def string_width_height(self, s: str) -> tuple[float, float]: ...
3 changes: 2 additions & 1 deletion stubs/matplotlib/animation.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import abc
import contextlib
from collections.abc import Generator, Iterable, Iterator
from itertools import count
from typing import Callable, Generator, Iterable, Iterator, List
from typing import Callable

from matplotlib.backend_bases import NonGuiException

Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
from collections.abc import Sequence
from re import L
from typing import Callable, Literal, Sequence, overload
from typing import Callable, Literal, overload

import matplotlib.tri as mtri
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/axes/_base.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable, Collection, Literal, MutableSequence, Sequence, overload
from collections.abc import Collection, MutableSequence, Sequence
from typing import Any, Callable, Literal, overload

import numpy as np
from matplotlib._typing import *
Expand Down
4 changes: 2 additions & 2 deletions stubs/matplotlib/axis.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime
from datetime import timezone
from typing import Any, Callable, Literal, Type
from typing import Any, Callable, Literal

import numpy as np

Expand Down Expand Up @@ -94,7 +94,7 @@ class Ticker:

class _LazyTickList:
def __init__(self, major: bool) -> None: ...
def __get__(self, instance: XAxis | YAxis, cls: Type[XAxis] | Type[YAxis]) -> list[XTick | YTick]: ...
def __get__(self, instance: XAxis | YAxis, cls: type[XAxis | YAxis]) -> list[XTick | YTick]: ...

class Axis(Artist):
isDefault_label: bool
Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/backends/_backend_tk.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tkinter as tk
from typing import Literal, Sequence
from collections.abc import Sequence
from typing import Literal

from matplotlib._api import classproperty
from matplotlib._typing import *
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/backends/backend_agg.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import threading
from io import BufferedWriter, BytesIO
from typing import Any, Tuple
from typing import Any

import numpy as np
from matplotlib._typing import *
Expand Down
10 changes: 5 additions & 5 deletions stubs/matplotlib/backends/backend_gtk3.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable, Type
from typing import Callable

# PyGObject is not easily installable on Windows, let tests pass as-is
from gi.repository import Gtk # pyright: ignore[reportMissingImports]
Expand All @@ -17,7 +17,7 @@ class __getattr__:

class FigureCanvasGTK3(Gtk.DrawingArea, FigureCanvasBase):
required_interactive_framework: str = ...
_timer_cls: Type[TimerGTK3] = ...
_timer_cls: type[TimerGTK3] = ...
manager_class: classproperty = ...
event_mask: int = ...

Expand Down Expand Up @@ -66,10 +66,10 @@ class ToolCopyToClipboardGTK3(backend_tools.ToolCopyToClipboardBase):

def error_msg_gtk(msg, parent=...) -> None: ...

Toolbar: Type[ToolbarGTK3] = ...
Toolbar: type[ToolbarGTK3] = ...

class FigureManagerGTK3(_FigureManagerGTK): ...

class _BackendGTK3(_BackendGTK):
FigureCanvas: Type[FigureCanvasGTK3] = ...
FigureManager: Type[FigureManagerGTK3] = ...
FigureCanvas: type[FigureCanvasGTK3] = ...
FigureManager: type[FigureManagerGTK3] = ...
6 changes: 3 additions & 3 deletions stubs/matplotlib/backends/backend_pdf.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum
from functools import total_ordering
from io import BytesIO
from typing import Any, Callable, Optional, Set
from typing import Any
from typing_extensions import Self

import numpy as np
Expand Down Expand Up @@ -115,15 +115,15 @@ class PdfFile:
| dict[str, Name | int | Verbatim]
| dict[str, Name | int | Verbatim | Reference]
) = ...,
png: Optional[dict[str, int]] = ...,
png: dict[str, int] | None = ...,
) -> None: ...
def endStream(self) -> None: ...
def outputStream(self, ref: Reference, data: bytes, *, extra=...) -> None: ...
def fontName(self, fontprop: FontProperties | str) -> Name: ...
def dviFontName(self, dvifont) -> Name: ...
def writeFonts(self) -> None: ...
def createType1Descriptor(self, t1font, fontfile) -> Reference: ...
def embedTTF(self, filename: str, characters: Set[int]) -> Reference: ...
def embedTTF(self, filename: str, characters: set[int]) -> Reference: ...
def alphaState(self, alpha: tuple[float, float]) -> Name: ...
def writeExtGSTates(self) -> None: ...
def hatchPattern(self, hatch_style) -> Name: ...
Expand Down
3 changes: 1 addition & 2 deletions stubs/matplotlib/backends/backend_ps.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from enum import Enum
from typing import Type

from matplotlib._typing import *
from matplotlib.backend_bases import FigureCanvasBase, FigureManagerBase, GraphicsContextBase, _Backend
Expand Down Expand Up @@ -106,7 +105,7 @@ def xpdf_distill(tmpfile, eps=..., ptype=..., bbox=..., rotated=...) -> None: ..
def get_bbox_header(lbrt, rotated=...) -> tuple[str, str]: ...
def pstoeps(tmpfile, bbox=..., rotated=...) -> None: ...

FigureManagerPS: Type[FigureManagerBase] = ...
FigureManagerPS: type[FigureManagerBase] = ...
psDefs: list[str] = ...

class _BackendPS(_Backend):
Expand Down
4 changes: 2 additions & 2 deletions stubs/matplotlib/backends/backend_qt.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Type
from typing import Any

from matplotlib._api import classproperty
from matplotlib.backend_bases import (
Expand Down Expand Up @@ -29,7 +29,7 @@ class TimerQT(TimerBase):

class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase):
required_interactive_framework: str = ...
_timer_cls: Type[TimerQT] = ...
_timer_cls: type[TimerQT] = ...
manager_class: classproperty = ...
buttond: dict[str, MouseButton] = ...

Expand Down
4 changes: 2 additions & 2 deletions stubs/matplotlib/backends/backend_svg.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from encodings.utf_8 import StreamWriter
from io import BytesIO, TextIOWrapper
from typing import Any, Type
from typing import Any

from matplotlib._typing import *
from matplotlib.backend_bases import FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase, _Backend
Expand Down Expand Up @@ -97,7 +97,7 @@ class FigureCanvasSVG(FigureCanvasBase):
def get_default_filetype(self) -> str: ...
def draw(self) -> None: ...

FigureManagerSVG: Type[FigureManagerBase] = ...
FigureManagerSVG: type[FigureManagerBase] = ...
svgProlog: str = ...

class _BackendSVG(_Backend):
Expand Down
4 changes: 1 addition & 3 deletions stubs/matplotlib/backends/backend_tkagg.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Type

from matplotlib.transforms import Bbox

from ._backend_tk import FigureCanvasTk, _BackendTk
Expand All @@ -10,4 +8,4 @@ class FigureCanvasTkAgg(FigureCanvasAgg, FigureCanvasTk):
def blit(self, bbox: Bbox = ...) -> None: ...

class _BackendTkAgg(_BackendTk):
FigureCanvas: Type[FigureCanvasAgg] = ...
FigureCanvas: type[FigureCanvasAgg] = ...
3 changes: 2 additions & 1 deletion stubs/matplotlib/category.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable
from collections.abc import Iterable
from typing import Any

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/cbook/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import collections
import collections.abc
import contextlib
from typing import Any, Callable, Generator, Iterator, overload
from collections.abc import Generator, Iterator
from typing import Any, Callable, overload

import numpy as np
from matplotlib._typing import *
Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/collections.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Sequence
from tkinter.messagebox import NO
from typing import Callable, Literal, Sequence
from typing import Callable, Literal

import numpy as np
from matplotlib._enums import CapStyle, JoinStyle
Expand Down
5 changes: 3 additions & 2 deletions stubs/matplotlib/colorbar.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Literal, Sequence, Type
from collections.abc import Sequence
from typing import Literal

from .axes import Axes
from .axis import Tick
Expand Down Expand Up @@ -82,7 +83,7 @@ class Colorbar:
def remove(self) -> None: ...
def drag_pan(self, button, key, x, y) -> None: ...

ColorbarBase: Type[Colorbar] = ...
ColorbarBase: type[Colorbar] = ...

def make_axes(
parents: Axes | list[Axes],
Expand Down
4 changes: 2 additions & 2 deletions stubs/matplotlib/colors.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import functools
from collections.abc import Mapping
from collections.abc import Iterator, Mapping
from email.errors import NonPrintableDefect
from re import Pattern
from typing import Callable, Iterator, Literal
from typing import Callable, Literal

import numpy as np
from matplotlib._typing import *
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/container.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Literal, Type
from typing import Literal
from typing_extensions import Self

from matplotlib.artist import Artist
Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/contour.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Iterable, Sequence
from tkinter import Label
from typing import Callable, Iterable, Literal, Sequence
from typing import Callable, Literal

from matplotlib.collections import Collection

Expand Down
4 changes: 2 additions & 2 deletions stubs/matplotlib/dviread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class Tfm:
PsFont = ...

class PsfontsMap:
@lru_cache()
@lru_cache
def __new__(cls, filename): ...
def __getitem__(self, texname): ...

class _LuatexKpsewhich:
@lru_cache()
@lru_cache
def __new__(cls): ...
def search(self, filename): ...

Expand Down
Loading