diff options
author | shadchin <shadchin@yandex-team.com> | 2024-03-04 21:16:16 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.com> | 2024-03-04 21:43:39 +0300 |
commit | 74819c4157bd388a7d429c870ea4b343a282dafa (patch) | |
tree | 4bff355b03dfb24b14d33581357cc8e624d170fd /contrib/python/matplotlib/py3 | |
parent | f64c28a5443395e3a8f27e6f1b15a3507812d2de (diff) | |
download | ydb-74819c4157bd388a7d429c870ea4b343a282dafa.tar.gz |
Extend support pyi files
Сейчас pyi файлы в макросе PY_SRCS используются исключительно в Arcadia плагине для продуктов JB, при сборке эти файлы просто игнорируются.
В этом PR добавил шаг, который будет содержимое этих файлов складывать в ресурсы, секция PY_SRCS удобна тем, что позволяет раскладывать pyi файлы с учетом TOP_LEVEL/NAMESPACE, а это необходимо для правильной работы mypy.
3924b0556bc99947e6893cd79e5ce62ec72a18a9
Diffstat (limited to 'contrib/python/matplotlib/py3')
83 files changed, 10769 insertions, 0 deletions
diff --git a/contrib/python/matplotlib/py3/matplotlib/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/__init__.pyi new file mode 100644 index 0000000000..8ef23a3dc4 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/__init__.pyi @@ -0,0 +1,113 @@ +__all__ = [ + "__bibtex__", + "__version__", + "__version_info__", + "set_loglevel", + "ExecutableNotFoundError", + "get_configdir", + "get_cachedir", + "get_data_path", + "matplotlib_fname", + "MatplotlibDeprecationWarning", + "RcParams", + "rc_params", + "rc_params_from_file", + "rcParamsDefault", + "rcParams", + "rcParamsOrig", + "defaultParams", + "rc", + "rcdefaults", + "rc_file_defaults", + "rc_file", + "rc_context", + "use", + "get_backend", + "interactive", + "is_interactive", + "colormaps", + "color_sequences", +] + +import os +from pathlib import Path + +from collections.abc import Callable, Generator +import contextlib +from packaging.version import Version + +from matplotlib._api import MatplotlibDeprecationWarning +from typing import Any, NamedTuple + +class _VersionInfo(NamedTuple): + major: int + minor: int + micro: int + releaselevel: str + serial: int + +__bibtex__: str +__version__: str +__version_info__: _VersionInfo + +def set_loglevel(level: str) -> None: ... + +class _ExecInfo(NamedTuple): + executable: str + raw_version: str + version: Version + +class ExecutableNotFoundError(FileNotFoundError): ... + +def _get_executable_info(name: str) -> _ExecInfo: ... +def get_configdir() -> str: ... +def get_cachedir() -> str: ... +def get_data_path() -> str: ... +def matplotlib_fname() -> str: ... + +class RcParams(dict[str, Any]): + validate: dict[str, Callable] + def __init__(self, *args, **kwargs) -> None: ... + def __setitem__(self, key: str, val: Any) -> None: ... + def __getitem__(self, key: str) -> Any: ... + def __iter__(self) -> Generator[str, None, None]: ... + def __len__(self) -> int: ... + def find_all(self, pattern: str) -> RcParams: ... + def copy(self) -> RcParams: ... + +def rc_params(fail_on_error: bool = ...) -> RcParams: ... +def rc_params_from_file( + fname: str | Path | os.PathLike, + fail_on_error: bool = ..., + use_default_template: bool = ..., +) -> RcParams: ... + +rcParamsDefault: RcParams +rcParams: RcParams +rcParamsOrig: RcParams +defaultParams: dict[str, Any] + +def rc(group: str, **kwargs) -> None: ... +def rcdefaults() -> None: ... +def rc_file_defaults() -> None: ... +def rc_file( + fname: str | Path | os.PathLike, *, use_default_template: bool = ... +) -> None: ... +@contextlib.contextmanager +def rc_context( + rc: dict[str, Any] | None = ..., fname: str | Path | os.PathLike | None = ... +) -> Generator[None, None, None]: ... +def use(backend: str, *, force: bool = ...) -> None: ... +def get_backend() -> str: ... +def interactive(b: bool) -> None: ... +def is_interactive() -> bool: ... + +def _preprocess_data( + func: Callable | None = ..., + *, + replace_names: list[str] | None = ..., + label_namer: str | None = ... +) -> Callable: ... + +from matplotlib.cm import _colormaps as colormaps +from matplotlib.colors import _color_sequences as color_sequences diff --git a/contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi new file mode 100644 index 0000000000..4baff7cd80 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_api/__init__.pyi @@ -0,0 +1,59 @@ +from collections.abc import Callable, Generator, Mapping, Sequence +from typing import Any, Iterable, TypeVar, overload + +from numpy.typing import NDArray + +from .deprecation import ( # noqa: re-exported API + deprecated as deprecated, + warn_deprecated as warn_deprecated, + rename_parameter as rename_parameter, + delete_parameter as delete_parameter, + make_keyword_only as make_keyword_only, + deprecate_method_override as deprecate_method_override, + deprecate_privatize_attribute as deprecate_privatize_attribute, + suppress_matplotlib_deprecation_warning as suppress_matplotlib_deprecation_warning, + MatplotlibDeprecationWarning as MatplotlibDeprecationWarning, +) + +_T = TypeVar("_T") + +class classproperty(Any): + def __init__( + self, + fget: Callable[[_T], Any], + fset: None = ..., + fdel: None = ..., + doc: str | None = None, + ): ... + # Replace return with Self when py3.9 is dropped + @overload + def __get__(self, instance: None, owner: None) -> classproperty: ... + @overload + def __get__(self, instance: object, owner: type[object]) -> Any: ... + @property + def fget(self) -> Callable[[_T], Any]: ... + +def check_isinstance( + types: type | tuple[type | None, ...], /, **kwargs: Any +) -> None: ... +def check_in_list( + values: Sequence[Any], /, *, _print_supported_values: bool = ..., **kwargs: Any +) -> None: ... +def check_shape(shape: tuple[int | None, ...], /, **kwargs: NDArray) -> None: ... +def check_getitem(mapping: Mapping[Any, Any], /, **kwargs: Any) -> Any: ... +def caching_module_getattr(cls: type) -> Callable[[str], Any]: ... +@overload +def define_aliases( + alias_d: dict[str, list[str]], cls: None = ... +) -> Callable[[type[_T]], type[_T]]: ... +@overload +def define_aliases(alias_d: dict[str, list[str]], cls: type[_T]) -> type[_T]: ... +def select_matching_signature( + funcs: list[Callable], *args: Any, **kwargs: Any +) -> Any: ... +def nargs_error(name: str, takes: int | str, given: int) -> TypeError: ... +def kwarg_error(name: str, kw: str | Iterable[str]) -> TypeError: ... +def recursive_subclasses(cls: type) -> Generator[type, None, None]: ... +def warn_external( + message: str | Warning, category: type[Warning] | None = ... +) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi b/contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi new file mode 100644 index 0000000000..9619d1b484 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_api/deprecation.pyi @@ -0,0 +1,76 @@ +from collections.abc import Callable +import contextlib +from typing import Any, TypedDict, TypeVar, overload +from typing_extensions import ( + ParamSpec, # < Py 3.10 + Unpack, # < Py 3.11 +) + +_P = ParamSpec("_P") +_R = TypeVar("_R") +_T = TypeVar("_T") + +class MatplotlibDeprecationWarning(DeprecationWarning): ... + +class DeprecationKwargs(TypedDict, total=False): + message: str + alternative: str + pending: bool + obj_type: str + addendum: str + removal: str + +class NamedDeprecationKwargs(DeprecationKwargs, total=False): + name: str + +def warn_deprecated(since: str, **kwargs: Unpack[NamedDeprecationKwargs]) -> None: ... +def deprecated( + since: str, **kwargs: Unpack[NamedDeprecationKwargs] +) -> Callable[[_T], _T]: ... + +class deprecate_privatize_attribute(Any): + def __init__(self, since: str, **kwargs: Unpack[NamedDeprecationKwargs]): ... + def __set_name__(self, owner: type[object], name: str) -> None: ... + +DECORATORS: dict[Callable, Callable] = ... + +@overload +def rename_parameter( + since: str, old: str, new: str, func: None = ... +) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... +@overload +def rename_parameter( + since: str, old: str, new: str, func: Callable[_P, _R] +) -> Callable[_P, _R]: ... + +class _deprecated_parameter_class: ... + +_deprecated_parameter: _deprecated_parameter_class + +@overload +def delete_parameter( + since: str, name: str, func: None = ..., **kwargs: Unpack[DeprecationKwargs] +) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... +@overload +def delete_parameter( + since: str, name: str, func: Callable[_P, _R], **kwargs: Unpack[DeprecationKwargs] +) -> Callable[_P, _R]: ... +@overload +def make_keyword_only( + since: str, name: str, func: None = ... +) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... +@overload +def make_keyword_only( + since: str, name: str, func: Callable[_P, _R] +) -> Callable[_P, _R]: ... +def deprecate_method_override( + method: Callable[_P, _R], + obj: object | type, + *, + allow_empty: bool = ..., + since: str, + **kwargs: Unpack[NamedDeprecationKwargs] +) -> Callable[_P, _R]: ... +def suppress_matplotlib_deprecation_warning() -> ( + contextlib.AbstractContextManager[None] +): ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi b/contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi new file mode 100644 index 0000000000..3a211223be --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_c_internal_utils.pyi @@ -0,0 +1 @@ +def display_is_valid() -> bool: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_color_data.pyi b/contrib/python/matplotlib/py3/matplotlib/_color_data.pyi new file mode 100644 index 0000000000..feb3de9c30 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_color_data.pyi @@ -0,0 +1,6 @@ +from .typing import ColorType + +BASE_COLORS: dict[str, ColorType] +TABLEAU_COLORS: dict[str, ColorType] +XKCD_COLORS: dict[str, ColorType] +CSS4_COLORS: dict[str, ColorType] diff --git a/contrib/python/matplotlib/py3/matplotlib/_docstring.pyi b/contrib/python/matplotlib/py3/matplotlib/_docstring.pyi new file mode 100644 index 0000000000..0377dc5fe9 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_docstring.pyi @@ -0,0 +1,29 @@ +from typing import Any, Callable, TypeVar, overload + + +_T = TypeVar('_T') + + +class Substitution: + @overload + def __init__(self, *args: str): ... + @overload + def __init__(self, **kwargs: str): ... + def __call__(self, func: _T) -> _T: ... + def update(self, *args, **kwargs): ... # type: ignore[no-untyped-def] + + +class _ArtistKwdocLoader(dict[str, str]): + def __missing__(self, key: str) -> str: ... + + +class _ArtistPropertiesSubstitution(Substitution): + def __init__(self) -> None: ... + def __call__(self, obj: _T) -> _T: ... + + +def copy(source: Any) -> Callable[[_T], _T]: ... + + +dedent_interpd: _ArtistPropertiesSubstitution +interpd: _ArtistPropertiesSubstitution diff --git a/contrib/python/matplotlib/py3/matplotlib/_enums.pyi b/contrib/python/matplotlib/py3/matplotlib/_enums.pyi new file mode 100644 index 0000000000..351088b364 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_enums.pyi @@ -0,0 +1,18 @@ +from enum import Enum + +class _AutoStringNameEnum(Enum): + def __hash__(self) -> int: ... + +class JoinStyle(str, _AutoStringNameEnum): + miter: str + round: str + bevel: str + @staticmethod + def demo() -> None: ... + +class CapStyle(str, _AutoStringNameEnum): + butt: str + projecting: str + round: str + @staticmethod + def demo() -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_image.pyi b/contrib/python/matplotlib/py3/matplotlib/_image.pyi new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_image.pyi diff --git a/contrib/python/matplotlib/py3/matplotlib/_path.pyi b/contrib/python/matplotlib/py3/matplotlib/_path.pyi new file mode 100644 index 0000000000..456905528b --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_path.pyi @@ -0,0 +1,9 @@ +from collections.abc import Sequence + +import numpy as np + +from .transforms import BboxBase + +def affine_transform(points: np.ndarray, trans: np.ndarray) -> np.ndarray: ... +def count_bboxes_overlapping_bbox(bbox: BboxBase, bboxes: Sequence[BboxBase]) -> int: ... +def update_path_extents(path, trans, rect, minpos, ignore): ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi b/contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi new file mode 100644 index 0000000000..bdd8cfba31 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_pylab_helpers.pyi @@ -0,0 +1,29 @@ +from collections import OrderedDict + +from matplotlib.backend_bases import FigureManagerBase +from matplotlib.figure import Figure + +class Gcf: + figs: OrderedDict[int, FigureManagerBase] + @classmethod + def get_fig_manager(cls, num: int) -> FigureManagerBase | None: ... + @classmethod + def destroy(cls, num: int | FigureManagerBase) -> None: ... + @classmethod + def destroy_fig(cls, fig: Figure) -> None: ... + @classmethod + def destroy_all(cls) -> None: ... + @classmethod + def has_fignum(cls, num: int) -> bool: ... + @classmethod + def get_all_fig_managers(cls) -> list[FigureManagerBase]: ... + @classmethod + def get_num_fig_managers(cls) -> int: ... + @classmethod + def get_active(cls) -> FigureManagerBase | None: ... + @classmethod + def _set_new_active_manager(cls, manager: FigureManagerBase) -> None: ... + @classmethod + def set_active(cls, manager: FigureManagerBase) -> None: ... + @classmethod + def draw_all(cls, force: bool = ...) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_qhull.pyi b/contrib/python/matplotlib/py3/matplotlib/_qhull.pyi new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_qhull.pyi diff --git a/contrib/python/matplotlib/py3/matplotlib/_tri.pyi b/contrib/python/matplotlib/py3/matplotlib/_tri.pyi new file mode 100644 index 0000000000..cab7fcf2bc --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_tri.pyi @@ -0,0 +1,23 @@ +# This is a private module implemented in C++ +# As such these type stubs are overly generic, but here to allow these types +# as return types for public methods +from typing import Any + +class TrapezoidMapTriFinder: + def __init__(self, *args, **kwargs) -> None: ... + def find_many(self, *args, **kwargs) -> Any: ... + def get_tree_stats(self, *args, **kwargs) -> Any: ... + def initialize(self, *args, **kwargs) -> Any: ... + def print_tree(self, *args, **kwargs) -> Any: ... + +class TriContourGenerator: + def __init__(self, *args, **kwargs) -> None: ... + def create_contour(self, *args, **kwargs) -> Any: ... + def create_filled_contour(self, *args, **kwargs) -> Any: ... + +class Triangulation: + def __init__(self, *args, **kwargs) -> None: ... + def calculate_plane_coefficients(self, *args, **kwargs) -> Any: ... + def get_edges(self, *args, **kwargs) -> Any: ... + def get_neighbors(self, *args, **kwargs) -> Any: ... + def set_mask(self, *args, **kwargs) -> Any: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi b/contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/_ttconv.pyi diff --git a/contrib/python/matplotlib/py3/matplotlib/animation.pyi b/contrib/python/matplotlib/py3/matplotlib/animation.pyi new file mode 100644 index 0000000000..de1b9926af --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/animation.pyi @@ -0,0 +1,219 @@ +import abc +from collections.abc import Callable, Collection, Iterable, Sequence, Generator +import contextlib +from pathlib import Path +from matplotlib.artist import Artist +from matplotlib.backend_bases import TimerBase +from matplotlib.figure import Figure + +from typing import Any + +subprocess_creation_flags: int + +def adjusted_figsize(w: float, h: float, dpi: float, n: int) -> tuple[float, float]: ... + +class MovieWriterRegistry: + def __init__(self) -> None: ... + def register( + self, name: str + ) -> Callable[[type[AbstractMovieWriter]], type[AbstractMovieWriter]]: ... + def is_available(self, name: str) -> bool: ... + def __iter__(self) -> Generator[str, None, None]: ... + def list(self) -> list[str]: ... + def __getitem__(self, name: str) -> type[AbstractMovieWriter]: ... + +writers: MovieWriterRegistry + +class AbstractMovieWriter(abc.ABC, metaclass=abc.ABCMeta): + fps: int + metadata: dict[str, str] + codec: str + bitrate: int + def __init__( + self, + fps: int = ..., + metadata: dict[str, str] | None = ..., + codec: str | None = ..., + bitrate: int | None = ..., + ) -> None: ... + outfile: str | Path + fig: Figure + dpi: float + + @abc.abstractmethod + def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ... + @property + def frame_size(self) -> tuple[int, int]: ... + @abc.abstractmethod + def grab_frame(self, **savefig_kwargs) -> None: ... + @abc.abstractmethod + def finish(self) -> None: ... + @contextlib.contextmanager + def saving( + self, fig: Figure, outfile: str | Path, dpi: float | None, *args, **kwargs + ) -> Generator[AbstractMovieWriter, None, None]: ... + +class MovieWriter(AbstractMovieWriter): + supported_formats: list[str] + frame_format: str + extra_args: list[str] | None + def __init__( + self, + fps: int = ..., + codec: str | None = ..., + bitrate: int | None = ..., + extra_args: list[str] | None = ..., + metadata: dict[str, str] | None = ..., + ) -> None: ... + def setup(self, fig: Figure, outfile: str | Path, dpi: float | None = ...) -> None: ... + def grab_frame(self, **savefig_kwargs) -> None: ... + def finish(self) -> None: ... + @classmethod + def bin_path(cls) -> str: ... + @classmethod + def isAvailable(cls) -> bool: ... + +class FileMovieWriter(MovieWriter): + fig: Figure + outfile: str | Path + dpi: float + temp_prefix: str + fname_format_str: str + def setup( + self, + fig: Figure, + outfile: str | Path, + dpi: float | None = ..., + frame_prefix: str | Path | None = ..., + ) -> None: ... + def __del__(self) -> None: ... + @property + def frame_format(self) -> str: ... + @frame_format.setter + def frame_format(self, frame_format: str) -> None: ... + +class PillowWriter(AbstractMovieWriter): + @classmethod + def isAvailable(cls) -> bool: ... + def setup( + self, fig: Figure, outfile: str | Path, dpi: float | None = ... + ) -> None: ... + def grab_frame(self, **savefig_kwargs) -> None: ... + def finish(self) -> None: ... + +class FFMpegBase: + codec: str + @property + def output_args(self) -> list[str]: ... + +class FFMpegWriter(FFMpegBase, MovieWriter): ... + +class FFMpegFileWriter(FFMpegBase, FileMovieWriter): + supported_formats: list[str] + +class ImageMagickBase: + @classmethod + def bin_path(cls) -> str: ... + @classmethod + def isAvailable(cls) -> bool: ... + +class ImageMagickWriter(ImageMagickBase, MovieWriter): + input_names: str + +class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter): + supported_formats: list[str] + @property + def input_names(self) -> str: ... + +class HTMLWriter(FileMovieWriter): + supported_formats: list[str] + @classmethod + def isAvailable(cls) -> bool: ... + embed_frames: bool + default_mode: str + def __init__( + self, + fps: int = ..., + codec: str | None = ..., + bitrate: int | None = ..., + extra_args: list[str] | None = ..., + metadata: dict[str, str] | None = ..., + embed_frames: bool = ..., + default_mode: str = ..., + embed_limit: float | None = ..., + ) -> None: ... + def setup( + self, + fig: Figure, + outfile: str | Path, + dpi: float | None = ..., + frame_dir: str | Path | None = ..., + ) -> None: ... + def grab_frame(self, **savefig_kwargs): ... + def finish(self) -> None: ... + +class Animation: + frame_seq: Iterable[Artist] + event_source: Any + def __init__( + self, fig: Figure, event_source: Any | None = ..., blit: bool = ... + ) -> None: ... + def __del__(self) -> None: ... + def save( + self, + filename: str | Path, + writer: AbstractMovieWriter | str | None = ..., + fps: int | None = ..., + dpi: float | None = ..., + codec: str | None = ..., + bitrate: int | None = ..., + extra_args: list[str] | None = ..., + metadata: dict[str, str] | None = ..., + extra_anim: list[Animation] | None = ..., + savefig_kwargs: dict[str, Any] | None = ..., + *, + progress_callback: Callable[[int, int], Any] | None = ... + ) -> None: ... + def new_frame_seq(self) -> Iterable[Artist]: ... + def new_saved_frame_seq(self) -> Iterable[Artist]: ... + def to_html5_video(self, embed_limit: float | None = ...) -> str: ... + def to_jshtml( + self, + fps: int | None = ..., + embed_frames: bool = ..., + default_mode: str | None = ..., + ) -> str: ... + def _repr_html_(self) -> str: ... + def pause(self) -> None: ... + def resume(self) -> None: ... + +class TimedAnimation(Animation): + repeat: bool + def __init__( + self, + fig: Figure, + interval: int = ..., + repeat_delay: int = ..., + repeat: bool = ..., + event_source: TimerBase | None = ..., + *args, + **kwargs + ) -> None: ... + +class ArtistAnimation(TimedAnimation): + def __init__(self, fig: Figure, artists: Sequence[Collection[Artist]], *args, **kwargs) -> None: ... + +class FuncAnimation(TimedAnimation): + save_count: int + def __init__( + self, + fig: Figure, + func: Callable[..., Iterable[Artist]], + frames: Iterable[Artist] | int | Callable[[], Generator] | None = ..., + init_func: Callable[[], Iterable[Artist]] | None = ..., + fargs: tuple[Any, ...] | None = ..., + save_count: int | None = ..., + *, + cache_frame_data: bool = ..., + **kwargs + ) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/artist.pyi b/contrib/python/matplotlib/py3/matplotlib/artist.pyi new file mode 100644 index 0000000000..101e97a9a0 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/artist.pyi @@ -0,0 +1,181 @@ +from .axes._base import _AxesBase +from .backend_bases import RendererBase, MouseEvent +from .figure import Figure, SubFigure +from .path import Path +from .patches import Patch +from .patheffects import AbstractPathEffect +from .transforms import ( + BboxBase, + Bbox, + Transform, + TransformedPatchPath, + TransformedPath, +) + +import numpy as np + +from collections.abc import Callable, Iterable +from typing import Any, NamedTuple, TextIO, overload +from numpy.typing import ArrayLike + +def allow_rasterization(draw): ... + +class _XYPair(NamedTuple): + x: ArrayLike + y: ArrayLike + +class _Unset: ... + +class Artist: + zorder: float + stale_callback: Callable[[Artist, bool], None] | None + figure: Figure | SubFigure | None + clipbox: BboxBase | None + def __init__(self) -> None: ... + def remove(self) -> None: ... + def have_units(self) -> bool: ... + # TODO units + def convert_xunits(self, x): ... + def convert_yunits(self, y): ... + @property + def axes(self) -> _AxesBase | None: ... + @axes.setter + def axes(self, new_axes: _AxesBase | None) -> None: ... + @property + def stale(self) -> bool: ... + @stale.setter + def stale(self, val: bool) -> None: ... + def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... + def get_tightbbox(self, renderer: RendererBase | None = ...) -> Bbox | None: ... + def add_callback(self, func: Callable[[Artist], Any]) -> int: ... + def remove_callback(self, oid: int) -> None: ... + def pchanged(self) -> None: ... + def is_transform_set(self) -> bool: ... + def set_transform(self, t: Transform | None) -> None: ... + def get_transform(self) -> Transform: ... + def get_children(self) -> list[Artist]: ... + # TODO can these dicts be type narrowed? e.g. str keys + def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ... + def pickable(self) -> bool: ... + def pick(self, mouseevent: MouseEvent) -> None: ... + def set_picker( + self, + picker: None + | bool + | float + | Callable[[Artist, MouseEvent], tuple[bool, dict[Any, Any]]], + ) -> None: ... + def get_picker( + self, + ) -> None | bool | float | Callable[ + [Artist, MouseEvent], tuple[bool, dict[Any, Any]] + ]: ... + def get_url(self) -> str | None: ... + def set_url(self, url: str | None) -> None: ... + def get_gid(self) -> str | None: ... + def set_gid(self, gid: str | None) -> None: ... + def get_snap(self) -> bool | None: ... + def set_snap(self, snap: bool | None) -> None: ... + def get_sketch_params(self) -> tuple[float, float, float] | None: ... + def set_sketch_params( + self, + scale: float | None = ..., + length: float | None = ..., + randomness: float | None = ..., + ) -> None: ... + def set_path_effects(self, path_effects: list[AbstractPathEffect]) -> None: ... + def get_path_effects(self) -> list[AbstractPathEffect]: ... + def get_figure(self) -> Figure | None: ... + def set_figure(self, fig: Figure) -> None: ... + def set_clip_box(self, clipbox: BboxBase | None) -> None: ... + def set_clip_path( + self, + path: Patch | Path | TransformedPath | TransformedPatchPath | None, + transform: Transform | None = ..., + ) -> None: ... + def get_alpha(self) -> float | None: ... + def get_visible(self) -> bool: ... + def get_animated(self) -> bool: ... + def get_in_layout(self) -> bool: ... + def get_clip_on(self) -> bool: ... + def get_clip_box(self) -> Bbox | None: ... + def get_clip_path( + self, + ) -> Patch | Path | TransformedPath | TransformedPatchPath | None: ... + def get_transformed_clip_path_and_affine( + self, + ) -> tuple[None, None] | tuple[Path, Transform]: ... + def set_clip_on(self, b: bool) -> None: ... + def get_rasterized(self) -> bool: ... + def set_rasterized(self, rasterized: bool) -> None: ... + def get_agg_filter(self) -> Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None: ... + def set_agg_filter( + self, filter_func: Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None + ) -> None: ... + def draw(self, renderer: RendererBase) -> None: ... + def set_alpha(self, alpha: float | None) -> None: ... + def set_visible(self, b: bool) -> None: ... + def set_animated(self, b: bool) -> None: ... + def set_in_layout(self, in_layout: bool) -> None: ... + def get_label(self) -> object: ... + def set_label(self, s: object) -> None: ... + def get_zorder(self) -> float: ... + def set_zorder(self, level: float) -> None: ... + @property + def sticky_edges(self) -> _XYPair: ... + def update_from(self, other: Artist) -> None: ... + def properties(self) -> dict[str, Any]: ... + def update(self, props: dict[str, Any]) -> list[Any]: ... + def _internal_update(self, kwargs: Any) -> list[Any]: ... + def set(self, **kwargs: Any) -> list[Any]: ... + def findobj( + self, + match: None | Callable[[Artist], bool] | type[Artist] = ..., + include_self: bool = ..., + ) -> list[Artist]: ... + def get_cursor_data(self, event: MouseEvent) -> Any: ... + def format_cursor_data(self, data: Any) -> str: ... + def get_mouseover(self) -> bool: ... + def set_mouseover(self, mouseover: bool) -> None: ... + @property + def mouseover(self) -> bool: ... + @mouseover.setter + def mouseover(self, mouseover: bool) -> None: ... + +class ArtistInspector: + oorig: Artist | type[Artist] + o: type[Artist] + aliasd: dict[str, set[str]] + def __init__( + self, o: Artist | type[Artist] | Iterable[Artist | type[Artist]] + ) -> None: ... + def get_aliases(self) -> dict[str, set[str]]: ... + def get_valid_values(self, attr: str) -> str | None: ... + def get_setters(self) -> list[str]: ... + @staticmethod + def number_of_parameters(func: Callable) -> int: ... + @staticmethod + def is_alias(method: Callable) -> bool: ... + def aliased_name(self, s: str) -> str: ... + def aliased_name_rest(self, s: str, target: str) -> str: ... + @overload + def pprint_setters( + self, prop: None = ..., leadingspace: int = ... + ) -> list[str]: ... + @overload + def pprint_setters(self, prop: str, leadingspace: int = ...) -> str: ... + @overload + def pprint_setters_rest( + self, prop: None = ..., leadingspace: int = ... + ) -> list[str]: ... + @overload + def pprint_setters_rest(self, prop: str, leadingspace: int = ...) -> str: ... + def properties(self) -> dict[str, Any]: ... + def pprint_getters(self) -> list[str]: ... + +def getp(obj: Artist, property: str | None = ...) -> Any: ... + +get = getp + +def setp(obj: Artist, *args, file: TextIO | None = ..., **kwargs) -> list[Any] | None: ... +def kwdoc(artist: Artist | type[Artist] | Iterable[Artist | type[Artist]]) -> str: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi new file mode 100644 index 0000000000..7df38b8bde --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/axes/__init__.pyi @@ -0,0 +1,16 @@ +from typing import TypeVar + +from ._axes import Axes as Axes + + +_T = TypeVar("_T") + +# Backcompat. +Subplot = Axes + +class _SubplotBaseMeta(type): + def __instancecheck__(self, obj) -> bool: ... + +class SubplotBase(metaclass=_SubplotBaseMeta): ... + +def subplot_class_factory(cls: type[_T]) -> type[_T]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi new file mode 100644 index 0000000000..9602db3b95 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/axes/_axes.pyi @@ -0,0 +1,767 @@ +from matplotlib.axes._base import _AxesBase +from matplotlib.axes._secondary_axes import SecondaryAxis + +from matplotlib.artist import Artist +from matplotlib.backend_bases import RendererBase +from matplotlib.collections import ( + Collection, + LineCollection, + BrokenBarHCollection, + PathCollection, + PolyCollection, + EventCollection, + QuadMesh, +) +from matplotlib.colors import Colormap, Normalize +from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer +from matplotlib.contour import ContourSet, QuadContourSet +from matplotlib.image import AxesImage, PcolorImage +from matplotlib.legend import Legend +from matplotlib.legend_handler import HandlerBase +from matplotlib.lines import Line2D +from matplotlib.mlab import GaussianKDE +from matplotlib.patches import Rectangle, FancyArrow, Polygon, StepPatch, Wedge +from matplotlib.quiver import Quiver, QuiverKey, Barbs +from matplotlib.text import Annotation, Text +from matplotlib.transforms import Transform, Bbox +import matplotlib.tri as mtri +import matplotlib.table as mtable +import matplotlib.stackplot as mstack +import matplotlib.streamplot as mstream + +import datetime +import PIL.Image +from collections.abc import Callable, Sequence +from typing import Any, Literal, overload +import numpy as np +from numpy.typing import ArrayLike +from matplotlib.typing import ColorType, MarkerType, LineStyleType + +class Axes(_AxesBase): + def get_title(self, loc: Literal["left", "center", "right"] = ...) -> str: ... + def set_title( + self, + label: str, + fontdict: dict[str, Any] | None = ..., + loc: Literal["left", "center", "right"] | None = ..., + pad: float | None = ..., + *, + y: float | None = ..., + **kwargs + ) -> Text: ... + def get_legend_handles_labels( + self, legend_handler_map: dict[type, HandlerBase] | None = ... + ) -> tuple[list[Artist], list[Any]]: ... + legend_: Legend | None + + @overload + def legend(self) -> Legend: ... + @overload + def legend(self, handles: Sequence[Artist | tuple[Artist, ...]], labels: Sequence[str], **kwargs) -> Legend: ... + @overload + def legend(self, *, handles: Sequence[Artist | tuple[Artist, ...]], **kwargs) -> Legend: ... + @overload + def legend(self, labels: Sequence[str], **kwargs) -> Legend: ... + @overload + def legend(self, **kwargs) -> Legend: ... + + def inset_axes( + self, + bounds: tuple[float, float, float, float], + *, + transform: Transform | None = ..., + zorder: float = ..., + **kwargs + ) -> Axes: ... + def indicate_inset( + self, + bounds: tuple[float, float, float, float], + inset_ax: Axes | None = ..., + *, + transform: Transform | None = ..., + facecolor: ColorType = ..., + edgecolor: ColorType = ..., + alpha: float = ..., + zorder: float = ..., + **kwargs + ) -> Rectangle: ... + def indicate_inset_zoom(self, inset_ax: Axes, **kwargs) -> Rectangle: ... + def secondary_xaxis( + self, + location: Literal["top", "bottom"] | float, + *, + functions: tuple[ + Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike] + ] + | Transform + | None = ..., + **kwargs + ) -> SecondaryAxis: ... + def secondary_yaxis( + self, + location: Literal["left", "right"] | float, + *, + functions: tuple[ + Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike] + ] + | Transform + | None = ..., + **kwargs + ) -> SecondaryAxis: ... + def text( + self, + x: float, + y: float, + s: str, + fontdict: dict[str, Any] | None = ..., + **kwargs + ) -> Text: ... + def annotate( + self, + text: str, + xy: tuple[float, float], + xytext: tuple[float, float] | None = ..., + xycoords: str + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] + | tuple[float, float] = ..., + textcoords: str + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] + | tuple[float, float] + | None = ..., + arrowprops: dict[str, Any] | None = ..., + annotation_clip: bool | None = ..., + **kwargs + ) -> Annotation: ... + def axhline( + self, y: float = ..., xmin: float = ..., xmax: float = ..., **kwargs + ) -> Line2D: ... + def axvline( + self, x: float = ..., ymin: float = ..., ymax: float = ..., **kwargs + ) -> Line2D: ... + + # TODO: Could separate the xy2 and slope signatures + def axline( + self, + xy1: tuple[float, float], + xy2: tuple[float, float] | None = ..., + *, + slope: float | None = ..., + **kwargs + ) -> Line2D: ... + def axhspan( + self, ymin: float, ymax: float, xmin: float = ..., xmax: float = ..., **kwargs + ) -> Polygon: ... + def axvspan( + self, xmin: float, xmax: float, ymin: float = ..., ymax: float = ..., **kwargs + ) -> Polygon: ... + def hlines( + self, + y: float | ArrayLike, + xmin: float | ArrayLike, + xmax: float | ArrayLike, + colors: ColorType | Sequence[ColorType] | None = ..., + linestyles: LineStyleType = ..., + label: str = ..., + *, + data=..., + **kwargs + ) -> LineCollection: ... + def vlines( + self, + x: float | ArrayLike, + ymin: float | ArrayLike, + ymax: float | ArrayLike, + colors: ColorType | Sequence[ColorType] | None = ..., + linestyles: LineStyleType = ..., + label: str = ..., + *, + data=..., + **kwargs + ) -> LineCollection: ... + def eventplot( + self, + positions: ArrayLike | Sequence[ArrayLike], + orientation: Literal["horizontal", "vertical"] = ..., + lineoffsets: float | Sequence[float] = ..., + linelengths: float | Sequence[float] = ..., + linewidths: float | Sequence[float] | None = ..., + colors: ColorType | Sequence[ColorType] | None = ..., + alpha: float | Sequence[float] | None = ..., + linestyles: LineStyleType | Sequence[LineStyleType] = ..., + *, + data=..., + **kwargs + ) -> EventCollection: ... + def plot( + self, + *args: float | ArrayLike | str, + scalex: bool = ..., + scaley: bool = ..., + data = ..., + **kwargs + ) -> list[Line2D]: ... + def plot_date( + self, + x: ArrayLike, + y: ArrayLike, + fmt: str = ..., + tz: str | datetime.tzinfo | None = ..., + xdate: bool = ..., + ydate: bool = ..., + *, + data=..., + **kwargs + ) -> list[Line2D]: ... + def loglog(self, *args, **kwargs) -> list[Line2D]: ... + def semilogx(self, *args, **kwargs) -> list[Line2D]: ... + def semilogy(self, *args, **kwargs) -> list[Line2D]: ... + def acorr( + self, x: ArrayLike, *, data=..., **kwargs + ) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ... + def xcorr( + self, + x: ArrayLike, + y: ArrayLike, + normed: bool = ..., + detrend: Callable[[ArrayLike], ArrayLike] = ..., + usevlines: bool = ..., + maxlags: int = ..., + *, + data = ..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ... + def step( + self, + x: ArrayLike, + y: ArrayLike, + *args, + where: Literal["pre", "post", "mid"] = ..., + data = ..., + **kwargs + ) -> list[Line2D]: ... + def bar( + self, + x: float | ArrayLike, + height: float | ArrayLike, + width: float | ArrayLike = ..., + bottom: float | ArrayLike | None = ..., + *, + align: Literal["center", "edge"] = ..., + data = ..., + **kwargs + ) -> BarContainer: ... + def barh( + self, + y: float | ArrayLike, + width: float | ArrayLike, + height: float | ArrayLike = ..., + left: float | ArrayLike | None = ..., + *, + align: Literal["center", "edge"] = ..., + data = ..., + **kwargs + ) -> BarContainer: ... + def bar_label( + self, + container: BarContainer, + labels: ArrayLike | None = ..., + *, + fmt: str | Callable[[float], str] = ..., + label_type: Literal["center", "edge"] = ..., + padding: float = ..., + **kwargs + ) -> list[Annotation]: ... + def broken_barh( + self, + xranges: Sequence[tuple[float, float]], + yrange: tuple[float, float], + *, + data=..., + **kwargs + ) -> BrokenBarHCollection: ... + def stem( + self, + *args: ArrayLike | str, + linefmt: str | None = ..., + markerfmt: str | None = ..., + basefmt: str | None = ..., + bottom: float = ..., + label: str | None = ..., + orientation: Literal["vertical", "horizontal"] = ..., + data=..., + ) -> StemContainer: ... + + # TODO: data kwarg preprocessor? + def pie( + self, + x: ArrayLike, + explode: ArrayLike | None = ..., + labels: Sequence[str] | None = ..., + colors: ColorType | Sequence[ColorType] | None = ..., + autopct: str | Callable[[float], str] | None = ..., + pctdistance: float = ..., + shadow: bool = ..., + labeldistance: float | None = ..., + startangle: float = ..., + radius: float = ..., + counterclock: bool = ..., + wedgeprops: dict[str, Any] | None = ..., + textprops: dict[str, Any] | None = ..., + center: tuple[float, float] = ..., + frame: bool = ..., + rotatelabels: bool = ..., + *, + normalize: bool = ..., + hatch: str | Sequence[str] | None = ..., + data=..., + ) -> tuple[list[Wedge], list[Text]] | tuple[ + list[Wedge], list[Text], list[Text] + ]: ... + def errorbar( + self, + x: float | ArrayLike, + y: float | ArrayLike, + yerr: float | ArrayLike | None = ..., + xerr: float | ArrayLike | None = ..., + fmt: str = ..., + ecolor: ColorType | None = ..., + elinewidth: float | None = ..., + capsize: float | None = ..., + barsabove: bool = ..., + lolims: bool | ArrayLike = ..., + uplims: bool | ArrayLike = ..., + xlolims: bool | ArrayLike = ..., + xuplims: bool | ArrayLike = ..., + errorevery: int | tuple[int, int] = ..., + capthick: float | None = ..., + *, + data=..., + **kwargs + ) -> ErrorbarContainer: ... + def boxplot( + self, + x: ArrayLike | Sequence[ArrayLike], + notch: bool | None = ..., + sym: str | None = ..., + vert: bool | None = ..., + whis: float | tuple[float, float] | None = ..., + positions: ArrayLike | None = ..., + widths: float | ArrayLike | None = ..., + patch_artist: bool | None = ..., + bootstrap: int | None = ..., + usermedians: ArrayLike | None = ..., + conf_intervals: ArrayLike | None = ..., + meanline: bool | None = ..., + showmeans: bool | None = ..., + showcaps: bool | None = ..., + showbox: bool | None = ..., + showfliers: bool | None = ..., + boxprops: dict[str, Any] | None = ..., + labels: Sequence[str] | None = ..., + flierprops: dict[str, Any] | None = ..., + medianprops: dict[str, Any] | None = ..., + meanprops: dict[str, Any] | None = ..., + capprops: dict[str, Any] | None = ..., + whiskerprops: dict[str, Any] | None = ..., + manage_ticks: bool = ..., + autorange: bool = ..., + zorder: float | None = ..., + capwidths: float | ArrayLike | None = ..., + *, + data=..., + ) -> dict[str, Any]: ... + def bxp( + self, + bxpstats: Sequence[dict[str, Any]], + positions: ArrayLike | None = ..., + widths: float | ArrayLike | None = ..., + vert: bool = ..., + patch_artist: bool = ..., + shownotches: bool = ..., + showmeans: bool = ..., + showcaps: bool = ..., + showbox: bool = ..., + showfliers: bool = ..., + boxprops: dict[str, Any] | None = ..., + whiskerprops: dict[str, Any] | None = ..., + flierprops: dict[str, Any] | None = ..., + medianprops: dict[str, Any] | None = ..., + capprops: dict[str, Any] | None = ..., + meanprops: dict[str, Any] | None = ..., + meanline: bool = ..., + manage_ticks: bool = ..., + zorder: float | None = ..., + capwidths: float | ArrayLike | None = ..., + ) -> dict[str, Any]: ... + def scatter( + self, + x: float | ArrayLike, + y: float | ArrayLike, + s: float | ArrayLike | None = ..., + c: ArrayLike | Sequence[ColorType] | ColorType | None = ..., + marker: MarkerType | None = ..., + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + alpha: float | None = ..., + linewidths: float | Sequence[float] | None = ..., + *, + edgecolors: Literal["face", "none"] | ColorType | Sequence[ColorType] | None = ..., + plotnonfinite: bool = ..., + data=..., + **kwargs + ) -> PathCollection: ... + def hexbin( + self, + x: ArrayLike, + y: ArrayLike, + C: ArrayLike | None = ..., + gridsize: int | tuple[int, int] = ..., + bins: Literal["log"] | int | Sequence[float] | None = ..., + xscale: Literal["linear", "log"] = ..., + yscale: Literal["linear", "log"] = ..., + extent: tuple[float, float, float, float] | None = ..., + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + alpha: float | None = ..., + linewidths: float | None = ..., + edgecolors: Literal["face", "none"] | ColorType = ..., + reduce_C_function: Callable[[np.ndarray | list[float]], float] = ..., + mincnt: int | None = ..., + marginals: bool = ..., + *, + data=..., + **kwargs + ) -> PolyCollection: ... + def arrow( + self, x: float, y: float, dx: float, dy: float, **kwargs + ) -> FancyArrow: ... + def quiverkey( + self, Q: Quiver, X: float, Y: float, U: float, label: str, **kwargs + ) -> QuiverKey: ... + def quiver(self, *args, data=..., **kwargs) -> Quiver: ... + def barbs(self, *args, data=..., **kwargs) -> Barbs: ... + def fill(self, *args, data=..., **kwargs) -> list[Polygon]: ... + def fill_between( + self, + x: ArrayLike, + y1: ArrayLike | float, + y2: ArrayLike | float = ..., + where: Sequence[bool] | None = ..., + interpolate: bool = ..., + step: Literal["pre", "post", "mid"] | None = ..., + *, + data=..., + **kwargs + ) -> PolyCollection: ... + def fill_betweenx( + self, + y: ArrayLike, + x1: ArrayLike | float, + x2: ArrayLike | float = ..., + where: Sequence[bool] | None = ..., + step: Literal["pre", "post", "mid"] | None = ..., + interpolate: bool = ..., + *, + data=..., + **kwargs + ) -> PolyCollection: ... + def imshow( + self, + X: ArrayLike | PIL.Image.Image, + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + *, + aspect: Literal["equal", "auto"] | float | None = ..., + interpolation: str | None = ..., + alpha: float | ArrayLike | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + origin: Literal["upper", "lower"] | None = ..., + extent: tuple[float, float, float, float] | None = ..., + interpolation_stage: Literal["data", "rgba"] | None = ..., + filternorm: bool = ..., + filterrad: float = ..., + resample: bool | None = ..., + url: str | None = ..., + data=..., + **kwargs + ) -> AxesImage: ... + def pcolor( + self, + *args: ArrayLike, + shading: Literal["flat", "nearest", "auto"] | None = ..., + alpha: float | None = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + data=..., + **kwargs + ) -> Collection: ... + def pcolormesh( + self, + *args: ArrayLike, + alpha: float | None = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + shading: Literal["flat", "nearest", "gouraud", "auto"] | None = ..., + antialiased: bool = ..., + data=..., + **kwargs + ) -> QuadMesh: ... + def pcolorfast( + self, + *args: ArrayLike | tuple[float, float], + alpha: float | None = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + data=..., + **kwargs + ) -> AxesImage | PcolorImage | QuadMesh: ... + def contour(self, *args, data=..., **kwargs) -> QuadContourSet: ... + def contourf(self, *args, data=..., **kwargs) -> QuadContourSet: ... + def clabel( + self, CS: ContourSet, levels: ArrayLike | None = ..., **kwargs + ) -> list[Text]: ... + def hist( + self, + x: ArrayLike | Sequence[ArrayLike], + bins: int | Sequence[float] | str | None = ..., + range: tuple[float, float] | None = ..., + density: bool = ..., + weights: ArrayLike | None = ..., + cumulative: bool | float = ..., + bottom: ArrayLike | float | None = ..., + histtype: Literal["bar", "barstacked", "step", "stepfilled"] = ..., + align: Literal["left", "mid", "right"] = ..., + orientation: Literal["vertical", "horizontal"] = ..., + rwidth: float | None = ..., + log: bool = ..., + color: ColorType | Sequence[ColorType] | None = ..., + label: str | Sequence[str] | None = ..., + stacked: bool = ..., + *, + data=..., + **kwargs + ) -> tuple[ + np.ndarray | list[np.ndarray], + np.ndarray, + BarContainer | Polygon | list[BarContainer | Polygon], + ]: ... + def stairs( + self, + values: ArrayLike, + edges: ArrayLike | None = ..., + *, + orientation: Literal["vertical", "horizontal"] = ..., + baseline: float | ArrayLike | None = ..., + fill: bool = ..., + data=..., + **kwargs + ) -> StepPatch: ... + def hist2d( + self, + x: ArrayLike, + y: ArrayLike, + bins: None + | int + | tuple[int, int] + | ArrayLike + | tuple[ArrayLike, ArrayLike] = ..., + range: ArrayLike | None = ..., + density: bool = ..., + weights: ArrayLike | None = ..., + cmin: float | None = ..., + cmax: float | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray, np.ndarray, QuadMesh]: ... + def ecdf( + self, + x: ArrayLike, + weights: ArrayLike | None = ..., + *, + complementary: bool=..., + orientation: Literal["vertical", "horizonatal"]=..., + compress: bool=..., + data=..., + **kwargs + ) -> Line2D: ... + def psd( + self, + x: ArrayLike, + NFFT: int | None = ..., + Fs: float | None = ..., + Fc: int | None = ..., + detrend: Literal["none", "mean", "linear"] + | Callable[[ArrayLike], ArrayLike] + | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + noverlap: int | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale_by_freq: bool | None = ..., + return_line: bool | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, Line2D]: ... + def csd( + self, + x: ArrayLike, + y: ArrayLike, + NFFT: int | None = ..., + Fs: float | None = ..., + Fc: int | None = ..., + detrend: Literal["none", "mean", "linear"] + | Callable[[ArrayLike], ArrayLike] + | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + noverlap: int | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale_by_freq: bool | None = ..., + return_line: bool | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, Line2D]: ... + def magnitude_spectrum( + self, + x: ArrayLike, + Fs: float | None = ..., + Fc: int | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale: Literal["default", "linear", "dB"] | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray, Line2D]: ... + def angle_spectrum( + self, + x: ArrayLike, + Fs: float | None = ..., + Fc: int | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray, Line2D]: ... + def phase_spectrum( + self, + x: ArrayLike, + Fs: float | None = ..., + Fc: int | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray, Line2D]: ... + def cohere( + self, + x: ArrayLike, + y: ArrayLike, + NFFT: int = ..., + Fs: float = ..., + Fc: int = ..., + detrend: Literal["none", "mean", "linear"] + | Callable[[ArrayLike], ArrayLike] = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike = ..., + noverlap: int = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] = ..., + scale_by_freq: bool | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray]: ... + def specgram( + self, + x: ArrayLike, + NFFT: int | None = ..., + Fs: float | None = ..., + Fc: int | None = ..., + detrend: Literal["none", "mean", "linear"] + | Callable[[ArrayLike], ArrayLike] + | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + noverlap: int | None = ..., + cmap: str | Colormap | None = ..., + xextent: tuple[float, float] | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale_by_freq: bool | None = ..., + mode: Literal["default", "psd", "magnitude", "angle", "phase"] | None = ..., + scale: Literal["default", "linear", "dB"] | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + *, + data=..., + **kwargs + ) -> tuple[np.ndarray, np.ndarray, np.ndarray, AxesImage]: ... + def spy( + self, + Z: ArrayLike, + precision: float | Literal["present"] = ..., + marker: str | None = ..., + markersize: float | None = ..., + aspect: Literal["equal", "auto"] | float | None = ..., + origin: Literal["upper", "lower"] = ..., + **kwargs + ) -> AxesImage: ... + def matshow(self, Z: ArrayLike, **kwargs) -> AxesImage: ... + def violinplot( + self, + dataset: ArrayLike | Sequence[ArrayLike], + positions: ArrayLike | None = ..., + vert: bool = ..., + widths: float | ArrayLike = ..., + showmeans: bool = ..., + showextrema: bool = ..., + showmedians: bool = ..., + quantiles: Sequence[float | Sequence[float]] | None = ..., + points: int = ..., + bw_method: Literal["scott", "silverman"] + | float + | Callable[[GaussianKDE], float] + | None = ..., + *, + data=..., + ) -> dict[str, Collection]: ... + def violin( + self, + vpstats: Sequence[dict[str, Any]], + positions: ArrayLike | None = ..., + vert: bool = ..., + widths: float | ArrayLike = ..., + showmeans: bool = ..., + showextrema: bool = ..., + showmedians: bool = ..., + ) -> dict[str, Collection]: ... + + table = mtable.table + stackplot = mstack.stackplot + streamplot = mstream.streamplot + tricontour = mtri.tricontour + tricontourf = mtri.tricontourf + tripcolor = mtri.tripcolor + triplot = mtri.triplot diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi new file mode 100644 index 0000000000..6adbb3e6f0 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/axes/_base.pyi @@ -0,0 +1,453 @@ +import matplotlib.artist as martist + +import datetime +from collections.abc import Callable, Iterable, Iterator, Sequence +from matplotlib import cbook +from matplotlib.artist import Artist +from matplotlib.axis import XAxis, YAxis, Tick +from matplotlib.backend_bases import RendererBase, MouseButton, MouseEvent +from matplotlib.cbook import CallbackRegistry +from matplotlib.container import Container +from matplotlib.collections import Collection +from matplotlib.cm import ScalarMappable +from matplotlib.legend import Legend +from matplotlib.lines import Line2D +from matplotlib.gridspec import SubplotSpec, GridSpec +from matplotlib.figure import Figure +from matplotlib.image import AxesImage +from matplotlib.patches import Patch +from matplotlib.scale import ScaleBase +from matplotlib.spines import Spines +from matplotlib.table import Table +from matplotlib.text import Text +from matplotlib.transforms import Transform, Bbox + +from cycler import Cycler + +import numpy as np +from numpy.typing import ArrayLike +from typing import Any, Literal, TypeVar, overload +from matplotlib.typing import ColorType + +_T = TypeVar("_T", bound=Artist) + +class _axis_method_wrapper: + attr_name: str + method_name: str + __doc__: str + def __init__( + self, attr_name: str, method_name: str, *, doc_sub: dict[str, str] | None = ... + ) -> None: ... + def __set_name__(self, owner: Any, name: str) -> None: ... + +class _AxesBase(martist.Artist): + name: str + patch: Patch + spines: Spines + fmt_xdata: Callable[[float], str] | None + fmt_ydata: Callable[[float], str] | None + xaxis: XAxis + yaxis: YAxis + bbox: Bbox + dataLim: Bbox + transAxes: Transform + transScale: Transform + transLimits: Transform + transData: Transform + ignore_existing_data_limits: bool + axison: bool + containers: list[Container] + callbacks: CallbackRegistry + child_axes: list[_AxesBase] + legend_: Legend | None + title: Text + _projection_init: Any + + def __init__( + self, + fig: Figure, + *args: tuple[float, float, float, float] | Bbox | int, + facecolor: ColorType | None = ..., + frameon: bool = ..., + sharex: _AxesBase | None = ..., + sharey: _AxesBase | None = ..., + label: Any = ..., + xscale: str | ScaleBase | None = ..., + yscale: str | ScaleBase | None = ..., + box_aspect: float | None = ..., + **kwargs + ) -> None: ... + def get_subplotspec(self) -> SubplotSpec | None: ... + def set_subplotspec(self, subplotspec: SubplotSpec) -> None: ... + def get_gridspec(self) -> GridSpec | None: ... + def set_figure(self, fig: Figure) -> None: ... + @property + def viewLim(self) -> Bbox: ... + def get_xaxis_transform( + self, which: Literal["grid", "tick1", "tick2"] = ... + ) -> Transform: ... + def get_xaxis_text1_transform( + self, pad_points: float + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_xaxis_text2_transform( + self, pad_points + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_yaxis_transform( + self, which: Literal["grid", "tick1", "tick2"] = ... + ) -> Transform: ... + def get_yaxis_text1_transform( + self, pad_points + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_yaxis_text2_transform( + self, pad_points + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_position(self, original: bool = ...) -> Bbox: ... + def set_position( + self, + pos: Bbox | tuple[float, float, float, float], + which: Literal["both", "active", "original"] = ..., + ) -> None: ... + def reset_position(self) -> None: ... + def set_axes_locator( + self, locator: Callable[[_AxesBase, RendererBase], Bbox] + ) -> None: ... + def get_axes_locator(self) -> Callable[[_AxesBase, RendererBase], Bbox]: ... + def sharex(self, other: _AxesBase) -> None: ... + def sharey(self, other: _AxesBase) -> None: ... + def clear(self) -> None: ... + def cla(self) -> None: ... + + class ArtistList(Sequence[_T]): + def __init__( + self, + axes: _AxesBase, + prop_name: str, + valid_types: type | Iterable[type] | None = ..., + invalid_types: type | Iterable[type] | None = ..., + ) -> None: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T]: ... + @overload + def __getitem__(self, key: int) -> _T: ... + @overload + def __getitem__(self, key: slice) -> list[_T]: ... + + @overload + def __add__(self, other: _AxesBase.ArtistList[_T]) -> list[_T]: ... + @overload + def __add__(self, other: list[Any]) -> list[Any]: ... + @overload + def __add__(self, other: tuple[Any]) -> tuple[Any]: ... + + @overload + def __radd__(self, other: _AxesBase.ArtistList[_T]) -> list[_T]: ... + @overload + def __radd__(self, other: list[Any]) -> list[Any]: ... + @overload + def __radd__(self, other: tuple[Any]) -> tuple[Any]: ... + + @property + def artists(self) -> _AxesBase.ArtistList[Artist]: ... + @property + def collections(self) -> _AxesBase.ArtistList[Collection]: ... + @property + def images(self) -> _AxesBase.ArtistList[AxesImage]: ... + @property + def lines(self) -> _AxesBase.ArtistList[Line2D]: ... + @property + def patches(self) -> _AxesBase.ArtistList[Patch]: ... + @property + def tables(self) -> _AxesBase.ArtistList[Table]: ... + @property + def texts(self) -> _AxesBase.ArtistList[Text]: ... + def get_facecolor(self) -> ColorType: ... + def set_facecolor(self, color: ColorType | None) -> None: ... + @overload + def set_prop_cycle(self, cycler: Cycler) -> None: ... + @overload + def set_prop_cycle(self, label: str, values: Iterable[Any]) -> None: ... + @overload + def set_prop_cycle(self, **kwargs: Iterable[Any]) -> None: ... + def get_aspect(self) -> float | Literal["auto"]: ... + def set_aspect( + self, + aspect: float | Literal["auto", "equal"], + adjustable: Literal["box", "datalim"] | None = ..., + anchor: str | tuple[float, float] | None = ..., + share: bool = ..., + ) -> None: ... + def get_adjustable(self) -> Literal["box", "datalim"]: ... + def set_adjustable( + self, adjustable: Literal["box", "datalim"], share: bool = ... + ) -> None: ... + def get_box_aspect(self) -> float | None: ... + def set_box_aspect(self, aspect: float | None = ...) -> None: ... + def get_anchor(self) -> str | tuple[float, float]: ... + def set_anchor( + self, anchor: str | tuple[float, float], share: bool = ... + ) -> None: ... + def get_data_ratio(self) -> float: ... + def apply_aspect(self, position: Bbox | None = ...) -> None: ... + @overload + def axis( + self, + arg: tuple[float, float, float, float] | bool | str | None = ..., + /, + *, + emit: bool = ... + ) -> tuple[float, float, float, float]: ... + @overload + def axis( + self, + *, + emit: bool = ..., + xmin: float | None = ..., + xmax: float | None = ..., + ymin: float | None = ..., + ymax: float | None = ... + ) -> tuple[float, float, float, float]: ... + def get_legend(self) -> Legend: ... + def get_images(self) -> list[AxesImage]: ... + def get_lines(self) -> list[Line2D]: ... + def get_xaxis(self) -> XAxis: ... + def get_yaxis(self) -> YAxis: ... + def has_data(self) -> bool: ... + def add_artist(self, a: Artist) -> Artist: ... + def add_child_axes(self, ax: _AxesBase) -> _AxesBase: ... + def add_collection( + self, collection: Collection, autolim: bool = ... + ) -> Collection: ... + def add_image(self, image: AxesImage) -> AxesImage: ... + def add_line(self, line: Line2D) -> Line2D: ... + def add_patch(self, p: Patch) -> Patch: ... + def add_table(self, tab: Table) -> Table: ... + def add_container(self, container: Container) -> Container: ... + def relim(self, visible_only: bool = ...) -> None: ... + def update_datalim( + self, xys: ArrayLike, updatex: bool = ..., updatey: bool = ... + ) -> None: ... + def in_axes(self, mouseevent: MouseEvent) -> bool: ... + def get_autoscale_on(self) -> bool: ... + def set_autoscale_on(self, b: bool) -> None: ... + @property + def use_sticky_edges(self) -> bool: ... + @use_sticky_edges.setter + def use_sticky_edges(self, b: bool) -> None: ... + def set_xmargin(self, m: float) -> None: ... + def set_ymargin(self, m: float) -> None: ... + + # Probably could be made better with overloads + def margins( + self, + *margins: float, + x: float | None = ..., + y: float | None = ..., + tight: bool | None = ... + ) -> tuple[float, float] | None: ... + def set_rasterization_zorder(self, z: float | None) -> None: ... + def get_rasterization_zorder(self) -> float | None: ... + def autoscale( + self, + enable: bool = ..., + axis: Literal["both", "x", "y"] = ..., + tight: bool | None = ..., + ) -> None: ... + def autoscale_view( + self, tight: bool | None = ..., scalex: bool = ..., scaley: bool = ... + ) -> None: ... + def draw_artist(self, a: Artist) -> None: ... + def redraw_in_frame(self) -> None: ... + def get_frame_on(self) -> bool: ... + def set_frame_on(self, b: bool) -> None: ... + def get_axisbelow(self) -> bool | Literal["line"]: ... + def set_axisbelow(self, b: bool | Literal["line"]) -> None: ... + def grid( + self, + visible: bool | None = ..., + which: Literal["major", "minor", "both"] = ..., + axis: Literal["both", "x", "y"] = ..., + **kwargs + ) -> None: ... + def ticklabel_format( + self, + *, + axis: Literal["both", "x", "y"] = ..., + style: Literal["", "sci", "scientific", "plain"] = ..., + scilimits: tuple[int, int] | None = ..., + useOffset: bool | float | None = ..., + useLocale: bool | None = ..., + useMathText: bool | None = ... + ) -> None: ... + def locator_params( + self, axis: Literal["both", "x", "y"] = ..., tight: bool | None = ..., **kwargs + ) -> None: ... + def tick_params(self, axis: Literal["both", "x", "y"] = ..., **kwargs) -> None: ... + def set_axis_off(self) -> None: ... + def set_axis_on(self) -> None: ... + def get_xlabel(self) -> str: ... + def set_xlabel( + self, + xlabel: str, + fontdict: dict[str, Any] | None = ..., + labelpad: float | None = ..., + *, + loc: Literal["left", "center", "right"] | None = ..., + **kwargs + ) -> Text: ... + def invert_xaxis(self) -> None: ... + def get_xbound(self) -> tuple[float, float]: ... + def set_xbound( + self, lower: float | None = ..., upper: float | None = ... + ) -> None: ... + def get_xlim(self) -> tuple[float, float]: ... + def set_xlim( + self, + left: float | tuple[float, float] | None = ..., + right: float | None = ..., + *, + emit: bool = ..., + auto: bool | None = ..., + xmin: float | None = ..., + xmax: float | None = ... + ) -> tuple[float, float]: ... + def get_ylabel(self) -> str: ... + def set_ylabel( + self, + ylabel: str, + fontdict: dict[str, Any] | None = ..., + labelpad: float | None = ..., + *, + loc: Literal["bottom", "center", "top"] | None = ..., + **kwargs + ) -> Text: ... + def invert_yaxis(self) -> None: ... + def get_ybound(self) -> tuple[float, float]: ... + def set_ybound( + self, lower: float | None = ..., upper: float | None = ... + ) -> None: ... + def get_ylim(self) -> tuple[float, float]: ... + def set_ylim( + self, + bottom: float | tuple[float, float] | None = ..., + top: float | None = ..., + *, + emit: bool = ..., + auto: bool | None = ..., + ymin: float | None = ..., + ymax: float | None = ... + ) -> tuple[float, float]: ... + def format_xdata(self, x: float) -> str: ... + def format_ydata(self, y: float) -> str: ... + def format_coord(self, x: float, y: float) -> str: ... + def minorticks_on(self) -> None: ... + def minorticks_off(self) -> None: ... + def can_zoom(self) -> bool: ... + def can_pan(self) -> bool: ... + def get_navigate(self) -> bool: ... + def set_navigate(self, b: bool) -> None: ... + def get_navigate_mode(self) -> Literal["PAN", "ZOOM"] | None: ... + def set_navigate_mode(self, b: Literal["PAN", "ZOOM"] | None) -> None: ... + def start_pan(self, x: float, y: float, button: MouseButton) -> None: ... + def end_pan(self) -> None: ... + def drag_pan( + self, button: MouseButton, key: str | None, x: float, y: float + ) -> None: ... + def get_children(self) -> list[Artist]: ... + def contains_point(self, point: tuple[int, int]) -> bool: ... + def get_default_bbox_extra_artists(self) -> list[Artist]: ... + def get_tightbbox( + self, + renderer: RendererBase | None = ..., + *, + call_axes_locator: bool = ..., + bbox_extra_artists: Sequence[Artist] | None = ..., + for_layout_only: bool = ... + ) -> Bbox | None: ... + def twinx(self) -> _AxesBase: ... + def twiny(self) -> _AxesBase: ... + def get_shared_x_axes(self) -> cbook.GrouperView: ... + def get_shared_y_axes(self) -> cbook.GrouperView: ... + def label_outer(self, remove_inner_ticks: bool = ...) -> None: ... + + # The methods underneath this line are added via the `_axis_method_wrapper` class + # Initially they are set to an object, but that object uses `__set_name__` to override + # itself with a method modified from the Axis methods for the x or y Axis. + # As such, they are typed according to the resultant method rather than as that object. + + def get_xgridlines(self) -> list[Line2D]: ... + def get_xticklines(self, minor: bool = ...) -> list[Line2D]: ... + def get_ygridlines(self) -> list[Line2D]: ... + def get_yticklines(self, minor: bool = ...) -> list[Line2D]: ... + def _sci(self, im: ScalarMappable) -> None: ... + def get_autoscalex_on(self) -> bool: ... + def get_autoscaley_on(self) -> bool: ... + def set_autoscalex_on(self, b: bool) -> None: ... + def set_autoscaley_on(self, b: bool) -> None: ... + def xaxis_inverted(self) -> bool: ... + def get_xscale(self) -> str: ... + def set_xscale(self, value: str | ScaleBase, **kwargs) -> None: ... + def get_xticks(self, *, minor: bool = ...) -> np.ndarray: ... + def set_xticks( + self, + ticks: ArrayLike, + labels: Iterable[str] | None = ..., + *, + minor: bool = ..., + **kwargs + ) -> list[Tick]: ... + def get_xmajorticklabels(self) -> list[Text]: ... + def get_xminorticklabels(self) -> list[Text]: ... + def get_xticklabels( + self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ... + ) -> list[Text]: ... + def set_xticklabels( + self, + labels: Iterable[str | Text], + *, + minor: bool = ..., + fontdict: dict[str, Any] | None = ..., + **kwargs + ) -> list[Text]: ... + def yaxis_inverted(self) -> bool: ... + def get_yscale(self) -> str: ... + def set_yscale(self, value: str | ScaleBase, **kwargs) -> None: ... + def get_yticks(self, *, minor: bool = ...) -> np.ndarray: ... + def set_yticks( + self, + ticks: ArrayLike, + labels: Iterable[str] | None = ..., + *, + minor: bool = ..., + **kwargs + ) -> list[Tick]: ... + def get_ymajorticklabels(self) -> list[Text]: ... + def get_yminorticklabels(self) -> list[Text]: ... + def get_yticklabels( + self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ... + ) -> list[Text]: ... + def set_yticklabels( + self, + labels: Iterable[str | Text], + *, + minor: bool = ..., + fontdict: dict[str, Any] | None = ..., + **kwargs + ) -> list[Text]: ... + def xaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ... + def yaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi b/contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi new file mode 100644 index 0000000000..dcf1d2eb77 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/axes/_secondary_axes.pyi @@ -0,0 +1,42 @@ +from matplotlib.axes._base import _AxesBase +from matplotlib.axis import Tick + +from matplotlib.transforms import Transform + +from collections.abc import Callable, Iterable +from typing import Literal +from numpy.typing import ArrayLike +from matplotlib.typing import ColorType + +class SecondaryAxis(_AxesBase): + def __init__( + self, + parent: _AxesBase, + orientation: Literal["x", "y"], + location: Literal["top", "bottom", "right", "left"] | float, + functions: tuple[ + Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike] + ] + | Transform, + **kwargs + ) -> None: ... + def set_alignment( + self, align: Literal["top", "bottom", "right", "left"] + ) -> None: ... + def set_location( + self, location: Literal["top", "bottom", "right", "left"] | float + ) -> None: ... + def set_ticks( + self, + ticks: ArrayLike, + labels: Iterable[str] | None = ..., + *, + minor: bool = ..., + **kwargs + ) -> list[Tick]: ... + def set_functions( + self, + functions: tuple[Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]] | Transform, + ) -> None: ... + def set_aspect(self, *args, **kwargs) -> None: ... + def set_color(self, color: ColorType) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/axis.pyi b/contrib/python/matplotlib/py3/matplotlib/axis.pyi new file mode 100644 index 0000000000..5ca8fcb6fd --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/axis.pyi @@ -0,0 +1,278 @@ +from collections.abc import Callable, Iterable, Sequence +import datetime +from typing import Any, Literal, overload + +import numpy as np +from numpy.typing import ArrayLike + +import matplotlib.artist as martist +from matplotlib import cbook +from matplotlib.axes import Axes +from matplotlib.backend_bases import RendererBase +from matplotlib.lines import Line2D +from matplotlib.text import Text +from matplotlib.ticker import Locator, Formatter +from matplotlib.transforms import Transform, Bbox +from matplotlib.typing import ColorType + + +GRIDLINE_INTERPOLATION_STEPS: int + +class Tick(martist.Artist): + axes: Axes + tick1line: Line2D + tick2line: Line2D + gridline: Line2D + label1: Text + label2: Text + def __init__( + self, + axes: Axes, + loc: float, + *, + size: float | None = ..., + width: float | None = ..., + color: ColorType | None = ..., + tickdir: Literal["in", "inout", "out"] | None = ..., + pad: float | None = ..., + labelsize: float | None = ..., + labelcolor: ColorType | None = ..., + labelfontfamily: str | Sequence[str] | None = ..., + zorder: float | None = ..., + gridOn: bool | None = ..., + tick1On: bool = ..., + tick2On: bool = ..., + label1On: bool = ..., + label2On: bool = ..., + major: bool = ..., + labelrotation: float = ..., + grid_color: ColorType | None = ..., + grid_linestyle: str | None = ..., + grid_linewidth: float | None = ..., + grid_alpha: float | None = ..., + **kwargs + ) -> None: ... + def get_tickdir(self) -> Literal["in", "inout", "out"]: ... + def get_tick_padding(self) -> float: ... + def get_children(self) -> list[martist.Artist]: ... + stale: bool + def set_pad(self, val: float) -> None: ... + def get_pad(self) -> None: ... + def get_loc(self) -> float: ... + def set_label1(self, s: object) -> None: ... + def set_label(self, s: object) -> None: ... + def set_label2(self, s: object) -> None: ... + def set_url(self, url: str | None) -> None: ... + def get_view_interval(self) -> ArrayLike: ... + def update_position(self, loc: float) -> None: ... + +class XTick(Tick): + __name__: str + def __init__(self, *args, **kwargs) -> None: ... + stale: bool + def update_position(self, loc: float) -> None: ... + def get_view_interval(self) -> np.ndarray: ... + +class YTick(Tick): + __name__: str + def __init__(self, *args, **kwargs) -> None: ... + stale: bool + def update_position(self, loc: float) -> None: ... + def get_view_interval(self) -> np.ndarray: ... + +class Ticker: + def __init__(self) -> None: ... + @property + def locator(self) -> Locator | None: ... + @locator.setter + def locator(self, locator: Locator) -> None: ... + @property + def formatter(self) -> Formatter | None: ... + @formatter.setter + def formatter(self, formatter: Formatter) -> None: ... + +class _LazyTickList: + def __init__(self, major: bool) -> None: ... + # Replace return with Self when py3.9 is dropped + @overload + def __get__(self, instance: None, owner: None) -> _LazyTickList: ... + @overload + def __get__(self, instance: Axis, owner: type[Axis]) -> list[Tick]: ... + +class Axis(martist.Artist): + OFFSETTEXTPAD: int + isDefault_label: bool + axes: Axes + major: Ticker + minor: Ticker + callbacks: cbook.CallbackRegistry + label: Text + offsetText: Text + labelpad: float + pickradius: float + def __init__(self, axes, *, pickradius: float = ..., + clear: bool = ...) -> None: ... + @property + def isDefault_majloc(self) -> bool: ... + @isDefault_majloc.setter + def isDefault_majloc(self, value: bool) -> None: ... + @property + def isDefault_majfmt(self) -> bool: ... + @isDefault_majfmt.setter + def isDefault_majfmt(self, value: bool) -> None: ... + @property + def isDefault_minloc(self) -> bool: ... + @isDefault_minloc.setter + def isDefault_minloc(self, value: bool) -> None: ... + @property + def isDefault_minfmt(self) -> bool: ... + @isDefault_minfmt.setter + def isDefault_minfmt(self, value: bool) -> None: ... + majorTicks: _LazyTickList + minorTicks: _LazyTickList + def get_remove_overlapping_locs(self) -> bool: ... + def set_remove_overlapping_locs(self, val: bool) -> None: ... + @property + def remove_overlapping_locs(self) -> bool: ... + @remove_overlapping_locs.setter + def remove_overlapping_locs(self, val: bool) -> None: ... + stale: bool + def set_label_coords( + self, x: float, y: float, transform: Transform | None = ... + ) -> None: ... + def get_transform(self) -> Transform: ... + def get_scale(self) -> str: ... + def limit_range_for_scale( + self, vmin: float, vmax: float + ) -> tuple[float, float]: ... + def get_children(self) -> list[martist.Artist]: ... + # TODO units + converter: Any + units: Any + def clear(self) -> None: ... + def reset_ticks(self) -> None: ... + def set_tick_params( + self, + which: Literal["major", "minor", "both"] = ..., + reset: bool = ..., + **kwargs + ) -> None: ... + def get_tick_params( + self, which: Literal["major", "minor"] = ... + ) -> dict[str, Any]: ... + def get_view_interval(self) -> tuple[float, float]: ... + def set_view_interval( + self, vmin: float, vmax: float, ignore: bool = ... + ) -> None: ... + def get_data_interval(self) -> tuple[float, float]: ... + def set_data_interval( + self, vmin: float, vmax: float, ignore: bool = ... + ) -> None: ... + def get_inverted(self) -> bool: ... + def set_inverted(self, inverted: bool) -> None: ... + def set_default_intervals(self) -> None: ... + def get_tightbbox( + self, renderer: RendererBase | None = ..., *, for_layout_only: bool = ... + ) -> Bbox | None: ... + def get_tick_padding(self) -> float: ... + def get_gridlines(self) -> list[Line2D]: ... + def get_label(self) -> Text: ... + def get_offset_text(self) -> Text: ... + def get_pickradius(self) -> float: ... + def get_majorticklabels(self) -> list[Text]: ... + def get_minorticklabels(self) -> list[Text]: ... + def get_ticklabels( + self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ... + ) -> list[Text]: ... + def get_majorticklines(self) -> list[Line2D]: ... + def get_minorticklines(self) -> list[Line2D]: ... + def get_ticklines(self, minor: bool = ...) -> list[Line2D]: ... + def get_majorticklocs(self) -> np.ndarray: ... + def get_minorticklocs(self) -> np.ndarray: ... + def get_ticklocs(self, *, minor: bool = ...) -> np.ndarray: ... + def get_ticks_direction(self, minor: bool = ...) -> np.ndarray: ... + def get_label_text(self) -> str: ... + def get_major_locator(self) -> Locator: ... + def get_minor_locator(self) -> Locator: ... + def get_major_formatter(self) -> Formatter: ... + def get_minor_formatter(self) -> Formatter: ... + def get_major_ticks(self, numticks: int | None = ...) -> list[Tick]: ... + def get_minor_ticks(self, numticks: int | None = ...) -> list[Tick]: ... + def grid( + self, + visible: bool | None = ..., + which: Literal["major", "minor", "both"] = ..., + **kwargs + ) -> None: ... + # TODO units + def update_units(self, data): ... + def have_units(self) -> bool: ... + def convert_units(self, x): ... + def set_units(self, u) -> None: ... + def get_units(self): ... + def set_label_text( + self, label: str, fontdict: dict[str, Any] | None = ..., **kwargs + ) -> Text: ... + def set_major_formatter( + self, formatter: Formatter | str | Callable[[float, float], str] + ) -> None: ... + def set_minor_formatter( + self, formatter: Formatter | str | Callable[[float, float], str] + ) -> None: ... + def set_major_locator(self, locator: Locator) -> None: ... + def set_minor_locator(self, locator: Locator) -> None: ... + def set_pickradius(self, pickradius: float) -> None: ... + def set_ticklabels( + self, + labels: Iterable[str | Text], + *, + minor: bool = ..., + fontdict: dict[str, Any] | None = ..., + **kwargs + ) -> list[Text]: ... + def set_ticks( + self, + ticks: ArrayLike, + labels: Iterable[str] | None = ..., + *, + minor: bool = ..., + **kwargs + ) -> list[Tick]: ... + def axis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ... + def get_tick_space(self) -> int: ... + def get_label_position(self) -> Literal["top", "bottom"]: ... + def set_label_position( + self, position: Literal["top", "bottom", "left", "right"] + ) -> None: ... + def get_minpos(self) -> float: ... + +class XAxis(Axis): + __name__: str + axis_name: str + def __init__(self, *args, **kwargs) -> None: ... + label_position: Literal["bottom", "top"] + stale: bool + def set_label_position(self, position: Literal["bottom", "top"]) -> None: ... # type: ignore[override] + def set_ticks_position( + self, position: Literal["top", "bottom", "both", "default", "none"] + ) -> None: ... + def tick_top(self) -> None: ... + def tick_bottom(self) -> None: ... + def get_ticks_position(self) -> Literal["top", "bottom", "default", "unknown"]: ... + def get_tick_space(self) -> int: ... + +class YAxis(Axis): + __name__: str + axis_name: str + def __init__(self, *args, **kwargs) -> None: ... + label_position: Literal["left", "right"] + stale: bool + def set_label_position(self, position: Literal["left", "right"]) -> None: ... # type: ignore[override] + def set_offset_position(self, position: Literal["left", "right"]) -> None: ... + def set_ticks_position( + self, position: Literal["left", "right", "both", "default", "none"] + ) -> None: ... + def tick_right(self) -> None: ... + def tick_left(self) -> None: ... + def get_ticks_position(self) -> Literal["left", "right", "default", "unknown"]: ... + def get_tick_space(self) -> int: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi b/contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi new file mode 100644 index 0000000000..0ae88cf18a --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/backend_bases.pyi @@ -0,0 +1,490 @@ +from enum import Enum, IntEnum +import os +from matplotlib import ( + cbook, + transforms, + widgets, + _api, +) +from matplotlib.artist import Artist +from matplotlib.axes import Axes +from matplotlib.backend_managers import ToolManager +from matplotlib.backend_tools import Cursors, ToolBase +from matplotlib.colorbar import Colorbar +from matplotlib.figure import Figure +from matplotlib.font_manager import FontProperties +from matplotlib.path import Path +from matplotlib.texmanager import TexManager +from matplotlib.text import Text +from matplotlib.transforms import Bbox, BboxBase, Transform, TransformedPath + +from collections.abc import Callable, Iterable, Sequence +from typing import Any, IO, Literal, NamedTuple, TypeVar +from numpy.typing import ArrayLike +from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType + +def register_backend( + format: str, backend: str | type[FigureCanvasBase], description: str | None = ... +) -> None: ... +def get_registered_canvas_class(format: str) -> type[FigureCanvasBase]: ... + +class RendererBase: + def __init__(self) -> None: ... + def open_group(self, s: str, gid: str | None = ...) -> None: ... + def close_group(self, s: str) -> None: ... + def draw_path( + self, + gc: GraphicsContextBase, + path: Path, + transform: Transform, + rgbFace: ColorType | None = ..., + ) -> None: ... + def draw_markers( + self, + gc: GraphicsContextBase, + marker_path: Path, + marker_trans: Transform, + path: Path, + trans: Transform, + rgbFace: ColorType | None = ..., + ) -> None: ... + def draw_path_collection( + self, + gc: GraphicsContextBase, + master_transform: Transform, + paths: Sequence[Path], + all_transforms: Sequence[ArrayLike], + offsets: ArrayLike | Sequence[ArrayLike], + offset_trans: Transform, + facecolors: ColorType | Sequence[ColorType], + edgecolors: ColorType | Sequence[ColorType], + linewidths: float | Sequence[float], + linestyles: LineStyleType | Sequence[LineStyleType], + antialiaseds: bool | Sequence[bool], + urls: str | Sequence[str], + offset_position: Any, + ) -> None: ... + def draw_quad_mesh( + self, + gc: GraphicsContextBase, + master_transform: Transform, + meshWidth, + meshHeight, + coordinates: ArrayLike, + offsets: ArrayLike | Sequence[ArrayLike], + offsetTrans: Transform, + facecolors: Sequence[ColorType], + antialiased: bool, + edgecolors: Sequence[ColorType] | ColorType | None, + ) -> None: ... + def draw_gouraud_triangle( + self, + gc: GraphicsContextBase, + points: ArrayLike, + colors: ArrayLike, + transform: Transform, + ) -> None: ... + def draw_gouraud_triangles( + self, + gc: GraphicsContextBase, + triangles_array: ArrayLike, + colors_array: ArrayLike, + transform: Transform, + ) -> None: ... + def get_image_magnification(self) -> float: ... + def draw_image( + self, + gc: GraphicsContextBase, + x: float, + y: float, + im: ArrayLike, + transform: transforms.Affine2DBase | None = ..., + ) -> None: ... + def option_image_nocomposite(self) -> bool: ... + def option_scale_image(self) -> bool: ... + def draw_tex( + self, + gc: GraphicsContextBase, + x: float, + y: float, + s: str, + prop: FontProperties, + angle: float, + *, + mtext: Text | None = ... + ) -> None: ... + def draw_text( + self, + gc: GraphicsContextBase, + x: float, + y: float, + s: str, + prop: FontProperties, + angle: float, + ismath: bool | Literal["TeX"] = ..., + mtext: Text | None = ..., + ) -> None: ... + def get_text_width_height_descent( + self, s: str, prop: FontProperties, ismath: bool | Literal["TeX"] + ) -> tuple[float, float, float]: ... + def flipy(self) -> bool: ... + def get_canvas_width_height(self) -> tuple[float, float]: ... + def get_texmanager(self) -> TexManager: ... + def new_gc(self) -> GraphicsContextBase: ... + def points_to_pixels(self, points: ArrayLike) -> ArrayLike: ... + def start_rasterizing(self) -> None: ... + def stop_rasterizing(self) -> None: ... + def start_filter(self) -> None: ... + def stop_filter(self, filter_func) -> None: ... + +class GraphicsContextBase: + def __init__(self) -> None: ... + def copy_properties(self, gc: GraphicsContextBase) -> None: ... + def restore(self) -> None: ... + def get_alpha(self) -> float: ... + def get_antialiased(self) -> int: ... + def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ... + def get_clip_rectangle(self) -> Bbox | None: ... + def get_clip_path( + self, + ) -> tuple[TransformedPath, Transform] | tuple[None, None]: ... + def get_dashes(self) -> tuple[float, ArrayLike | None]: ... + def get_forced_alpha(self) -> bool: ... + def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ... + def get_linewidth(self) -> float: ... + def get_rgb(self) -> tuple[float, float, float, float]: ... + def get_url(self) -> str | None: ... + def get_gid(self) -> int | None: ... + def get_snap(self) -> bool | None: ... + def set_alpha(self, alpha: float) -> None: ... + def set_antialiased(self, b: bool) -> None: ... + def set_capstyle(self, cs: CapStyleType) -> None: ... + def set_clip_rectangle(self, rectangle: Bbox | None) -> None: ... + def set_clip_path(self, path: TransformedPath | None) -> None: ... + def set_dashes(self, dash_offset: float, dash_list: ArrayLike | None) -> None: ... + def set_foreground(self, fg: ColorType, isRGBA: bool = ...) -> None: ... + def set_joinstyle(self, js: JoinStyleType) -> None: ... + def set_linewidth(self, w: float) -> None: ... + def set_url(self, url: str | None) -> None: ... + def set_gid(self, id: int | None) -> None: ... + def set_snap(self, snap: bool | None) -> None: ... + def set_hatch(self, hatch: str | None) -> None: ... + def get_hatch(self) -> str | None: ... + def get_hatch_path(self, density: float = ...) -> Path: ... + def get_hatch_color(self) -> ColorType: ... + def set_hatch_color(self, hatch_color: ColorType) -> None: ... + def get_hatch_linewidth(self) -> float: ... + def get_sketch_params(self) -> tuple[float, float, float] | None: ... + def set_sketch_params( + self, + scale: float | None = ..., + length: float | None = ..., + randomness: float | None = ..., + ) -> None: ... + +class TimerBase: + callbacks: list[tuple[Callable, tuple, dict[str, Any]]] + def __init__( + self, + interval: int | None = ..., + callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ..., + ) -> None: ... + def __del__(self) -> None: ... + def start(self, interval: int | None = ...) -> None: ... + def stop(self) -> None: ... + @property + def interval(self) -> int: ... + @interval.setter + def interval(self, interval: int) -> None: ... + @property + def single_shot(self) -> bool: ... + @single_shot.setter + def single_shot(self, ss: bool) -> None: ... + def add_callback(self, func: Callable, *args, **kwargs) -> Callable: ... + def remove_callback(self, func: Callable, *args, **kwargs) -> None: ... + +class Event: + name: str + canvas: FigureCanvasBase + def __init__( + self, name: str, canvas: FigureCanvasBase, guiEvent: Any | None = ... + ) -> None: ... + + @property + def guiEvent(self) -> Any: ... + +class DrawEvent(Event): + renderer: RendererBase + def __init__( + self, name: str, canvas: FigureCanvasBase, renderer: RendererBase + ) -> None: ... + +class ResizeEvent(Event): + width: int + height: int + def __init__(self, name: str, canvas: FigureCanvasBase) -> None: ... + +class CloseEvent(Event): ... + +class LocationEvent(Event): + lastevent: Event | None + x: int + y: int + inaxes: Axes | None + xdata: float | None + ydata: float | None + def __init__( + self, + name: str, + canvas: FigureCanvasBase, + x: int, + y: int, + guiEvent: Any | None = ..., + *, + modifiers: Iterable[str] | None = ..., + ) -> None: ... + +class MouseButton(IntEnum): + LEFT: int + MIDDLE: int + RIGHT: int + BACK: int + FORWARD: int + +class MouseEvent(LocationEvent): + button: MouseButton | Literal["up", "down"] | None + key: str | None + step: float + dblclick: bool + def __init__( + self, + name: str, + canvas: FigureCanvasBase, + x: int, + y: int, + button: MouseButton | Literal["up", "down"] | None = ..., + key: str | None = ..., + step: float = ..., + dblclick: bool = ..., + guiEvent: Any | None = ..., + *, + modifiers: Iterable[str] | None = ..., + ) -> None: ... + +class PickEvent(Event): + mouseevent: MouseEvent + artist: Artist + def __init__( + self, + name: str, + canvas: FigureCanvasBase, + mouseevent: MouseEvent, + artist: Artist, + guiEvent: Any | None = ..., + **kwargs + ) -> None: ... + +class KeyEvent(LocationEvent): + key: str | None + def __init__( + self, + name: str, + canvas: FigureCanvasBase, + key: str | None, + x: int = ..., + y: int = ..., + guiEvent: Any | None = ..., + ) -> None: ... + +class FigureCanvasBase: + required_interactive_framework: str | None + + @_api.classproperty + def manager_class(cls) -> type[FigureManagerBase]: ... + events: list[str] + fixed_dpi: None | float + filetypes: dict[str, str] + + @_api.classproperty + def supports_blit(cls) -> bool: ... + + figure: Figure + manager: None | FigureManagerBase + widgetlock: widgets.LockDraw + mouse_grabber: None | Axes + toolbar: None | NavigationToolbar2 + def __init__(self, figure: Figure | None = ...) -> None: ... + @property + def callbacks(self) -> cbook.CallbackRegistry: ... + @property + def button_pick_id(self) -> int: ... + @property + def scroll_pick_id(self) -> int: ... + @classmethod + def new_manager(cls, figure: Figure, num: int | str) -> FigureManagerBase: ... + def is_saving(self) -> bool: ... + def blit(self, bbox: BboxBase | None = ...) -> None: ... + def inaxes(self, xy: tuple[float, float]) -> Axes | None: ... + def grab_mouse(self, ax: Axes) -> None: ... + def release_mouse(self, ax: Axes) -> None: ... + def set_cursor(self, cursor: Cursors) -> None: ... + def draw(self, *args, **kwargs) -> None: ... + def draw_idle(self, *args, **kwargs) -> None: ... + @property + def device_pixel_ratio(self) -> float: ... + def get_width_height(self, *, physical: bool = ...) -> tuple[int, int]: ... + @classmethod + def get_supported_filetypes(cls) -> dict[str, str]: ... + @classmethod + def get_supported_filetypes_grouped(cls) -> dict[str, list[str]]: ... + def print_figure( + self, + filename: str | os.PathLike | IO, + dpi: float | None = ..., + facecolor: ColorType | Literal["auto"] | None = ..., + edgecolor: ColorType | Literal["auto"] | None = ..., + orientation: str = ..., + format: str | None = ..., + *, + bbox_inches: Literal["tight"] | Bbox | None = ..., + pad_inches: float | None = ..., + bbox_extra_artists: list[Artist] | None = ..., + backend: str | None = ..., + **kwargs + ) -> Any: ... + @classmethod + def get_default_filetype(cls) -> str: ... + def get_default_filename(self) -> str: ... + _T = TypeVar("_T", bound=FigureCanvasBase) + def switch_backends(self, FigureCanvasClass: type[_T]) -> _T: ... + def mpl_connect(self, s: str, func: Callable[[Event], Any]) -> int: ... + def mpl_disconnect(self, cid: int) -> None: ... + def new_timer( + self, + interval: int | None = ..., + callbacks: list[tuple[Callable, tuple, dict[str, Any]]] | None = ..., + ) -> TimerBase: ... + def flush_events(self) -> None: ... + def start_event_loop(self, timeout: float = ...) -> None: ... + def stop_event_loop(self) -> None: ... + +def key_press_handler( + event: KeyEvent, + canvas: FigureCanvasBase | None = ..., + toolbar: NavigationToolbar2 | None = ..., +) -> None: ... +def button_press_handler( + event: MouseEvent, + canvas: FigureCanvasBase | None = ..., + toolbar: NavigationToolbar2 | None = ..., +) -> None: ... + +class NonGuiException(Exception): ... + +class FigureManagerBase: + canvas: FigureCanvasBase + num: int | str + key_press_handler_id: int | None + button_press_handler_id: int | None + toolmanager: ToolManager | None + toolbar: NavigationToolbar2 | ToolContainerBase | None + def __init__(self, canvas: FigureCanvasBase, num: int | str) -> None: ... + @classmethod + def create_with_canvas( + cls, canvas_class: type[FigureCanvasBase], figure: Figure, num: int | str + ) -> FigureManagerBase: ... + @classmethod + def start_main_loop(cls) -> None: ... + @classmethod + def pyplot_show(cls, *, block: bool | None = ...) -> None: ... + def show(self) -> None: ... + def destroy(self) -> None: ... + def full_screen_toggle(self) -> None: ... + def resize(self, w: int, h: int) -> None: ... + def get_window_title(self) -> str: ... + def set_window_title(self, title: str) -> None: ... + +cursors = Cursors + +class _Mode(str, Enum): + NONE: str + PAN: str + ZOOM: str + +class NavigationToolbar2: + toolitems: tuple[tuple[str, ...] | tuple[None, ...], ...] + canvas: FigureCanvasBase + mode: _Mode + def __init__(self, canvas: FigureCanvasBase) -> None: ... + def set_message(self, s: str) -> None: ... + def draw_rubberband( + self, event: Event, x0: float, y0: float, x1: float, y1: float + ) -> None: ... + def remove_rubberband(self) -> None: ... + def home(self, *args) -> None: ... + def back(self, *args) -> None: ... + def forward(self, *args) -> None: ... + def mouse_move(self, event: MouseEvent) -> None: ... + def pan(self, *args) -> None: ... + + class _PanInfo(NamedTuple): + button: MouseButton + axes: list[Axes] + cid: int + def press_pan(self, event: Event) -> None: ... + def drag_pan(self, event: Event) -> None: ... + def release_pan(self, event: Event) -> None: ... + def zoom(self, *args) -> None: ... + + class _ZoomInfo(NamedTuple): + direction: Literal["in", "out"] + start_xy: tuple[float, float] + axes: list[Axes] + cid: int + cbar: Colorbar + def press_zoom(self, event: Event) -> None: ... + def drag_zoom(self, event: Event) -> None: ... + def release_zoom(self, event: Event) -> None: ... + def push_current(self) -> None: ... + subplot_tool: widgets.SubplotTool + def configure_subplots(self, *args): ... + def save_figure(self, *args) -> None: ... + def update(self) -> None: ... + def set_history_buttons(self) -> None: ... + +class ToolContainerBase: + toolmanager: ToolManager + def __init__(self, toolmanager: ToolManager) -> None: ... + def add_tool(self, tool: ToolBase, group: str, position: int = ...) -> None: ... + def trigger_tool(self, name: str) -> None: ... + def add_toolitem( + self, + name: str, + group: str, + position: int, + image: str, + description: str, + toggle: bool, + ) -> None: ... + def toggle_toolitem(self, name: str, toggled: bool) -> None: ... + def remove_toolitem(self, name: str) -> None: ... + def set_message(self, s: str) -> None: ... + +class _Backend: + backend_version: str + FigureCanvas: type[FigureCanvasBase] | None + FigureManager: type[FigureManagerBase] + mainloop: None | Callable[[], Any] + @classmethod + def new_figure_manager(cls, num: int | str, *args, **kwargs) -> FigureManagerBase: ... + @classmethod + def new_figure_manager_given_figure(cls, num: int | str, figure: Figure) -> FigureManagerBase: ... + @classmethod + def draw_if_interactive(cls) -> None: ... + @classmethod + def show(cls, *, block: bool | None = ...) -> None: ... + @staticmethod + def export(cls) -> type[_Backend]: ... + +class ShowBase(_Backend): + def __call__(self, block: bool | None = ...) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi b/contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi new file mode 100644 index 0000000000..9e59acb14e --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/backend_managers.pyi @@ -0,0 +1,64 @@ +from matplotlib import backend_tools, widgets +from matplotlib.backend_bases import FigureCanvasBase +from matplotlib.figure import Figure + +from collections.abc import Callable, Iterable +from typing import Any, TypeVar + +class ToolEvent: + name: str + sender: Any + tool: backend_tools.ToolBase + data: Any + def __init__(self, name, sender, tool, data: Any | None = ...) -> None: ... + +class ToolTriggerEvent(ToolEvent): + canvasevent: ToolEvent + def __init__( + self, + name, + sender, + tool, + canvasevent: ToolEvent | None = ..., + data: Any | None = ..., + ) -> None: ... + +class ToolManagerMessageEvent: + name: str + sender: Any + message: str + def __init__(self, name: str, sender: Any, message: str) -> None: ... + +class ToolManager: + keypresslock: widgets.LockDraw + messagelock: widgets.LockDraw + def __init__(self, figure: Figure | None = ...) -> None: ... + @property + def canvas(self) -> FigureCanvasBase | None: ... + @property + def figure(self) -> Figure | None: ... + @figure.setter + def figure(self, figure: Figure) -> None: ... + def set_figure(self, figure: Figure, update_tools: bool = ...) -> None: ... + def toolmanager_connect(self, s: str, func: Callable[[ToolEvent], Any]) -> int: ... + def toolmanager_disconnect(self, cid: int) -> None: ... + def message_event(self, message: str, sender: Any | None = ...) -> None: ... + @property + def active_toggle(self) -> dict[str | None, list[str] | str]: ... + def get_tool_keymap(self, name: str) -> list[str]: ... + def update_keymap(self, name: str, key: str | Iterable[str]) -> None: ... + def remove_tool(self, name: str) -> None: ... + _T = TypeVar("_T", bound=backend_tools.ToolBase) + def add_tool(self, name: str, tool: type[_T], *args, **kwargs) -> _T: ... + def trigger_tool( + self, + name: str | backend_tools.ToolBase, + sender: Any | None = ..., + canvasevent: ToolEvent | None = ..., + data: Any | None = ..., + ) -> None: ... + @property + def tools(self) -> dict[str, backend_tools.ToolBase]: ... + def get_tool( + self, name: str | backend_tools.ToolBase, warn: bool = ... + ) -> backend_tools.ToolBase | None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi b/contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi new file mode 100644 index 0000000000..446f713292 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/backend_tools.pyi @@ -0,0 +1,121 @@ +import enum +from matplotlib import cbook +from matplotlib.axes import Axes +from matplotlib.backend_bases import ToolContainerBase, FigureCanvasBase +from matplotlib.backend_managers import ToolManager, ToolEvent +from matplotlib.figure import Figure +from matplotlib.scale import ScaleBase + +from typing import Any + +class Cursors(enum.IntEnum): + POINTER: int + HAND: int + SELECT_REGION: int + MOVE: int + WAIT: int + RESIZE_HORIZONTAL: int + RESIZE_VERTICAL: int + +cursors = Cursors + +class ToolBase: + @property + def default_keymap(self) -> list[str] | None: ... + description: str | None + image: str | None + def __init__(self, toolmanager: ToolManager, name: str) -> None: ... + @property + def name(self) -> str: ... + @property + def toolmanager(self) -> ToolManager: ... + @property + def canvas(self) -> FigureCanvasBase | None: ... + @property + def figure(self) -> Figure | None: ... + @figure.setter + def figure(self, figure: Figure | None) -> None: ... + def set_figure(self, figure: Figure | None) -> None: ... + def trigger(self, sender: Any, event: ToolEvent, data: Any = ...) -> None: ... + +class ToolToggleBase(ToolBase): + radio_group: str | None + cursor: Cursors | None + default_toggled: bool + def __init__(self, *args, **kwargs) -> None: ... + def enable(self, event: ToolEvent | None = ...) -> None: ... + def disable(self, event: ToolEvent | None = ...) -> None: ... + @property + def toggled(self) -> bool: ... + def set_figure(self, figure: Figure | None) -> None: ... + +class ToolSetCursor(ToolBase): ... + +class ToolCursorPosition(ToolBase): + def send_message(self, event: ToolEvent) -> None: ... + +class RubberbandBase(ToolBase): + def draw_rubberband(self, *data) -> None: ... + def remove_rubberband(self) -> None: ... + +class ToolQuit(ToolBase): ... +class ToolQuitAll(ToolBase): ... +class ToolGrid(ToolBase): ... +class ToolMinorGrid(ToolBase): ... +class ToolFullScreen(ToolBase): ... + +class AxisScaleBase(ToolToggleBase): + def enable(self, event: ToolEvent | None = ...) -> None: ... + def disable(self, event: ToolEvent | None = ...) -> None: ... + +class ToolYScale(AxisScaleBase): + def set_scale(self, ax: Axes, scale: str | ScaleBase) -> None: ... + +class ToolXScale(AxisScaleBase): + def set_scale(self, ax, scale: str | ScaleBase) -> None: ... + +class ToolViewsPositions(ToolBase): + views: dict[Figure | Axes, cbook.Stack] + positions: dict[Figure | Axes, cbook.Stack] + home_views: dict[Figure, dict[Axes, tuple[float, float, float, float]]] + def add_figure(self, figure: Figure) -> None: ... + def clear(self, figure: Figure) -> None: ... + def update_view(self) -> None: ... + def push_current(self, figure: Figure | None = ...) -> None: ... + def update_home_views(self, figure: Figure | None = ...) -> None: ... + def home(self) -> None: ... + def back(self) -> None: ... + def forward(self) -> None: ... + +class ViewsPositionsBase(ToolBase): ... +class ToolHome(ViewsPositionsBase): ... +class ToolBack(ViewsPositionsBase): ... +class ToolForward(ViewsPositionsBase): ... +class ConfigureSubplotsBase(ToolBase): ... +class SaveFigureBase(ToolBase): ... + +class ZoomPanBase(ToolToggleBase): + base_scale: float + scrollthresh: float + lastscroll: float + def __init__(self, *args) -> None: ... + def enable(self, event: ToolEvent | None = ...) -> None: ... + def disable(self, event: ToolEvent | None = ...) -> None: ... + def scroll_zoom(self, event: ToolEvent) -> None: ... + +class ToolZoom(ZoomPanBase): ... +class ToolPan(ZoomPanBase): ... + +class ToolHelpBase(ToolBase): + @staticmethod + def format_shortcut(key_sequence: str) -> str: ... + +class ToolCopyToClipboardBase(ToolBase): ... + +default_tools: dict[str, ToolBase] +default_toolbar_tools: list[list[str | list[str]]] + +def add_tools_to_manager( + toolmanager: ToolManager, tools: dict[str, type[ToolBase]] = ... +) -> None: ... +def add_tools_to_container(container: ToolContainerBase, tools: list[Any] = ...) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi b/contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/backends/_backend_agg.pyi diff --git a/contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi b/contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/backends/_macosx.pyi diff --git a/contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi b/contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/backends/_tkagg.pyi diff --git a/contrib/python/matplotlib/py3/matplotlib/bezier.pyi b/contrib/python/matplotlib/py3/matplotlib/bezier.pyi new file mode 100644 index 0000000000..ad82b873af --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/bezier.pyi @@ -0,0 +1,74 @@ +from collections.abc import Callable +from typing import Literal + +import numpy as np +from numpy.typing import ArrayLike + +from .path import Path + +class NonIntersectingPathException(ValueError): ... + +def get_intersection( + cx1: float, + cy1: float, + cos_t1: float, + sin_t1: float, + cx2: float, + cy2: float, + cos_t2: float, + sin_t2: float, +) -> tuple[float, float]: ... +def get_normal_points( + cx: float, cy: float, cos_t: float, sin_t: float, length: float +) -> tuple[float, float, float, float]: ... +def split_de_casteljau(beta: ArrayLike, t: float) -> tuple[np.ndarray, np.ndarray]: ... +def find_bezier_t_intersecting_with_closedpath( + bezier_point_at_t: Callable[[float], tuple[float, float]], + inside_closedpath: Callable[[tuple[float, float]], bool], + t0: float = ..., + t1: float = ..., + tolerance: float = ..., +) -> tuple[float, float]: ... + +# TODO make generic over d, the dimension? ndarraydim +class BezierSegment: + def __init__(self, control_points: ArrayLike) -> None: ... + def __call__(self, t: ArrayLike) -> np.ndarray: ... + def point_at_t(self, t: float) -> tuple[float, ...]: ... + @property + def control_points(self) -> np.ndarray: ... + @property + def dimension(self) -> int: ... + @property + def degree(self) -> int: ... + @property + def polynomial_coefficients(self) -> np.ndarray: ... + def axis_aligned_extrema(self) -> tuple[np.ndarray, np.ndarray]: ... + +def split_bezier_intersecting_with_closedpath( + bezier: ArrayLike, + inside_closedpath: Callable[[tuple[float, float]], bool], + tolerance: float = ..., +) -> tuple[np.ndarray, np.ndarray]: ... +def split_path_inout( + path: Path, + inside: Callable[[tuple[float, float]], bool], + tolerance: float = ..., + reorder_inout: bool = ..., +) -> tuple[Path, Path]: ... +def inside_circle( + cx: float, cy: float, r: float +) -> Callable[[tuple[float, float]], bool]: ... +def get_cos_sin(x0: float, y0: float, x1: float, y1: float) -> tuple[float, float]: ... +def check_if_parallel( + dx1: float, dy1: float, dx2: float, dy2: float, tolerance: float = ... +) -> Literal[-1, False, 1]: ... +def get_parallels( + bezier2: ArrayLike, width: float +) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ... +def find_control_points( + c1x: float, c1y: float, mmx: float, mmy: float, c2x: float, c2y: float +) -> list[tuple[float, float]]: ... +def make_wedged_bezier2( + bezier2: ArrayLike, width: float, w1: float = ..., wm: float = ..., w2: float = ... +) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/cbook.pyi b/contrib/python/matplotlib/py3/matplotlib/cbook.pyi new file mode 100644 index 0000000000..227a23df41 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/cbook.pyi @@ -0,0 +1,175 @@ +import collections.abc +from collections.abc import Callable, Collection, Generator, Iterable, Iterator +import contextlib +import os +from pathlib import Path + +from matplotlib.artist import Artist + +import numpy as np +from numpy.typing import ArrayLike + +from typing import ( + Any, + Generic, + IO, + Literal, + TypeVar, + overload, +) + +_T = TypeVar("_T") + +def _get_running_interactive_framework() -> str | None: ... + +class CallbackRegistry: + exception_handler: Callable[[Exception], Any] + callbacks: dict[Any, dict[int, Any]] + def __init__( + self, + exception_handler: Callable[[Exception], Any] | None = ..., + *, + signals: Iterable[Any] | None = ..., + ) -> None: ... + def connect(self, signal: Any, func: Callable) -> int: ... + def disconnect(self, cid: int) -> None: ... + def process(self, s: Any, *args, **kwargs) -> None: ... + def blocked( + self, *, signal: Any | None = ... + ) -> contextlib.AbstractContextManager[None]: ... + +class silent_list(list[_T]): + type: str | None + def __init__(self, type: str | None, seq: Iterable[_T] | None = ...) -> None: ... + +def strip_math(s: str) -> str: ... +def is_writable_file_like(obj: Any) -> bool: ... +def file_requires_unicode(x: Any) -> bool: ... +@overload +def to_filehandle( + fname: str | os.PathLike | IO, + flag: str = ..., + return_opened: Literal[False] = ..., + encoding: str | None = ..., +) -> IO: ... +@overload +def to_filehandle( + fname: str | os.PathLike | IO, + flag: str, + return_opened: Literal[True], + encoding: str | None = ..., +) -> tuple[IO, bool]: ... +@overload +def to_filehandle( + fname: str | os.PathLike | IO, + *, # if flag given, will match previous sig + return_opened: Literal[True], + encoding: str | None = ..., +) -> tuple[IO, bool]: ... +def open_file_cm( + path_or_file: str | os.PathLike | IO, + mode: str = ..., + encoding: str | None = ..., +) -> contextlib.AbstractContextManager[IO]: ... +def is_scalar_or_string(val: Any) -> bool: ... +@overload +def get_sample_data( + fname: str | os.PathLike, asfileobj: Literal[True] = ..., *, np_load: Literal[True] +) -> np.ndarray: ... +@overload +def get_sample_data( + fname: str | os.PathLike, + asfileobj: Literal[True] = ..., + *, + np_load: Literal[False] = ..., +) -> IO: ... +@overload +def get_sample_data( + fname: str | os.PathLike, asfileobj: Literal[False], *, np_load: bool = ... +) -> str: ... +def _get_data_path(*args: Path | str) -> Path: ... +def flatten( + seq: Iterable[Any], scalarp: Callable[[Any], bool] = ... +) -> Generator[Any, None, None]: ... + +class Stack(Generic[_T]): + def __init__(self, default: _T | None = ...) -> None: ... + def __call__(self) -> _T: ... + def __len__(self) -> int: ... + def __getitem__(self, ind: int) -> _T: ... + def forward(self) -> _T: ... + def back(self) -> _T: ... + def push(self, o: _T) -> _T: ... + def home(self) -> _T: ... + def empty(self) -> bool: ... + def clear(self) -> None: ... + def bubble(self, o: _T) -> _T: ... + def remove(self, o: _T) -> None: ... + +def safe_masked_invalid(x: ArrayLike, copy: bool = ...) -> np.ndarray: ... +def print_cycles( + objects: Iterable[Any], outstream: IO = ..., show_progress: bool = ... +) -> None: ... + +class Grouper(Generic[_T]): + def __init__(self, init: Iterable[_T] = ...) -> None: ... + def __contains__(self, item: _T) -> bool: ... + def clean(self) -> None: ... + def join(self, a: _T, *args: _T) -> None: ... + def joined(self, a: _T, b: _T) -> bool: ... + def remove(self, a: _T) -> None: ... + def __iter__(self) -> Iterator[list[_T]]: ... + def get_siblings(self, a: _T) -> list[_T]: ... + +class GrouperView(Generic[_T]): + def __init__(self, grouper: Grouper[_T]) -> None: ... + def __contains__(self, item: _T) -> bool: ... + def __iter__(self) -> Iterator[list[_T]]: ... + def joined(self, a: _T, b: _T) -> bool: ... + def get_siblings(self, a: _T) -> list[_T]: ... + +def simple_linear_interpolation(a: ArrayLike, steps: int) -> np.ndarray: ... +def delete_masked_points(*args): ... +def boxplot_stats( + X: ArrayLike, + whis: float | tuple[float, float] = ..., + bootstrap: int | None = ..., + labels: ArrayLike | None = ..., + autorange: bool = ..., +) -> list[dict[str, Any]]: ... + +ls_mapper: dict[str, str] +ls_mapper_r: dict[str, str] + +def contiguous_regions(mask: ArrayLike) -> list[np.ndarray]: ... +def is_math_text(s: str) -> bool: ... +def violin_stats( + X: ArrayLike, method: Callable, points: int = ..., quantiles: ArrayLike | None = ... +) -> list[dict[str, Any]]: ... +def pts_to_prestep(x: ArrayLike, *args: ArrayLike) -> np.ndarray: ... +def pts_to_poststep(x: ArrayLike, *args: ArrayLike) -> np.ndarray: ... +def pts_to_midstep(x: np.ndarray, *args: np.ndarray) -> np.ndarray: ... + +STEP_LOOKUP_MAP: dict[str, Callable] + +def index_of(y: float | ArrayLike) -> tuple[np.ndarray, np.ndarray]: ... +def safe_first_element(obj: Collection[_T]) -> _T: ... +def sanitize_sequence(data): ... +def normalize_kwargs( + kw: dict[str, Any], + alias_mapping: dict[str, list[str]] | type[Artist] | Artist | None = ..., +) -> dict[str, Any]: ... +def _lock_path(path: str | os.PathLike) -> contextlib.AbstractContextManager[None]: ... +def _str_equal(obj: Any, s: str) -> bool: ... +def _setattr_cm(obj: Any, **kwargs) -> contextlib.AbstractContextManager[None]: ... + +class _OrderedSet(collections.abc.MutableSet): + def __init__(self) -> None: ... + def __contains__(self, key) -> bool: ... + def __iter__(self): ... + def __len__(self) -> int: ... + def add(self, key) -> None: ... + def discard(self, key) -> None: ... + +def _backend_module_name(name: str) -> str: ... +def _format_approx(number: float, precision: int) -> str: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/cm.pyi b/contrib/python/matplotlib/py3/matplotlib/cm.pyi new file mode 100644 index 0000000000..be8f10b39c --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/cm.pyi @@ -0,0 +1,54 @@ +from collections.abc import Iterator, Mapping +from matplotlib import cbook, colors +from matplotlib.colorbar import Colorbar + +import numpy as np +from numpy.typing import ArrayLike + +class ColormapRegistry(Mapping[str, colors.Colormap]): + def __init__(self, cmaps: Mapping[str, colors.Colormap]) -> None: ... + def __getitem__(self, item: str) -> colors.Colormap: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def __call__(self) -> list[str]: ... + def register( + self, cmap: colors.Colormap, *, name: str | None = ..., force: bool = ... + ) -> None: ... + def unregister(self, name: str) -> None: ... + def get_cmap(self, cmap: str | colors.Colormap) -> colors.Colormap: ... + +_colormaps: ColormapRegistry = ... + +def get_cmap(name: str | colors.Colormap | None = ..., lut: int | None = ...) -> colors.Colormap: ... + +class ScalarMappable: + cmap: colors.Colormap | None + colorbar: Colorbar | None + callbacks: cbook.CallbackRegistry + def __init__( + self, + norm: colors.Normalize | None = ..., + cmap: str | colors.Colormap | None = ..., + ) -> None: ... + def to_rgba( + self, + x: np.ndarray, + alpha: float | ArrayLike | None = ..., + bytes: bool = ..., + norm: bool = ..., + ) -> np.ndarray: ... + def set_array(self, A: ArrayLike | None) -> None: ... + def get_array(self) -> np.ndarray | None: ... + def get_cmap(self) -> colors.Colormap: ... + def get_clim(self) -> tuple[float, float]: ... + def set_clim(self, vmin: float | tuple[float, float] | None = ..., vmax: float | None = ...) -> None: ... + def get_alpha(self) -> float | None: ... + def set_cmap(self, cmap: str | colors.Colormap) -> None: ... + @property + def norm(self) -> colors.Normalize: ... + @norm.setter + def norm(self, norm: colors.Normalize | str | None) -> None: ... + def set_norm(self, norm: colors.Normalize | str | None) -> None: ... + def autoscale(self) -> None: ... + def autoscale_None(self) -> None: ... + def changed(self) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/collections.pyi b/contrib/python/matplotlib/py3/matplotlib/collections.pyi new file mode 100644 index 0000000000..01682a55b3 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/collections.pyi @@ -0,0 +1,242 @@ +from collections.abc import Callable, Iterable, Sequence +from typing import Literal + +import numpy as np +from numpy.typing import ArrayLike, NDArray + +from . import artist, cm, transforms +from .backend_bases import MouseEvent +from .artist import Artist +from .colors import Normalize, Colormap +from .lines import Line2D +from .path import Path +from .patches import Patch +from .ticker import Locator, Formatter +from .tri import Triangulation +from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType + +class Collection(artist.Artist, cm.ScalarMappable): + def __init__( + self, + *, + edgecolors: ColorType | Sequence[ColorType] | None = ..., + facecolors: ColorType | Sequence[ColorType] | None = ..., + linewidths: float | Sequence[float] | None = ..., + linestyles: LineStyleType | Sequence[LineStyleType] = ..., + capstyle: CapStyleType | None = ..., + joinstyle: JoinStyleType | None = ..., + antialiaseds: bool | Sequence[bool] | None = ..., + offsets: tuple[float, float] | Sequence[tuple[float, float]] | None = ..., + offset_transform: transforms.Transform | None = ..., + norm: Normalize | None = ..., + cmap: Colormap | None = ..., + pickradius: float = ..., + hatch: str | None = ..., + urls: Sequence[str] | None = ..., + zorder: float = ..., + **kwargs + ) -> None: ... + def get_paths(self) -> Sequence[Path]: ... + def set_paths(self, paths: Sequence[Path]) -> None: ... + def get_transforms(self) -> Sequence[transforms.Transform]: ... + def get_offset_transform(self) -> transforms.Transform: ... + def set_offset_transform(self, offset_transform: transforms.Transform) -> None: ... + def get_datalim(self, transData: transforms.Transform) -> transforms.Bbox: ... + def set_pickradius(self, pickradius: float) -> None: ... + def get_pickradius(self) -> float: ... + def set_urls(self, urls: Sequence[str | None]) -> None: ... + def get_urls(self) -> Sequence[str | None]: ... + def set_hatch(self, hatch: str) -> None: ... + def get_hatch(self) -> str: ... + def set_offsets(self, offsets: ArrayLike) -> None: ... + def get_offsets(self) -> ArrayLike: ... + def set_linewidth(self, lw: float | Sequence[float]) -> None: ... + def set_linestyle(self, ls: LineStyleType | Sequence[LineStyleType]) -> None: ... + def set_capstyle(self, cs: CapStyleType) -> None: ... + def get_capstyle(self) -> Literal["butt", "projecting", "round"] | None: ... + def set_joinstyle(self, js: JoinStyleType) -> None: ... + def get_joinstyle(self) -> Literal["miter", "round", "bevel"] | None: ... + def set_antialiased(self, aa: bool | Sequence[bool]) -> None: ... + def get_antialiased(self) -> NDArray[np.bool_]: ... + def set_color(self, c: ColorType | Sequence[ColorType]) -> None: ... + def set_facecolor(self, c: ColorType | Sequence[ColorType]) -> None: ... + def get_facecolor(self) -> ColorType | Sequence[ColorType]: ... + def get_edgecolor(self) -> ColorType | Sequence[ColorType]: ... + def set_edgecolor(self, c: ColorType | Sequence[ColorType]) -> None: ... + def set_alpha(self, alpha: float | Sequence[float] | None) -> None: ... + def get_linewidth(self) -> float | Sequence[float]: ... + def get_linestyle(self) -> LineStyleType | Sequence[LineStyleType]: ... + def update_scalarmappable(self) -> None: ... + def get_fill(self) -> bool: ... + def update_from(self, other: Artist) -> None: ... + +class _CollectionWithSizes(Collection): + def get_sizes(self) -> np.ndarray: ... + def set_sizes(self, sizes: ArrayLike | None, dpi: float = ...) -> None: ... + +class PathCollection(_CollectionWithSizes): + def __init__( + self, paths: Sequence[Path], sizes: ArrayLike | None = ..., **kwargs + ) -> None: ... + def set_paths(self, paths: Sequence[Path]) -> None: ... + def get_paths(self) -> Sequence[Path]: ... + def legend_elements( + self, + prop: Literal["colors", "sizes"] = ..., + num: int | Literal["auto"] | ArrayLike | Locator = ..., + fmt: str | Formatter | None = ..., + func: Callable[[ArrayLike], ArrayLike] = ..., + **kwargs, + ) -> tuple[list[Line2D], list[str]]: ... + +class PolyCollection(_CollectionWithSizes): + def __init__( + self, + verts: Sequence[ArrayLike], + sizes: ArrayLike | None = ..., + *, + closed: bool = ..., + **kwargs + ) -> None: ... + def set_verts( + self, verts: Sequence[ArrayLike | Path], closed: bool = ... + ) -> None: ... + def set_paths(self, verts: Sequence[Path], closed: bool = ...) -> None: ... + def set_verts_and_codes( + self, verts: Sequence[ArrayLike | Path], codes: Sequence[int] + ) -> None: ... + +class BrokenBarHCollection(PolyCollection): + def __init__( + self, + xranges: Iterable[tuple[float, float]], + yrange: tuple[float, float], + **kwargs + ) -> None: ... + @classmethod + def span_where( + cls, x: ArrayLike, ymin: float, ymax: float, where: ArrayLike, **kwargs + ) -> BrokenBarHCollection: ... + +class RegularPolyCollection(_CollectionWithSizes): + def __init__( + self, numsides: int, *, rotation: float = ..., sizes: ArrayLike = ..., **kwargs + ) -> None: ... + def get_numsides(self) -> int: ... + def get_rotation(self) -> float: ... + +class StarPolygonCollection(RegularPolyCollection): ... +class AsteriskPolygonCollection(RegularPolyCollection): ... + +class LineCollection(Collection): + def __init__( + self, segments: Sequence[ArrayLike], *, zorder: float = ..., **kwargs + ) -> None: ... + def set_segments(self, segments: Sequence[ArrayLike] | None) -> None: ... + def set_verts(self, segments: Sequence[ArrayLike] | None) -> None: ... + def set_paths(self, segments: Sequence[ArrayLike] | None) -> None: ... # type: ignore[override] + def get_segments(self) -> list[np.ndarray]: ... + def set_color(self, c: ColorType | Sequence[ColorType]) -> None: ... + def set_colors(self, c: ColorType | Sequence[ColorType]) -> None: ... + def set_gapcolor(self, gapcolor: ColorType | Sequence[ColorType] | None) -> None: ... + def get_color(self) -> ColorType | Sequence[ColorType]: ... + def get_colors(self) -> ColorType | Sequence[ColorType]: ... + def get_gapcolor(self) -> ColorType | Sequence[ColorType] | None: ... + + +class EventCollection(LineCollection): + def __init__( + self, + positions: ArrayLike, + orientation: Literal["horizontal", "vertical"] = ..., + *, + lineoffset: float = ..., + linelength: float = ..., + linewidth: float | Sequence[float] | None = ..., + color: ColorType | Sequence[ColorType] | None = ..., + linestyle: LineStyleType | Sequence[LineStyleType] = ..., + antialiased: bool | Sequence[bool] | None = ..., + **kwargs + ) -> None: ... + def get_positions(self) -> list[float]: ... + def set_positions(self, positions: Sequence[float] | None) -> None: ... + def add_positions(self, position: Sequence[float] | None) -> None: ... + def extend_positions(self, position: Sequence[float] | None) -> None: ... + def append_positions(self, position: Sequence[float] | None) -> None: ... + def is_horizontal(self) -> bool: ... + def get_orientation(self) -> Literal["horizontal", "vertical"]: ... + def switch_orientation(self) -> None: ... + def set_orientation( + self, orientation: Literal["horizontal", "vertical"] + ) -> None: ... + def get_linelength(self) -> float | Sequence[float]: ... + def set_linelength(self, linelength: float | Sequence[float]) -> None: ... + def get_lineoffset(self) -> float: ... + def set_lineoffset(self, lineoffset: float) -> None: ... + def get_linewidth(self) -> float: ... + def get_linewidths(self) -> Sequence[float]: ... + def get_color(self) -> ColorType: ... + +class CircleCollection(_CollectionWithSizes): + def __init__(self, sizes: float | ArrayLike, **kwargs) -> None: ... + +class EllipseCollection(Collection): + def __init__( + self, + widths: ArrayLike, + heights: ArrayLike, + angles: ArrayLike, + *, + units: Literal[ + "points", "inches", "dots", "width", "height", "x", "y", "xy" + ] = ..., + **kwargs + ) -> None: ... + +class PatchCollection(Collection): + def __init__( + self, patches: Iterable[Patch], *, match_original: bool = ..., **kwargs + ) -> None: ... + def set_paths(self, patches: Iterable[Patch]) -> None: ... # type: ignore[override] + +class TriMesh(Collection): + def __init__(self, triangulation: Triangulation, **kwargs) -> None: ... + def get_paths(self) -> list[Path]: ... + # Parent class has an argument, perhaps add a noop arg? + def set_paths(self) -> None: ... # type: ignore[override] + @staticmethod + def convert_mesh_to_paths(tri: Triangulation) -> list[Path]: ... + +class _MeshData: + def __init__( + self, + coordinates: ArrayLike, + *, + shading: Literal["flat", "gouraud"] = ..., + ) -> None: ... + def set_array(self, A: ArrayLike | None) -> None: ... + def get_coordinates(self) -> ArrayLike: ... + def get_facecolor(self) -> ColorType | Sequence[ColorType]: ... + def get_edgecolor(self) -> ColorType | Sequence[ColorType]: ... + +class QuadMesh(_MeshData, Collection): + def __init__( + self, + coordinates: ArrayLike, + *, + antialiased: bool = ..., + shading: Literal["flat", "gouraud"] = ..., + **kwargs + ) -> None: ... + def get_paths(self) -> list[Path]: ... + # Parent class has an argument, perhaps add a noop arg? + def set_paths(self) -> None: ... # type: ignore[override] + def get_datalim(self, transData: transforms.Transform) -> transforms.Bbox: ... + def get_cursor_data(self, event: MouseEvent) -> float: ... + +class PolyQuadMesh(_MeshData, PolyCollection): + def __init__( + self, + coordinates: ArrayLike, + **kwargs + ) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/colorbar.pyi b/contrib/python/matplotlib/py3/matplotlib/colorbar.pyi new file mode 100644 index 0000000000..f71c5759fc --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/colorbar.pyi @@ -0,0 +1,136 @@ +import matplotlib.spines as mspines +from matplotlib import cm, collections, colors, contour +from matplotlib.axes import Axes +from matplotlib.backend_bases import RendererBase +from matplotlib.patches import Patch +from matplotlib.ticker import Locator, Formatter +from matplotlib.transforms import Bbox + +import numpy as np +from numpy.typing import ArrayLike +from collections.abc import Sequence +from typing import Any, Literal, overload +from .typing import ColorType + +class _ColorbarSpine(mspines.Spines): + def __init__(self, axes: Axes): ... + def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox:... + def set_xy(self, xy: ArrayLike) -> None: ... + def draw(self, renderer: RendererBase | None) -> None:... + + +class Colorbar: + n_rasterize: int + mappable: cm.ScalarMappable + ax: Axes + alpha: float | None + cmap: colors.Colormap + norm: colors.Normalize + values: Sequence[float] | None + boundaries: Sequence[float] | None + extend: Literal["neither", "both", "min", "max"] + spacing: Literal["uniform", "proportional"] + orientation: Literal["vertical", "horizontal"] + drawedges: bool + extendfrac: Literal["auto"] | float | Sequence[float] | None + extendrect: bool + solids: None | collections.QuadMesh + solids_patches: list[Patch] + lines: list[collections.LineCollection] + outline: _ColorbarSpine + dividers: collections.LineCollection + ticklocation: Literal["left", "right", "top", "bottom"] + def __init__( + self, + ax: Axes, + mappable: cm.ScalarMappable | None = ..., + *, + cmap: str | colors.Colormap | None = ..., + norm: colors.Normalize | None = ..., + alpha: float | None = ..., + values: Sequence[float] | None = ..., + boundaries: Sequence[float] | None = ..., + orientation: Literal["vertical", "horizontal"] | None = ..., + ticklocation: Literal["auto", "left", "right", "top", "bottom"] = ..., + extend: Literal["neither", "both", "min", "max"] | None = ..., + spacing: Literal["uniform", "proportional"] = ..., + ticks: Sequence[float] | Locator | None = ..., + format: str | Formatter | None = ..., + drawedges: bool = ..., + extendfrac: Literal["auto"] | float | Sequence[float] | None = ..., + extendrect: bool = ..., + label: str = ..., + location: Literal["left", "right", "top", "bottom"] | None = ... + ) -> None: ... + @property + def locator(self) -> Locator: ... + @locator.setter + def locator(self, loc: Locator) -> None: ... + @property + def minorlocator(self) -> Locator: ... + @minorlocator.setter + def minorlocator(self, loc: Locator) -> None: ... + @property + def formatter(self) -> Formatter: ... + @formatter.setter + def formatter(self, fmt: Formatter) -> None: ... + @property + def minorformatter(self) -> Formatter: ... + @minorformatter.setter + def minorformatter(self, fmt: Formatter) -> None: ... + def update_normal(self, mappable: cm.ScalarMappable) -> None: ... + @overload + def add_lines(self, CS: contour.ContourSet, erase: bool = ...) -> None: ... + @overload + def add_lines( + self, + levels: ArrayLike, + colors: ColorType | Sequence[ColorType], + linewidths: float | ArrayLike, + erase: bool = ..., + ) -> None: ... + def update_ticks(self) -> None: ... + def set_ticks( + self, + ticks: Sequence[float] | Locator, + *, + labels: Sequence[str] | None = ..., + minor: bool = ..., + **kwargs + ) -> None: ... + def get_ticks(self, minor: bool = ...) -> np.ndarray: ... + def set_ticklabels( + self, + ticklabels: Sequence[str], + *, + minor: bool = ..., + **kwargs + ) -> None: ... + def minorticks_on(self) -> None: ... + def minorticks_off(self) -> None: ... + def set_label(self, label: str, *, loc: str | None = ..., **kwargs) -> None: ... + def set_alpha(self, alpha: float | np.ndarray) -> None: ... + def remove(self) -> None: ... + def drag_pan(self, button: Any, key: Any, x: float, y: float) -> None: ... + +ColorbarBase = Colorbar + +def make_axes( + parents: Axes | list[Axes] | np.ndarray, + location: Literal["left", "right", "top", "bottom"] | None = ..., + orientation: Literal["vertical", "horizontal"] | None = ..., + fraction: float = ..., + shrink: float = ..., + aspect: float = ..., + **kwargs +) -> tuple[Axes, dict[str, Any]]: ... +def make_axes_gridspec( + parent: Axes, + *, + location: Literal["left", "right", "top", "bottom"] | None = ..., + orientation: Literal["vertical", "horizontal"] | None = ..., + fraction: float = ..., + shrink: float = ..., + aspect: float = ..., + **kwargs +) -> tuple[Axes, dict[str, Any]]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/colors.pyi b/contrib/python/matplotlib/py3/matplotlib/colors.pyi new file mode 100644 index 0000000000..9bb1725f4f --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/colors.pyi @@ -0,0 +1,354 @@ +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from matplotlib import cbook, scale +import re + +from typing import Any, Literal, overload +from .typing import ColorType + +import numpy as np +from numpy.typing import ArrayLike + +# Explicitly export colors dictionaries which are imported in the impl +BASE_COLORS: dict[str, ColorType] +CSS4_COLORS: dict[str, ColorType] +TABLEAU_COLORS: dict[str, ColorType] +XKCD_COLORS: dict[str, ColorType] + +class _ColorMapping(dict[str, ColorType]): + cache: dict[tuple[ColorType, float | None], tuple[float, float, float, float]] + def __init__(self, mapping) -> None: ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + +def get_named_colors_mapping() -> _ColorMapping: ... + +class ColorSequenceRegistry(Mapping): + def __init__(self) -> None: ... + def __getitem__(self, item: str) -> list[ColorType]: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def register(self, name: str, color_list: Iterable[ColorType]) -> None: ... + def unregister(self, name: str) -> None: ... + +_color_sequences: ColorSequenceRegistry = ... + +def is_color_like(c: Any) -> bool: ... +def same_color(c1: ColorType, c2: ColorType) -> bool: ... +def to_rgba( + c: ColorType, alpha: float | None = ... +) -> tuple[float, float, float, float]: ... +def to_rgba_array( + c: ColorType | ArrayLike, alpha: float | ArrayLike | None = ... +) -> np.ndarray: ... +def to_rgb(c: ColorType) -> tuple[float, float, float]: ... +def to_hex(c: ColorType, keep_alpha: bool = ...) -> str: ... + +cnames: dict[str, ColorType] +hexColorPattern: re.Pattern +rgb2hex = to_hex +hex2color = to_rgb + +class ColorConverter: + colors: _ColorMapping + cache: dict[tuple[ColorType, float | None], tuple[float, float, float, float]] + @staticmethod + def to_rgb(c: ColorType) -> tuple[float, float, float]: ... + @staticmethod + def to_rgba( + c: ColorType, alpha: float | None = ... + ) -> tuple[float, float, float, float]: ... + @staticmethod + def to_rgba_array( + c: ColorType | ArrayLike, alpha: float | ArrayLike | None = ... + ) -> np.ndarray: ... + +colorConverter: ColorConverter + +class Colormap: + name: str + N: int + colorbar_extend: bool + def __init__(self, name: str, N: int = ...) -> None: ... + @overload + def __call__( + self, X: Sequence[float] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ... + ) -> np.ndarray: ... + @overload + def __call__( + self, X: float, alpha: float | None = ..., bytes: bool = ... + ) -> tuple[float, float, float, float]: ... + @overload + def __call__( + self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ... + ) -> tuple[float, float, float, float] | np.ndarray: ... + def __copy__(self) -> Colormap: ... + def __eq__(self, other: object) -> bool: ... + def get_bad(self) -> np.ndarray: ... + def set_bad(self, color: ColorType = ..., alpha: float | None = ...) -> None: ... + def get_under(self) -> np.ndarray: ... + def set_under(self, color: ColorType = ..., alpha: float | None = ...) -> None: ... + def get_over(self) -> np.ndarray: ... + def set_over(self, color: ColorType = ..., alpha: float | None = ...) -> None: ... + def set_extremes( + self, + *, + bad: ColorType | None = ..., + under: ColorType | None = ..., + over: ColorType | None = ... + ) -> None: ... + def with_extremes( + self, + *, + bad: ColorType | None = ..., + under: ColorType | None = ..., + over: ColorType | None = ... + ) -> Colormap: ... + def is_gray(self) -> bool: ... + def resampled(self, lutsize: int) -> Colormap: ... + def reversed(self, name: str | None = ...) -> Colormap: ... + def _repr_html_(self) -> str: ... + def _repr_png_(self) -> bytes: ... + def copy(self) -> Colormap: ... + +class LinearSegmentedColormap(Colormap): + monochrome: bool + def __init__( + self, + name: str, + segmentdata: dict[ + Literal["red", "green", "blue", "alpha"], Sequence[tuple[float, ...]] + ], + N: int = ..., + gamma: float = ..., + ) -> None: ... + def set_gamma(self, gamma: float) -> None: ... + @staticmethod + def from_list( + name: str, colors: ArrayLike, N: int = ..., gamma: float = ... + ) -> LinearSegmentedColormap: ... + def resampled(self, lutsize: int) -> LinearSegmentedColormap: ... + def reversed(self, name: str | None = ...) -> LinearSegmentedColormap: ... + +class ListedColormap(Colormap): + monochrome: bool + colors: ArrayLike | ColorType + def __init__( + self, colors: ArrayLike | ColorType, name: str = ..., N: int | None = ... + ) -> None: ... + def resampled(self, lutsize: int) -> ListedColormap: ... + def reversed(self, name: str | None = ...) -> ListedColormap: ... + +class Normalize: + callbacks: cbook.CallbackRegistry + def __init__( + self, vmin: float | None = ..., vmax: float | None = ..., clip: bool = ... + ) -> None: ... + @property + def vmin(self) -> float | None: ... + @vmin.setter + def vmin(self, value: float | None) -> None: ... + @property + def vmax(self) -> float | None: ... + @vmax.setter + def vmax(self, value: float | None) -> None: ... + @property + def clip(self) -> bool: ... + @clip.setter + def clip(self, value: bool) -> None: ... + @staticmethod + def process_value(value: ArrayLike) -> tuple[np.ma.MaskedArray, bool]: ... + @overload + def __call__(self, value: float, clip: bool | None = ...) -> float: ... + @overload + def __call__(self, value: np.ndarray, clip: bool | None = ...) -> np.ma.MaskedArray: ... + @overload + def __call__(self, value: ArrayLike, clip: bool | None = ...) -> ArrayLike: ... + @overload + def inverse(self, value: float) -> float: ... + @overload + def inverse(self, value: np.ndarray) -> np.ma.MaskedArray: ... + @overload + def inverse(self, value: ArrayLike) -> ArrayLike: ... + def autoscale(self, A: ArrayLike) -> None: ... + def autoscale_None(self, A: ArrayLike) -> None: ... + def scaled(self) -> bool: ... + +class TwoSlopeNorm(Normalize): + def __init__( + self, vcenter: float, vmin: float | None = ..., vmax: float | None = ... + ) -> None: ... + @property + def vcenter(self) -> float: ... + @vcenter.setter + def vcenter(self, value: float) -> None: ... + def autoscale_None(self, A: ArrayLike) -> None: ... + +class CenteredNorm(Normalize): + def __init__( + self, vcenter: float = ..., halfrange: float | None = ..., clip: bool = ... + ) -> None: ... + @property + def vcenter(self) -> float: ... + @vcenter.setter + def vcenter(self, vcenter: float) -> None: ... + @property + def halfrange(self) -> float: ... + @halfrange.setter + def halfrange(self, halfrange: float) -> None: ... + +@overload +def make_norm_from_scale( + scale_cls: type[scale.ScaleBase], + base_norm_cls: type[Normalize], + *, + init: Callable | None = ... +) -> type[Normalize]: ... +@overload +def make_norm_from_scale( + scale_cls: type[scale.ScaleBase], + base_norm_cls: None = ..., + *, + init: Callable | None = ... +) -> Callable[[type[Normalize]], type[Normalize]]: ... + +class FuncNorm(Normalize): + def __init__( + self, + functions: tuple[Callable, Callable], + vmin: float | None = ..., + vmax: float | None = ..., + clip: bool = ..., + ) -> None: ... +class LogNorm(Normalize): ... + +class SymLogNorm(Normalize): + def __init__( + self, + linthresh: float, + linscale: float = ..., + vmin: float | None = ..., + vmax: float | None = ..., + clip: bool = ..., + *, + base: float = ..., + ) -> None: ... + @property + def linthresh(self) -> float: ... + @linthresh.setter + def linthresh(self, value: float) -> None: ... + +class AsinhNorm(Normalize): + def __init__( + self, + linear_width: float = ..., + vmin: float | None = ..., + vmax: float | None = ..., + clip: bool = ..., + ) -> None: ... + @property + def linear_width(self) -> float: ... + @linear_width.setter + def linear_width(self, value: float) -> None: ... + +class PowerNorm(Normalize): + gamma: float + def __init__( + self, + gamma: float, + vmin: float | None = ..., + vmax: float | None = ..., + clip: bool = ..., + ) -> None: ... + +class BoundaryNorm(Normalize): + boundaries: np.ndarray + N: int + Ncmap: int + extend: Literal["neither", "both", "min", "max"] + def __init__( + self, + boundaries: ArrayLike, + ncolors: int, + clip: bool = ..., + *, + extend: Literal["neither", "both", "min", "max"] = ... + ) -> None: ... + +class NoNorm(Normalize): ... + +def rgb_to_hsv(arr: ArrayLike) -> np.ndarray: ... +def hsv_to_rgb(hsv: ArrayLike) -> np.ndarray: ... + +class LightSource: + azdeg: float + altdeg: float + hsv_min_val: float + hsv_max_val: float + hsv_min_sat: float + hsv_max_sat: float + def __init__( + self, + azdeg: float = ..., + altdeg: float = ..., + hsv_min_val: float = ..., + hsv_max_val: float = ..., + hsv_min_sat: float = ..., + hsv_max_sat: float = ..., + ) -> None: ... + @property + def direction(self) -> np.ndarray: ... + def hillshade( + self, + elevation: ArrayLike, + vert_exag: float = ..., + dx: float = ..., + dy: float = ..., + fraction: float = ..., + ) -> np.ndarray: ... + def shade_normals( + self, normals: np.ndarray, fraction: float = ... + ) -> np.ndarray: ... + def shade( + self, + data: ArrayLike, + cmap: Colormap, + norm: Normalize | None = ..., + blend_mode: Literal["hsv", "overlay", "soft"] | Callable = ..., + vmin: float | None = ..., + vmax: float | None = ..., + vert_exag: float = ..., + dx: float = ..., + dy: float = ..., + fraction: float = ..., + **kwargs + ) -> np.ndarray: ... + def shade_rgb( + self, + rgb: ArrayLike, + elevation: ArrayLike, + fraction: float = ..., + blend_mode: Literal["hsv", "overlay", "soft"] | Callable = ..., + vert_exag: float = ..., + dx: float = ..., + dy: float = ..., + **kwargs + ) -> np.ndarray: ... + def blend_hsv( + self, + rgb: ArrayLike, + intensity: ArrayLike, + hsv_max_sat: float | None = ..., + hsv_max_val: float | None = ..., + hsv_min_val: float | None = ..., + hsv_min_sat: float | None = ..., + ) -> ArrayLike: ... + def blend_soft_light( + self, rgb: np.ndarray, intensity: np.ndarray + ) -> np.ndarray: ... + def blend_overlay(self, rgb: np.ndarray, intensity: np.ndarray) -> np.ndarray: ... + +def from_levels_and_colors( + levels: Sequence[float], + colors: Sequence[ColorType], + extend: Literal["neither", "min", "max", "both"] = ..., +) -> tuple[ListedColormap, BoundaryNorm]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/container.pyi b/contrib/python/matplotlib/py3/matplotlib/container.pyi new file mode 100644 index 0000000000..9cc2e1ac2a --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/container.pyi @@ -0,0 +1,56 @@ +from matplotlib.artist import Artist +from matplotlib.lines import Line2D +from matplotlib.collections import LineCollection +from matplotlib.patches import Rectangle + +from collections.abc import Callable +from typing import Any, Literal +from numpy.typing import ArrayLike + +class Container(tuple): + def __new__(cls, *args, **kwargs): ... + def __init__(self, kl, label: Any | None = ...) -> None: ... + def remove(self) -> None: ... + def get_children(self) -> list[Artist]: ... + def get_label(self) -> str | None: ... + def set_label(self, s: Any) -> None: ... + def add_callback(self, func: Callable[[Artist], Any]) -> int: ... + def remove_callback(self, oid: int) -> None: ... + def pchanged(self) -> None: ... + +class BarContainer(Container): + patches: list[Rectangle] + errorbar: None | ErrorbarContainer + datavalues: None | ArrayLike + orientation: None | Literal["vertical", "horizontal"] + def __init__( + self, + patches: list[Rectangle], + errorbar: ErrorbarContainer | None = ..., + *, + datavalues: ArrayLike | None = ..., + orientation: Literal["vertical", "horizontal"] | None = ..., + **kwargs + ) -> None: ... + +class ErrorbarContainer(Container): + lines: tuple[Line2D, Line2D, LineCollection] + has_xerr: bool + has_yerr: bool + def __init__( + self, + lines: tuple[Line2D, Line2D, LineCollection], + has_xerr: bool = ..., + has_yerr: bool = ..., + **kwargs + ) -> None: ... + +class StemContainer(Container): + markerline: Line2D + stemlines: LineCollection + baseline: Line2D + def __init__( + self, + markerline_stemlines_baseline: tuple[Line2D, LineCollection, Line2D], + **kwargs + ) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/contour.pyi b/contrib/python/matplotlib/py3/matplotlib/contour.pyi new file mode 100644 index 0000000000..d7bddfe8f1 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/contour.pyi @@ -0,0 +1,169 @@ +import matplotlib.cm as cm +from matplotlib.artist import Artist +from matplotlib.axes import Axes +from matplotlib.collections import Collection, PathCollection +from matplotlib.colors import Colormap, Normalize +from matplotlib.font_manager import FontProperties +from matplotlib.path import Path +from matplotlib.patches import Patch +from matplotlib.text import Text +from matplotlib.transforms import Transform, TransformedPatchPath, TransformedPath +from matplotlib.ticker import Locator, Formatter + +from numpy.typing import ArrayLike +import numpy as np +from collections.abc import Callable, Iterable, Sequence +from typing import Literal +from .typing import ColorType + +class ClabelText(Text): ... + +class ContourLabeler: + labelFmt: str | Formatter | Callable[[float], str] | dict[float, str] + labelManual: bool | Iterable[tuple[float, float]] + rightside_up: bool + labelLevelList: list[float] + labelIndiceList: list[int] + labelMappable: cm.ScalarMappable + labelCValueList: list[ColorType] + labelXYs: list[tuple[float, float]] + def clabel( + self, + levels: ArrayLike | None = ..., + *, + fontsize: str | float | None = ..., + inline: bool = ..., + inline_spacing: float = ..., + fmt: str | Formatter | Callable[[float], str] | dict[float, str] | None = ..., + colors: ColorType | Sequence[ColorType] | None = ..., + use_clabeltext: bool = ..., + manual: bool | Iterable[tuple[float, float]] = ..., + rightside_up: bool = ..., + zorder: float | None = ... + ) -> list[Text]: ... + @property + def labelFontProps(self) -> FontProperties: ... + @property + def labelFontSizeList(self) -> list[float]: ... + @property + def labelTextsList(self) -> list[Text]: ... + def print_label(self, linecontour: ArrayLike, labelwidth: float) -> bool: ... + def too_close(self, x: float, y: float, lw: float) -> bool: ... + def set_label_props(self, label: Text, text: str, color: ColorType) -> None: ... + def get_text( + self, + lev: float, + fmt: str | Formatter | Callable[[float], str] | dict[float, str], + ) -> str: ... + def locate_label( + self, linecontour: ArrayLike, labelwidth: float + ) -> tuple[float, float, float]: ... + def calc_label_rot_and_inline( + self, + slc: ArrayLike, + ind: int, + lw: float, + lc: ArrayLike | None = ..., + spacing: int = ..., + ) -> tuple[float, list[ArrayLike]]: ... + def add_label( + self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType + ) -> None: ... + def add_label_clabeltext( + self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType + ) -> None: ... + def add_label_near( + self, + x: float, + y: float, + inline: bool = ..., + inline_spacing: int = ..., + transform: Transform | Literal[False] | None = ..., + ) -> None: ... + def pop_label(self, index: int = ...) -> None: ... + def labels(self, inline: bool, inline_spacing: int) -> None: ... + def remove(self) -> None: ... + +class ContourSet(ContourLabeler, Collection): + axes: Axes + levels: Iterable[float] + filled: bool + linewidths: float | ArrayLike | None + hatches: Iterable[str | None] + origin: Literal["upper", "lower", "image"] | None + extent: tuple[float, float, float, float] | None + colors: ColorType | Sequence[ColorType] + extend: Literal["neither", "both", "min", "max"] + nchunk: int + locator: Locator | None + logscale: bool + negative_linestyles: None | Literal[ + "solid", "dashed", "dashdot", "dotted" + ] | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]] + clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None + labelTexts: list[Text] + labelCValues: list[ColorType] + @property + def tcolors(self) -> list[tuple[tuple[float, float, float, float]]]: ... + + # only for not filled + @property + def tlinewidths(self) -> list[tuple[float]]: ... + + @property + def allkinds(self) -> list[list[np.ndarray | None]]: ... + @property + def allsegs(self) -> list[list[np.ndarray]]: ... + @property + def alpha(self) -> float | None: ... + @property + def antialiased(self) -> bool: ... + @antialiased.setter + def antialiased(self, aa: bool | Sequence[bool]) -> None: ... + @property + def collections(self) -> list[PathCollection]: ... + @property + def linestyles(self) -> ( + None | + Literal["solid", "dashed", "dashdot", "dotted"] | + Iterable[Literal["solid", "dashed", "dashdot", "dotted"]] + ): ... + + def __init__( + self, + ax: Axes, + *args, + levels: Iterable[float] | None = ..., + filled: bool = ..., + linewidths: float | ArrayLike | None = ..., + linestyles: Literal["solid", "dashed", "dashdot", "dotted"] + | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]] + | None = ..., + hatches: Iterable[str | None] = ..., + alpha: float | None = ..., + origin: Literal["upper", "lower", "image"] | None = ..., + extent: tuple[float, float, float, float] | None = ..., + cmap: str | Colormap | None = ..., + colors: ColorType | Sequence[ColorType] | None = ..., + norm: str | Normalize | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + extend: Literal["neither", "both", "min", "max"] = ..., + antialiased: bool | None = ..., + nchunk: int = ..., + locator: Locator | None = ..., + transform: Transform | None = ..., + negative_linestyles: Literal["solid", "dashed", "dashdot", "dotted"] + | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]] + | None = ..., + clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None = ..., + **kwargs + ) -> None: ... + def legend_elements( + self, variable_name: str = ..., str_format: Callable[[float], str] = ... + ) -> tuple[list[Artist], list[str]]: ... + def find_nearest_contour( + self, x: float, y: float, indices: Iterable[int] | None = ..., pixel: bool = ... + ) -> tuple[int, int, int, float, float, float]: ... + +class QuadContourSet(ContourSet): ... diff --git a/contrib/python/matplotlib/py3/matplotlib/dviread.pyi b/contrib/python/matplotlib/py3/matplotlib/dviread.pyi new file mode 100644 index 0000000000..bf5cfcbe31 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/dviread.pyi @@ -0,0 +1,90 @@ +from pathlib import Path +import io +import os +from enum import Enum +from collections.abc import Generator + +from typing import NamedTuple + +class _dvistate(Enum): + pre: int + outer: int + inpage: int + post_post: int + finale: int + +class Page(NamedTuple): + text: list[Text] + boxes: list[Box] + height: int + width: int + descent: int + +class Box(NamedTuple): + x: int + y: int + height: int + width: int + +class Text(NamedTuple): + x: int + y: int + font: DviFont + glyph: int + width: int + @property + def font_path(self) -> Path: ... + @property + def font_size(self) -> float: ... + @property + def font_effects(self) -> dict[str, float]: ... + @property + def glyph_name_or_index(self) -> int | str: ... + +class Dvi: + file: io.BufferedReader + dpi: float | None + fonts: dict[int, DviFont] + state: _dvistate + def __init__(self, filename: str | os.PathLike, dpi: float | None) -> None: ... + # Replace return with Self when py3.9 is dropped + def __enter__(self) -> Dvi: ... + def __exit__(self, etype, evalue, etrace) -> None: ... + def __iter__(self) -> Generator[Page, None, None]: ... + def close(self) -> None: ... + +class DviFont: + texname: bytes + size: float + widths: list[int] + def __init__( + self, scale: float, tfm: Tfm, texname: bytes, vf: Vf | None + ) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + +class Vf(Dvi): + def __init__(self, filename: str | os.PathLike) -> None: ... + def __getitem__(self, code: int) -> Page: ... + +class Tfm: + checksum: int + design_size: int + width: dict[int, int] + height: dict[int, int] + depth: dict[int, int] + def __init__(self, filename: str | os.PathLike) -> None: ... + +class PsFont(NamedTuple): + texname: bytes + psname: bytes + effects: dict[str, float] + encoding: None | bytes + filename: str + +class PsfontsMap: + # Replace return with Self when py3.9 is dropped + def __new__(cls, filename: str | os.PathLike) -> PsfontsMap: ... + def __getitem__(self, texname: bytes) -> PsFont: ... + +def find_tex_file(filename: str | os.PathLike) -> str: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/figure.pyi b/contrib/python/matplotlib/py3/matplotlib/figure.pyi new file mode 100644 index 0000000000..887b6ed5d8 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/figure.pyi @@ -0,0 +1,416 @@ +from collections.abc import Callable, Hashable, Iterable +import os +from typing import Any, IO, Literal, TypeVar, overload + +import numpy as np +from numpy.typing import ArrayLike + +from matplotlib.artist import Artist +from matplotlib.axes import Axes, SubplotBase +from matplotlib.backend_bases import ( + FigureCanvasBase, + MouseButton, + MouseEvent, + RendererBase, +) +from matplotlib.colors import Colormap, Normalize +from matplotlib.colorbar import Colorbar +from matplotlib.cm import ScalarMappable +from matplotlib.gridspec import GridSpec, SubplotSpec +from matplotlib.image import _ImageBase, FigureImage +from matplotlib.layout_engine import LayoutEngine +from matplotlib.legend import Legend +from matplotlib.lines import Line2D +from matplotlib.patches import Rectangle, Patch +from matplotlib.text import Text +from matplotlib.transforms import Affine2D, Bbox, BboxBase, Transform +from .typing import ColorType, HashableList + +_T = TypeVar("_T") + +class SubplotParams: + def __init__( + self, + left: float | None = ..., + bottom: float | None = ..., + right: float | None = ..., + top: float | None = ..., + wspace: float | None = ..., + hspace: float | None = ..., + ) -> None: ... + left: float + right: float + bottom: float + top: float + wspace: float + hspace: float + def update( + self, + left: float | None = ..., + bottom: float | None = ..., + right: float | None = ..., + top: float | None = ..., + wspace: float | None = ..., + hspace: float | None = ..., + ) -> None: ... + +class FigureBase(Artist): + artists: list[Artist] + lines: list[Line2D] + patches: list[Patch] + texts: list[Text] + images: list[_ImageBase] + legends: list[Legend] + subfigs: list[SubFigure] + stale: bool + suppressComposite: bool | None + def __init__(self, **kwargs) -> None: ... + def autofmt_xdate( + self, + bottom: float = ..., + rotation: int = ..., + ha: Literal["left", "center", "right"] = ..., + which: Literal["major", "minor", "both"] = ..., + ) -> None: ... + def get_children(self) -> list[Artist]: ... + def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ... + def suptitle(self, t: str, **kwargs) -> Text: ... + def get_suptitle(self) -> str: ... + def supxlabel(self, t: str, **kwargs) -> Text: ... + def get_supxlabel(self) -> str: ... + def supylabel(self, t: str, **kwargs) -> Text: ... + def get_supylabel(self) -> str: ... + def get_edgecolor(self) -> ColorType: ... + def get_facecolor(self) -> ColorType: ... + def get_frameon(self) -> bool: ... + def set_linewidth(self, linewidth: float) -> None: ... + def get_linewidth(self) -> float: ... + def set_edgecolor(self, color: ColorType) -> None: ... + def set_facecolor(self, color: ColorType) -> None: ... + def set_frameon(self, b: bool) -> None: ... + @property + def frameon(self) -> bool: ... + @frameon.setter + def frameon(self, b: bool) -> None: ... + def add_artist(self, artist: Artist, clip: bool = ...) -> Artist: ... + @overload + def add_axes(self, ax: Axes) -> Axes: ... + @overload + def add_axes( + self, + rect: tuple[float, float, float, float], + projection: None | str = ..., + polar: bool = ..., + **kwargs + ) -> Axes: ... + + # TODO: docstring indicates SubplotSpec a valid arg, but none of the listed signatures appear to be that + @overload + def add_subplot( + self, nrows: int, ncols: int, index: int | tuple[int, int], **kwargs + ) -> Axes: ... + @overload + def add_subplot(self, pos: int, **kwargs) -> Axes: ... + @overload + def add_subplot(self, ax: Axes, **kwargs) -> Axes: ... + @overload + def add_subplot(self, ax: SubplotSpec, **kwargs) -> Axes: ... + @overload + def add_subplot(self, **kwargs) -> Axes: ... + @overload + def subplots( + self, + nrows: int = ..., + ncols: int = ..., + *, + sharex: bool | Literal["none", "all", "row", "col"] = ..., + sharey: bool | Literal["none", "all", "row", "col"] = ..., + squeeze: Literal[False], + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + subplot_kw: dict[str, Any] | None = ..., + gridspec_kw: dict[str, Any] | None = ... + ) -> np.ndarray: ... + @overload + def subplots( + self, + nrows: int = ..., + ncols: int = ..., + *, + sharex: bool | Literal["none", "all", "row", "col"] = ..., + sharey: bool | Literal["none", "all", "row", "col"] = ..., + squeeze: bool = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + subplot_kw: dict[str, Any] | None = ..., + gridspec_kw: dict[str, Any] | None = ... + ) -> np.ndarray | SubplotBase | Axes: ... + def delaxes(self, ax: Axes) -> None: ... + def clear(self, keep_observers: bool = ...) -> None: ... + def clf(self, keep_observers: bool = ...) -> None: ... + + @overload + def legend(self) -> Legend: ... + @overload + def legend(self, handles: Iterable[Artist], labels: Iterable[str], **kwargs) -> Legend: ... + @overload + def legend(self, *, handles: Iterable[Artist], **kwargs) -> Legend: ... + @overload + def legend(self, labels: Iterable[str], **kwargs) -> Legend: ... + @overload + def legend(self, **kwargs) -> Legend: ... + + def text( + self, + x: float, + y: float, + s: str, + fontdict: dict[str, Any] | None = ..., + **kwargs + ) -> Text: ... + def colorbar( + self, + mappable: ScalarMappable, + cax: Axes | None = ..., + ax: Axes | Iterable[Axes] | None = ..., + use_gridspec: bool = ..., + **kwargs + ) -> Colorbar: ... + def subplots_adjust( + self, + left: float | None = ..., + bottom: float | None = ..., + right: float | None = ..., + top: float | None = ..., + wspace: float | None = ..., + hspace: float | None = ..., + ) -> None: ... + def align_xlabels(self, axs: Iterable[Axes] | None = ...) -> None: ... + def align_ylabels(self, axs: Iterable[Axes] | None = ...) -> None: ... + def align_labels(self, axs: Iterable[Axes] | None = ...) -> None: ... + def add_gridspec(self, nrows: int = ..., ncols: int = ..., **kwargs) -> GridSpec: ... + @overload + def subfigures( + self, + nrows: int = ..., + ncols: int = ..., + squeeze: Literal[False] = ..., + wspace: float | None = ..., + hspace: float | None = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + **kwargs + ) -> np.ndarray: ... + @overload + def subfigures( + self, + nrows: int = ..., + ncols: int = ..., + squeeze: Literal[True] = ..., + wspace: float | None = ..., + hspace: float | None = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + **kwargs + ) -> np.ndarray | SubFigure: ... + def add_subfigure(self, subplotspec: SubplotSpec, **kwargs) -> SubFigure: ... + def sca(self, a: Axes) -> Axes: ... + def gca(self) -> Axes: ... + def _gci(self) -> ScalarMappable | None: ... + def _process_projection_requirements( + self, *, axes_class=None, polar=False, projection=None, **kwargs + ) -> tuple[type[Axes], dict[str, Any]]: ... + def get_default_bbox_extra_artists(self) -> list[Artist]: ... + def get_tightbbox( + self, + renderer: RendererBase | None = ..., + *, + bbox_extra_artists: Iterable[Artist] | None = ..., + ) -> Bbox: ... + @overload + def subplot_mosaic( + self, + mosaic: str, + *, + sharex: bool = ..., + sharey: bool = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + empty_sentinel: str = ..., + subplot_kw: dict[str, Any] | None = ..., + per_subplot_kw: dict[str | tuple[str, ...], dict[str, Any]] | None = ..., + gridspec_kw: dict[str, Any] | None = ..., + ) -> dict[str, Axes]: ... + @overload + def subplot_mosaic( + self, + mosaic: list[HashableList[_T]], + *, + sharex: bool = ..., + sharey: bool = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + empty_sentinel: _T = ..., + subplot_kw: dict[str, Any] | None = ..., + per_subplot_kw: dict[_T | tuple[_T, ...], dict[str, Any]] | None = ..., + gridspec_kw: dict[str, Any] | None = ..., + ) -> dict[_T, Axes]: ... + @overload + def subplot_mosaic( + self, + mosaic: list[HashableList[Hashable]], + *, + sharex: bool = ..., + sharey: bool = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + empty_sentinel: Any = ..., + subplot_kw: dict[str, Any] | None = ..., + per_subplot_kw: dict[Hashable | tuple[Hashable, ...], dict[str, Any]] | None = ..., + gridspec_kw: dict[str, Any] | None = ..., + ) -> dict[Hashable, Axes]: ... + +class SubFigure(FigureBase): + figure: Figure + subplotpars: SubplotParams + dpi_scale_trans: Affine2D + canvas: FigureCanvasBase + transFigure: Transform + bbox_relative: Bbox + figbbox: BboxBase + bbox: BboxBase + transSubfigure: Transform + patch: Rectangle + def __init__( + self, + parent: Figure | SubFigure, + subplotspec: SubplotSpec, + *, + facecolor: ColorType | None = ..., + edgecolor: ColorType | None = ..., + linewidth: float = ..., + frameon: bool | None = ..., + **kwargs + ) -> None: ... + @property + def dpi(self) -> float: ... + @dpi.setter + def dpi(self, value: float) -> None: ... + def get_dpi(self) -> float: ... + def set_dpi(self, val) -> None: ... + def get_constrained_layout(self) -> bool: ... + def get_constrained_layout_pads( + self, relative: bool = ... + ) -> tuple[float, float, float, float]: ... + def get_layout_engine(self) -> LayoutEngine: ... + @property # type: ignore[misc] + def axes(self) -> list[Axes]: ... # type: ignore[override] + def get_axes(self) -> list[Axes]: ... + +class Figure(FigureBase): + figure: Figure + bbox_inches: Bbox + dpi_scale_trans: Affine2D + bbox: BboxBase + figbbox: BboxBase + transFigure: Transform + transSubfigure: Transform + patch: Rectangle + subplotpars: SubplotParams + def __init__( + self, + figsize: tuple[float, float] | None = ..., + dpi: float | None = ..., + *, + facecolor: ColorType | None = ..., + edgecolor: ColorType | None = ..., + linewidth: float = ..., + frameon: bool | None = ..., + subplotpars: SubplotParams | None = ..., + tight_layout: bool | dict[str, Any] | None = ..., + constrained_layout: bool | dict[str, Any] | None = ..., + layout: Literal["constrained", "compressed", "tight"] + | LayoutEngine + | None = ..., + **kwargs + ) -> None: ... + def pick(self, mouseevent: MouseEvent) -> None: ... + def set_layout_engine( + self, + layout: Literal["constrained", "compressed", "tight", "none"] + | LayoutEngine + | None = ..., + **kwargs + ) -> None: ... + def get_layout_engine(self) -> LayoutEngine | None: ... + def _repr_html_(self) -> str | None: ... + def show(self, warn: bool = ...) -> None: ... + @property # type: ignore[misc] + def axes(self) -> list[Axes]: ... # type: ignore[override] + def get_axes(self) -> list[Axes]: ... + @property + def dpi(self) -> float: ... + @dpi.setter + def dpi(self, dpi: float) -> None: ... + def get_tight_layout(self) -> bool: ... + def get_constrained_layout_pads( + self, relative: bool = ... + ) -> tuple[float, float, float, float]: ... + def get_constrained_layout(self) -> bool: ... + canvas: FigureCanvasBase + def set_canvas(self, canvas: FigureCanvasBase) -> None: ... + def figimage( + self, + X: ArrayLike, + xo: int = ..., + yo: int = ..., + alpha: float | None = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + origin: Literal["upper", "lower"] | None = ..., + resize: bool = ..., + **kwargs + ) -> FigureImage: ... + def set_size_inches( + self, w: float | tuple[float, float], h: float | None = ..., forward: bool = ... + ) -> None: ... + def get_size_inches(self) -> np.ndarray: ... + def get_figwidth(self) -> float: ... + def get_figheight(self) -> float: ... + def get_dpi(self) -> float: ... + def set_dpi(self, val: float) -> None: ... + def set_figwidth(self, val: float, forward: bool = ...) -> None: ... + def set_figheight(self, val: float, forward: bool = ...) -> None: ... + def clear(self, keep_observers: bool = ...) -> None: ... + def draw_without_rendering(self) -> None: ... + def draw_artist(self, a: Artist) -> None: ... + def add_axobserver(self, func: Callable[[Figure], Any]) -> None: ... + def savefig( + self, + fname: str | os.PathLike | IO, + *, + transparent: bool | None = ..., + **kwargs + ) -> None: ... + def ginput( + self, + n: int = ..., + timeout: float = ..., + show_clicks: bool = ..., + mouse_add: MouseButton = ..., + mouse_pop: MouseButton = ..., + mouse_stop: MouseButton = ..., + ) -> list[tuple[int, int]]: ... + def waitforbuttonpress(self, timeout: float = ...) -> None | bool: ... + def tight_layout( + self, + *, + pad: float = ..., + h_pad: float | None = ..., + w_pad: float | None = ..., + rect: tuple[float, float, float, float] | None = ... + ) -> None: ... + +def figaspect(arg: float | ArrayLike) -> tuple[float, float]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/font_manager.pyi b/contrib/python/matplotlib/py3/matplotlib/font_manager.pyi new file mode 100644 index 0000000000..48d0e362d5 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/font_manager.pyi @@ -0,0 +1,136 @@ +from dataclasses import dataclass +import os + +from matplotlib._afm import AFM +from matplotlib import ft2font + +from pathlib import Path + +from collections.abc import Iterable +from typing import Any, Literal + +font_scalings: dict[str | None, float] +stretch_dict: dict[str, int] +weight_dict: dict[str, int] +font_family_aliases: set[str] +MSFolders: str +MSFontDirectories: list[str] +MSUserFontDirectories: list[str] +X11FontDirectories: list[str] +OSXFontDirectories: list[str] + +def get_fontext_synonyms(fontext: str) -> list[str]: ... +def list_fonts(directory: str, extensions: Iterable[str]) -> list[str]: ... +def win32FontDirectory() -> str: ... +def _get_fontconfig_fonts() -> list[Path]: ... +def findSystemFonts( + fontpaths: Iterable[str | os.PathLike | Path] | None = ..., fontext: str = ... +) -> list[str]: ... +@dataclass +class FontEntry: + fname: str = ... + name: str = ... + style: str = ... + variant: str = ... + weight: str | int = ... + stretch: str = ... + size: str = ... + def _repr_html_(self) -> str: ... + def _repr_png_(self) -> bytes: ... + +def ttfFontProperty(font: ft2font.FT2Font) -> FontEntry: ... +def afmFontProperty(fontpath: str, font: AFM) -> FontEntry: ... + +class FontProperties: + def __init__( + self, + family: str | Iterable[str] | None = ..., + style: Literal["normal", "italic", "oblique"] | None = ..., + variant: Literal["normal", "small-caps"] | None = ..., + weight: int | str | None = ..., + stretch: int | str | None = ..., + size: float | str | None = ..., + fname: str | os.PathLike | Path | None = ..., + math_fontfamily: str | None = ..., + ) -> None: ... + def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... + def get_family(self) -> list[str]: ... + def get_name(self) -> str: ... + def get_style(self) -> Literal["normal", "italic", "oblique"]: ... + def get_variant(self) -> Literal["normal", "small-caps"]: ... + def get_weight(self) -> int | str: ... + def get_stretch(self) -> int | str: ... + def get_size(self) -> float: ... + def get_file(self) -> str | bytes | None: ... + def get_fontconfig_pattern(self) -> dict[str, list[Any]]: ... + def set_family(self, family: str | Iterable[str] | None) -> None: ... + def set_style( + self, style: Literal["normal", "italic", "oblique"] | None + ) -> None: ... + def set_variant(self, variant: Literal["normal", "small-caps"] | None) -> None: ... + def set_weight(self, weight: int | str | None) -> None: ... + def set_stretch(self, stretch: int | str | None) -> None: ... + def set_size(self, size: float | str | None) -> None: ... + def set_file(self, file: str | os.PathLike | Path | None) -> None: ... + def set_fontconfig_pattern(self, pattern: str) -> None: ... + def get_math_fontfamily(self) -> str: ... + def set_math_fontfamily(self, fontfamily: str | None) -> None: ... + def copy(self) -> FontProperties: ... + # Aliases + set_name = set_family + get_slant = get_style + set_slant = set_style + get_size_in_points = get_size + +def json_dump(data: FontManager, filename: str | Path | os.PathLike) -> None: ... +def json_load(filename: str | Path | os.PathLike) -> FontManager: ... + +class FontManager: + __version__: int + default_size: float | None + defaultFamily: dict[str, str] + afmlist: list[FontEntry] + ttflist: list[FontEntry] + def __init__(self, size: float | None = ..., weight: str = ...) -> None: ... + def addfont(self, path: str | Path | os.PathLike) -> None: ... + @property + def defaultFont(self) -> dict[str, str]: ... + def get_default_weight(self) -> str: ... + @staticmethod + def get_default_size() -> float: ... + def set_default_weight(self, weight: str) -> None: ... + def score_family( + self, families: str | list[str] | tuple[str], family2: str + ) -> float: ... + def score_style(self, style1: str, style2: str) -> float: ... + def score_variant(self, variant1: str, variant2: str) -> float: ... + def score_stretch(self, stretch1: str | int, stretch2: str | int) -> float: ... + def score_weight(self, weight1: str | float, weight2: str | float) -> float: ... + def score_size(self, size1: str | float, size2: str | float) -> float: ... + def findfont( + self, + prop: str | FontProperties, + fontext: Literal["ttf", "afm"] = ..., + directory: str | None = ..., + fallback_to_default: bool = ..., + rebuild_if_missing: bool = ..., + ) -> str: ... + def get_font_names(self) -> list[str]: ... + +def is_opentype_cff_font(filename: str) -> bool: ... +def get_font( + font_filepaths: Iterable[str | Path | bytes] | str | Path | bytes, + hinting_factor: int | None = ..., +) -> ft2font.FT2Font: ... + +fontManager: FontManager + +def findfont( + prop: str | FontProperties, + fontext: Literal["ttf", "afm"] = ..., + directory: str | None = ..., + fallback_to_default: bool = ..., + rebuild_if_missing: bool = ..., +) -> str: ... +def get_font_names() -> list[str]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/ft2font.pyi b/contrib/python/matplotlib/py3/matplotlib/ft2font.pyi new file mode 100644 index 0000000000..6a0716e993 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/ft2font.pyi @@ -0,0 +1,253 @@ +from typing import BinaryIO, Literal, TypedDict, overload + +import numpy as np +from numpy.typing import NDArray + +__freetype_build_type__: str +__freetype_version__: str +BOLD: int +EXTERNAL_STREAM: int +FAST_GLYPHS: int +FIXED_SIZES: int +FIXED_WIDTH: int +GLYPH_NAMES: int +HORIZONTAL: int +ITALIC: int +KERNING: int +KERNING_DEFAULT: int +KERNING_UNFITTED: int +KERNING_UNSCALED: int +LOAD_CROP_BITMAP: int +LOAD_DEFAULT: int +LOAD_FORCE_AUTOHINT: int +LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH: int +LOAD_IGNORE_TRANSFORM: int +LOAD_LINEAR_DESIGN: int +LOAD_MONOCHROME: int +LOAD_NO_AUTOHINT: int +LOAD_NO_BITMAP: int +LOAD_NO_HINTING: int +LOAD_NO_RECURSE: int +LOAD_NO_SCALE: int +LOAD_PEDANTIC: int +LOAD_RENDER: int +LOAD_TARGET_LCD: int +LOAD_TARGET_LCD_V: int +LOAD_TARGET_LIGHT: int +LOAD_TARGET_MONO: int +LOAD_TARGET_NORMAL: int +LOAD_VERTICAL_LAYOUT: int +MULTIPLE_MASTERS: int +SCALABLE: int +SFNT: int +VERTICAL: int + +class _SfntHeadDict(TypedDict): + version: tuple[int, int] + fontRevision: tuple[int, int] + checkSumAdjustment: int + magicNumber: int + flags: int + unitsPerEm: int + created: tuple[int, int] + modified: tuple[int, int] + xMin: int + yMin: int + xMax: int + yMax: int + macStyle: int + lowestRecPPEM: int + fontDirectionHint: int + indexToLocFormat: int + glyphDataFormat: int + +class _SfntMaxpDict(TypedDict): + version: tuple[int, int] + numGlyphs: int + maxPoints: int + maxContours: int + maxComponentPoints: int + maxComponentContours: int + maxZones: int + maxTwilightPoints: int + maxStorage: int + maxFunctionDefs: int + maxInstructionDefs: int + maxStackElements: int + maxSizeOfInstructions: int + maxComponentElements: int + maxComponentDepth: int + +class _SfntOs2Dict(TypedDict): + version: int + xAvgCharWidth: int + usWeightClass: int + usWidthClass: int + fsType: int + ySubscriptXSize: int + ySubscriptYSize: int + ySubscriptXOffset: int + ySubscriptYOffset: int + ySuperscriptXSize: int + ySuperscriptYSize: int + ySuperscriptXOffset: int + ySuperscriptYOffset: int + yStrikeoutSize: int + yStrikeoutPosition: int + sFamilyClass: int + panose: bytes + ulCharRange: tuple[int, int, int, int] + achVendID: bytes + fsSelection: int + fsFirstCharIndex: int + fsLastCharIndex: int + +class _SfntHheaDict(TypedDict): + version: tuple[int, int] + ascent: int + descent: int + lineGap: int + advanceWidthMax: int + minLeftBearing: int + minRightBearing: int + xMaxExtent: int + caretSlopeRise: int + caretSlopeRun: int + caretOffset: int + metricDataFormat: int + numOfLongHorMetrics: int + +class _SfntVheaDict(TypedDict): + version: tuple[int, int] + vertTypoAscender: int + vertTypoDescender: int + vertTypoLineGap: int + advanceHeightMax: int + minTopSideBearing: int + minBottomSizeBearing: int + yMaxExtent: int + caretSlopeRise: int + caretSlopeRun: int + caretOffset: int + metricDataFormat: int + numOfLongVerMetrics: int + +class _SfntPostDict(TypedDict): + format: tuple[int, int] + italicAngle: tuple[int, int] + underlinePosition: int + underlineThickness: int + isFixedPitch: int + minMemType42: int + maxMemType42: int + minMemType1: int + maxMemType1: int + +class _SfntPcltDict(TypedDict): + version: tuple[int, int] + fontNumber: int + pitch: int + xHeight: int + style: int + typeFamily: int + capHeight: int + symbolSet: int + typeFace: bytes + characterComplement: bytes + strokeWeight: int + widthType: int + serifStyle: int + +class FT2Font: + ascender: int + bbox: tuple[int, int, int, int] + descender: int + face_flags: int + family_name: str + fname: str + height: int + max_advance_height: int + max_advance_width: int + num_charmaps: int + num_faces: int + num_fixed_sizes: int + num_glyphs: int + postscript_name: str + scalable: bool + style_flags: int + style_name: str + underline_position: int + underline_thickness: int + units_per_EM: int + + def __init__( + self, + filename: str | BinaryIO, + hinting_factor: int = ..., + *, + _fallback_list: list[FT2Font] | None = ..., + _kerning_factor: int = ... + ) -> None: ... + def _get_fontmap(self, string: str) -> dict[str, FT2Font]: ... + def clear(self) -> None: ... + def draw_glyph_to_bitmap( + self, image: FT2Image, x: float, y: float, glyph: Glyph, antialiased: bool = ... + ) -> None: ... + def draw_glyphs_to_bitmap(self, antialiased: bool = ...) -> None: ... + def get_bitmap_offset(self) -> tuple[int, int]: ... + def get_char_index(self, codepoint: int) -> int: ... + def get_charmap(self) -> dict[int, int]: ... + def get_descent(self) -> int: ... + def get_glyph_name(self, index: int) -> str: ... + def get_image(self) -> NDArray[np.uint8]: ... + def get_kerning(self, left: int, right: int, mode: int) -> int: ... + def get_name_index(self, name: str) -> int: ... + def get_num_glyphs(self) -> int: ... + def get_path(self) -> tuple[NDArray[np.float64], NDArray[np.int8]]: ... + def get_ps_font_info( + self, + ) -> tuple[str, str, str, str, str, int, int, int, int]: ... + def get_sfnt(self) -> dict[tuple[int, int, int, int], bytes]: ... + @overload + def get_sfnt_table(self, name: Literal["head"]) -> _SfntHeadDict | None: ... + @overload + def get_sfnt_table(self, name: Literal["maxp"]) -> _SfntMaxpDict | None: ... + @overload + def get_sfnt_table(self, name: Literal["OS/2"]) -> _SfntOs2Dict | None: ... + @overload + def get_sfnt_table(self, name: Literal["hhea"]) -> _SfntHheaDict | None: ... + @overload + def get_sfnt_table(self, name: Literal["vhea"]) -> _SfntVheaDict | None: ... + @overload + def get_sfnt_table(self, name: Literal["post"]) -> _SfntPostDict | None: ... + @overload + def get_sfnt_table(self, name: Literal["pclt"]) -> _SfntPcltDict | None: ... + def get_width_height(self) -> tuple[int, int]: ... + def get_xys(self, antialiased: bool = ...) -> NDArray[np.float64]: ... + def load_char(self, charcode: int, flags: int = ...) -> Glyph: ... + def load_glyph(self, glyphindex: int, flags: int = ...) -> Glyph: ... + def select_charmap(self, i: int) -> None: ... + def set_charmap(self, i: int) -> None: ... + def set_size(self, ptsize: float, dpi: float) -> None: ... + def set_text( + self, string: str, angle: float = ..., flags: int = ... + ) -> NDArray[np.float64]: ... + +class FT2Image: # TODO: When updating mypy>=1.4, subclass from Buffer. + def __init__(self, width: float, height: float) -> None: ... + def draw_rect(self, x0: float, y0: float, x1: float, y1: float) -> None: ... + def draw_rect_filled(self, x0: float, y0: float, x1: float, y1: float) -> None: ... + +class Glyph: + width: int + height: int + horiBearingX: int + horiBearingY: int + horiAdvance: int + linearHoriAdvance: int + vertBearingX: int + vertBearingY: int + vertAdvance: int + + @property + def bbox(self) -> tuple[int, int, int, int]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/gridspec.pyi b/contrib/python/matplotlib/py3/matplotlib/gridspec.pyi new file mode 100644 index 0000000000..6e2273080b --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/gridspec.pyi @@ -0,0 +1,134 @@ +from typing import Any, Literal, overload + +from numpy.typing import ArrayLike +import numpy as np + +from matplotlib.axes import Axes, SubplotBase +from matplotlib.backend_bases import RendererBase +from matplotlib.figure import Figure, SubplotParams +from matplotlib.transforms import Bbox + +class GridSpecBase: + def __init__( + self, + nrows: int, + ncols: int, + height_ratios: ArrayLike | None = ..., + width_ratios: ArrayLike | None = ..., + ) -> None: ... + @property + def nrows(self) -> int: ... + @property + def ncols(self) -> int: ... + def get_geometry(self) -> tuple[int, int]: ... + def get_subplot_params(self, figure: Figure | None = ...) -> SubplotParams: ... + def new_subplotspec( + self, loc: tuple[int, int], rowspan: int = ..., colspan: int = ... + ) -> SubplotSpec: ... + def set_width_ratios(self, width_ratios: ArrayLike | None) -> None: ... + def get_width_ratios(self) -> ArrayLike: ... + def set_height_ratios(self, height_ratios: ArrayLike | None) -> None: ... + def get_height_ratios(self) -> ArrayLike: ... + def get_grid_positions( + self, fig: Figure, raw: bool = ... + ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: ... + @staticmethod + def _check_gridspec_exists(figure: Figure, nrows: int, ncols: int) -> GridSpec: ... + def __getitem__( + self, key: tuple[int | slice, int | slice] | slice | int + ) -> SubplotSpec: ... + @overload + def subplots( + self, + *, + sharex: bool | Literal["all", "row", "col", "none"] = ..., + sharey: bool | Literal["all", "row", "col", "none"] = ..., + squeeze: Literal[False], + subplot_kw: dict[str, Any] | None = ... + ) -> np.ndarray: ... + @overload + def subplots( + self, + *, + sharex: bool | Literal["all", "row", "col", "none"] = ..., + sharey: bool | Literal["all", "row", "col", "none"] = ..., + squeeze: Literal[True] = ..., + subplot_kw: dict[str, Any] | None = ... + ) -> np.ndarray | SubplotBase | Axes: ... + +class GridSpec(GridSpecBase): + left: float | None + bottom: float | None + right: float | None + top: float | None + wspace: float | None + hspace: float | None + figure: Figure | None + def __init__( + self, + nrows: int, + ncols: int, + figure: Figure | None = ..., + left: float | None = ..., + bottom: float | None = ..., + right: float | None = ..., + top: float | None = ..., + wspace: float | None = ..., + hspace: float | None = ..., + width_ratios: ArrayLike | None = ..., + height_ratios: ArrayLike | None = ..., + ) -> None: ... + def update(self, **kwargs: float | None) -> None: ... + def locally_modified_subplot_params(self) -> list[str]: ... + def tight_layout( + self, + figure: Figure, + renderer: RendererBase | None = ..., + pad: float = ..., + h_pad: float | None = ..., + w_pad: float | None = ..., + rect: tuple[float, float, float, float] | None = ..., + ) -> None: ... + +class GridSpecFromSubplotSpec(GridSpecBase): + figure: Figure | None + def __init__( + self, + nrows: int, + ncols: int, + subplot_spec: SubplotSpec, + wspace: float | None = ..., + hspace: float | None = ..., + height_ratios: ArrayLike | None = ..., + width_ratios: ArrayLike | None = ..., + ) -> None: ... + def get_topmost_subplotspec(self) -> SubplotSpec: ... + +class SubplotSpec: + num1: int + def __init__( + self, gridspec: GridSpecBase, num1: int, num2: int | None = ... + ) -> None: ... + @staticmethod + def _from_subplot_args(figure, args): ... + @property + def num2(self) -> int: ... + @num2.setter + def num2(self, value: int) -> None: ... + def get_gridspec(self) -> GridSpec: ... + def get_geometry(self) -> tuple[int, int, int, int]: ... + @property + def rowspan(self) -> range: ... + @property + def colspan(self) -> range: ... + def is_first_row(self) -> bool: ... + def is_last_row(self) -> bool: ... + def is_first_col(self) -> bool: ... + def is_last_col(self) -> bool: ... + def get_position(self, figure: Figure) -> Bbox: ... + def get_topmost_subplotspec(self) -> SubplotSpec: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + def subgridspec( + self, nrows: int, ncols: int, **kwargs + ) -> GridSpecFromSubplotSpec: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/hatch.pyi b/contrib/python/matplotlib/py3/matplotlib/hatch.pyi new file mode 100644 index 0000000000..348cf52149 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/hatch.pyi @@ -0,0 +1,68 @@ +from matplotlib.path import Path + +import numpy as np +from numpy.typing import ArrayLike + +class HatchPatternBase: ... + +class HorizontalHatch(HatchPatternBase): + num_lines: int + num_vertices: int + def __init__(self, hatch: str, density: int) -> None: ... + def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ... + +class VerticalHatch(HatchPatternBase): + num_lines: int + num_vertices: int + def __init__(self, hatch: str, density: int) -> None: ... + def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ... + +class NorthEastHatch(HatchPatternBase): + num_lines: int + num_vertices: int + def __init__(self, hatch: str, density: int) -> None: ... + def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ... + +class SouthEastHatch(HatchPatternBase): + num_lines: int + num_vertices: int + def __init__(self, hatch: str, density: int) -> None: ... + def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ... + +class Shapes(HatchPatternBase): + filled: bool + num_shapes: int + num_vertices: int + def __init__(self, hatch: str, density: int) -> None: ... + def set_vertices_and_codes(self, vertices: ArrayLike, codes: ArrayLike) -> None: ... + +class Circles(Shapes): + shape_vertices: np.ndarray + shape_codes: np.ndarray + def __init__(self, hatch: str, density: int) -> None: ... + +class SmallCircles(Circles): + size: float + num_rows: int + def __init__(self, hatch: str, density: int) -> None: ... + +class LargeCircles(Circles): + size: float + num_rows: int + def __init__(self, hatch: str, density: int) -> None: ... + +class SmallFilledCircles(Circles): + size: float + filled: bool + num_rows: int + def __init__(self, hatch: str, density: int) -> None: ... + +class Stars(Shapes): + size: float + filled: bool + num_rows: int + shape_vertices: np.ndarray + shape_codes: np.ndarray + def __init__(self, hatch: str, density: int) -> None: ... + +def get_path(hatchpattern: str, density: int = ...) -> Path: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/image.pyi b/contrib/python/matplotlib/py3/matplotlib/image.pyi new file mode 100644 index 0000000000..426e34ec83 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/image.pyi @@ -0,0 +1,209 @@ +from collections.abc import Callable, Sequence +import os +import pathlib +from typing import Any, BinaryIO, Literal + +import numpy as np +from numpy.typing import ArrayLike, NDArray +import PIL.Image + +import matplotlib.artist as martist +from matplotlib.axes import Axes +from matplotlib import cm +from matplotlib.backend_bases import RendererBase, MouseEvent +from matplotlib.colors import Colormap, Normalize +from matplotlib.figure import Figure +from matplotlib.transforms import Affine2D, BboxBase, Bbox, Transform + +# +# These names are re-exported from matplotlib._image. +# + +BESSEL: int +BICUBIC: int +BILINEAR: int +BLACKMAN: int +CATROM: int +GAUSSIAN: int +HAMMING: int +HANNING: int +HERMITE: int +KAISER: int +LANCZOS: int +MITCHELL: int +NEAREST: int +QUADRIC: int +SINC: int +SPLINE16: int +SPLINE36: int + +def resample( + input_array: NDArray[np.float32] | NDArray[np.float64] | NDArray[np.int8], + output_array: NDArray[np.float32] | NDArray[np.float64] | NDArray[np.int8], + transform: Transform, + interpolation: int = ..., + resample: bool = ..., + alpha: float = ..., + norm: bool = ..., + radius: float = ..., +) -> None: ... + +# +# END names re-exported from matplotlib._image. +# + +interpolations_names: set[str] + +def composite_images( + images: Sequence[_ImageBase], renderer: RendererBase, magnification: float = ... +) -> tuple[np.ndarray, float, float]: ... + +class _ImageBase(martist.Artist, cm.ScalarMappable): + zorder: float + origin: Literal["upper", "lower"] + axes: Axes + def __init__( + self, + ax: Axes, + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + interpolation: str | None = ..., + origin: Literal["upper", "lower"] | None = ..., + filternorm: bool = ..., + filterrad: float = ..., + resample: bool | None = ..., + *, + interpolation_stage: Literal["data", "rgba"] | None = ..., + **kwargs + ) -> None: ... + def get_size(self) -> tuple[int, int]: ... + def set_alpha(self, alpha: float | ArrayLike | None) -> None: ... + def changed(self) -> None: ... + def make_image( + self, renderer: RendererBase, magnification: float = ..., unsampled: bool = ... + ) -> tuple[np.ndarray, float, float, Affine2D]: ... + def draw(self, renderer: RendererBase, *args, **kwargs) -> None: ... + def write_png(self, fname: str | pathlib.Path | BinaryIO) -> None: ... + def set_data(self, A: ArrayLike | None) -> None: ... + def set_array(self, A: ArrayLike | None) -> None: ... + def get_shape(self) -> tuple[int, int, int]: ... + def get_interpolation(self) -> str: ... + def set_interpolation(self, s: str | None) -> None: ... + def set_interpolation_stage(self, s: Literal["data", "rgba"]) -> None: ... + def can_composite(self) -> bool: ... + def set_resample(self, v: bool | None) -> None: ... + def get_resample(self) -> bool: ... + def set_filternorm(self, filternorm: bool) -> None: ... + def get_filternorm(self) -> bool: ... + def set_filterrad(self, filterrad: float) -> None: ... + def get_filterrad(self) -> float: ... + +class AxesImage(_ImageBase): + def __init__( + self, + ax: Axes, + *, + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + interpolation: str | None = ..., + origin: Literal["upper", "lower"] | None = ..., + extent: tuple[float, float, float, float] | None = ..., + filternorm: bool = ..., + filterrad: float = ..., + resample: bool = ..., + interpolation_stage: Literal["data", "rgba"] | None = ..., + **kwargs + ) -> None: ... + def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... + def make_image( + self, renderer: RendererBase, magnification: float = ..., unsampled: bool = ... + ) -> tuple[np.ndarray, float, float, Affine2D]: ... + def set_extent( + self, extent: tuple[float, float, float, float], **kwargs + ) -> None: ... + def get_extent(self) -> tuple[float, float, float, float]: ... + def get_cursor_data(self, event: MouseEvent) -> None | float: ... + +class NonUniformImage(AxesImage): + mouseover: bool + def __init__( + self, ax: Axes, *, interpolation: Literal["nearest", "bilinear"] = ..., **kwargs + ) -> None: ... + def set_data(self, x: ArrayLike, y: ArrayLike, A: ArrayLike) -> None: ... # type: ignore[override] + # more limited interpolation available here than base class + def set_interpolation(self, s: Literal["nearest", "bilinear"]) -> None: ... # type: ignore[override] + +class PcolorImage(AxesImage): + def __init__( + self, + ax: Axes, + x: ArrayLike | None = ..., + y: ArrayLike | None = ..., + A: ArrayLike | None = ..., + *, + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + **kwargs + ) -> None: ... + def set_data(self, x: ArrayLike, y: ArrayLike, A: ArrayLike) -> None: ... # type: ignore[override] + +class FigureImage(_ImageBase): + zorder: float + figure: Figure + ox: float + oy: float + magnification: float + def __init__( + self, + fig: Figure, + *, + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + offsetx: int = ..., + offsety: int = ..., + origin: Literal["upper", "lower"] | None = ..., + **kwargs + ) -> None: ... + def get_extent(self) -> tuple[float, float, float, float]: ... + +class BboxImage(_ImageBase): + bbox: BboxBase + def __init__( + self, + bbox: BboxBase | Callable[[RendererBase | None], Bbox], + *, + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + interpolation: str | None = ..., + origin: Literal["upper", "lower"] | None = ..., + filternorm: bool = ..., + filterrad: float = ..., + resample: bool = ..., + **kwargs + ) -> None: ... + def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... + +def imread( + fname: str | pathlib.Path | BinaryIO, format: str | None = ... +) -> np.ndarray: ... +def imsave( + fname: str | os.PathLike | BinaryIO, + arr: ArrayLike, + vmin: float | None = ..., + vmax: float | None = ..., + cmap: str | Colormap | None = ..., + format: str | None = ..., + origin: Literal["upper", "lower"] | None = ..., + dpi: float = ..., + *, + metadata: dict[str, str] | None = ..., + pil_kwargs: dict[str, Any] | None = ... +) -> None: ... +def pil_to_array(pilImage: PIL.Image.Image) -> np.ndarray: ... +def thumbnail( + infile: str | BinaryIO, + thumbfile: str | BinaryIO, + scale: float = ..., + interpolation: str = ..., + preview: bool = ..., +) -> Figure: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi b/contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi new file mode 100644 index 0000000000..5b8c812ff4 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/layout_engine.pyi @@ -0,0 +1,62 @@ +from matplotlib.figure import Figure + +from typing import Any + +class LayoutEngine: + def __init__(self, **kwargs: Any) -> None: ... + def set(self) -> None: ... + @property + def colorbar_gridspec(self) -> bool: ... + @property + def adjust_compatible(self) -> bool: ... + def get(self) -> dict[str, Any]: ... + def execute(self, fig: Figure) -> None: ... + +class PlaceHolderLayoutEngine(LayoutEngine): + def __init__( + self, adjust_compatible: bool, colorbar_gridspec: bool, **kwargs: Any + ) -> None: ... + def execute(self, fig: Figure) -> None: ... + +class TightLayoutEngine(LayoutEngine): + def __init__( + self, + *, + pad: float = ..., + h_pad: float | None = ..., + w_pad: float | None = ..., + rect: tuple[float, float, float, float] = ..., + **kwargs: Any + ) -> None: ... + def execute(self, fig: Figure) -> None: ... + def set( + self, + *, + pad: float | None = ..., + w_pad: float | None = ..., + h_pad: float | None = ..., + rect: tuple[float, float, float, float] | None = ... + ) -> None: ... + +class ConstrainedLayoutEngine(LayoutEngine): + def __init__( + self, + *, + h_pad: float | None = ..., + w_pad: float | None = ..., + hspace: float | None = ..., + wspace: float | None = ..., + rect: tuple[float, float, float, float] = ..., + compress: bool = ..., + **kwargs: Any + ) -> None: ... + def execute(self, fig: Figure) -> Any: ... + def set( + self, + *, + h_pad: float | None = ..., + w_pad: float | None = ..., + hspace: float | None = ..., + wspace: float | None = ..., + rect: tuple[float, float, float, float] | None = ... + ) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/legend.pyi b/contrib/python/matplotlib/py3/matplotlib/legend.pyi new file mode 100644 index 0000000000..d559b06c5d --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/legend.pyi @@ -0,0 +1,154 @@ +from matplotlib.axes import Axes +from matplotlib.artist import Artist +from matplotlib.backend_bases import MouseEvent +from matplotlib.figure import Figure +from matplotlib.font_manager import FontProperties +from matplotlib.legend_handler import HandlerBase +from matplotlib.lines import Line2D +from matplotlib.offsetbox import ( + DraggableOffsetBox, +) +from matplotlib.patches import FancyBboxPatch, Patch, Rectangle +from matplotlib.text import Text +from matplotlib.transforms import ( + BboxBase, + Transform, +) + + +import pathlib +from collections.abc import Iterable +from typing import Any, Literal, overload +from .typing import ColorType + +class DraggableLegend(DraggableOffsetBox): + legend: Legend + def __init__( + self, legend: Legend, use_blit: bool = ..., update: Literal["loc", "bbox"] = ... + ) -> None: ... + def finalize_offset(self) -> None: ... + +class Legend(Artist): + codes: dict[str, int] + zorder: float + prop: FontProperties + texts: list[Text] + legend_handles: list[Artist | None] + numpoints: int + markerscale: float + scatterpoints: int + borderpad: float + labelspacing: float + handlelength: float + handleheight: float + handletextpad: float + borderaxespad: float + columnspacing: float + shadow: bool + isaxes: bool + axes: Axes + parent: Axes | Figure + legendPatch: FancyBboxPatch + def __init__( + self, + parent: Axes | Figure, + handles: Iterable[Artist | tuple[Artist, ...]], + labels: Iterable[str], + *, + loc: str | tuple[float, float] | int | None = ..., + numpoints: int | None = ..., + markerscale: float | None = ..., + markerfirst: bool = ..., + reverse: bool = ..., + scatterpoints: int | None = ..., + scatteryoffsets: Iterable[float] | None = ..., + prop: FontProperties | dict[str, Any] | None = ..., + fontsize: float | str | None = ..., + labelcolor: ColorType + | Iterable[ColorType] + | Literal["linecolor", "markerfacecolor", "mfc", "markeredgecolor", "mec"] + | None = ..., + borderpad: float | None = ..., + labelspacing: float | None = ..., + handlelength: float | None = ..., + handleheight: float | None = ..., + handletextpad: float | None = ..., + borderaxespad: float | None = ..., + columnspacing: float | None = ..., + ncols: int = ..., + mode: Literal["expand"] | None = ..., + fancybox: bool | None = ..., + shadow: bool | dict[str, Any] | None = ..., + title: str | None = ..., + title_fontsize: float | None = ..., + framealpha: float | None = ..., + edgecolor: Literal["inherit"] | ColorType | None = ..., + facecolor: Literal["inherit"] | ColorType | None = ..., + bbox_to_anchor: BboxBase + | tuple[float, float] + | tuple[float, float, float, float] + | None = ..., + bbox_transform: Transform | None = ..., + frameon: bool | None = ..., + handler_map: dict[Artist | type, HandlerBase] | None = ..., + title_fontproperties: FontProperties | dict[str, Any] | None = ..., + alignment: Literal["center", "left", "right"] = ..., + ncol: int = ..., + draggable: bool = ... + ) -> None: ... + def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ... + def set_ncols(self, ncols: int) -> None: ... + @classmethod + def get_default_handler_map(cls) -> dict[type, HandlerBase]: ... + @classmethod + def set_default_handler_map(cls, handler_map: dict[type, HandlerBase]) -> None: ... + @classmethod + def update_default_handler_map( + cls, handler_map: dict[type, HandlerBase] + ) -> None: ... + def get_legend_handler_map(self) -> dict[type, HandlerBase]: ... + @staticmethod + def get_legend_handler( + legend_handler_map: dict[type, HandlerBase], orig_handle: Any + ) -> HandlerBase | None: ... + def get_children(self) -> list[Artist]: ... + def get_frame(self) -> Rectangle: ... + def get_lines(self) -> list[Line2D]: ... + def get_patches(self) -> list[Patch]: ... + def get_texts(self) -> list[Text]: ... + def set_alignment(self, alignment: Literal["center", "left", "right"]) -> None: ... + def get_alignment(self) -> Literal["center", "left", "right"]: ... + def set_loc(self, loc: str | tuple[float, float] | int | None = ...) -> None: ... + def set_title( + self, title: str, prop: FontProperties | str | pathlib.Path | None = ... + ) -> None: ... + def get_title(self) -> Text: ... + def get_frame_on(self) -> bool: ... + def set_frame_on(self, b: bool) -> None: ... + draw_frame = set_frame_on + def get_bbox_to_anchor(self) -> BboxBase: ... + def set_bbox_to_anchor( + self, + bbox: BboxBase + | tuple[float, float] + | tuple[float, float, float, float] + | None, + transform: Transform | None = ... + ) -> None: ... + @overload + def set_draggable( + self, + state: Literal[True], + use_blit: bool = ..., + update: Literal["loc", "bbox"] = ..., + ) -> DraggableLegend: ... + @overload + def set_draggable( + self, + state: Literal[False], + use_blit: bool = ..., + update: Literal["loc", "bbox"] = ..., + ) -> None: ... + def get_draggable(self) -> bool: ... + @property + def legendHandles(self) -> list[Artist | None]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi b/contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi new file mode 100644 index 0000000000..db028a136a --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/legend_handler.pyi @@ -0,0 +1,294 @@ +from collections.abc import Callable, Sequence +from matplotlib.artist import Artist +from matplotlib.legend import Legend +from matplotlib.offsetbox import OffsetBox +from matplotlib.transforms import Transform + +from typing import TypeVar + +from numpy.typing import ArrayLike + +def update_from_first_child(tgt: Artist, src: Artist) -> None: ... + +class HandlerBase: + def __init__( + self, + xpad: float = ..., + ypad: float = ..., + update_func: Callable[[Artist, Artist], None] | None = ..., + ) -> None: ... + def update_prop( + self, legend_handle: Artist, orig_handle: Artist, legend: Legend + ) -> None: ... + def adjust_drawing_area( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + ) -> tuple[float, float, float, float]: ... + def legend_artist( + self, legend: Legend, orig_handle: Artist, fontsize: float, handlebox: OffsetBox + ) -> Artist: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerNpoints(HandlerBase): + def __init__( + self, marker_pad: float = ..., numpoints: int | None = ..., **kwargs + ) -> None: ... + def get_numpoints(self, legend: Legend) -> int | None: ... + def get_xdata( + self, + legend: Legend, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + ) -> tuple[ArrayLike, ArrayLike]: ... + +class HandlerNpointsYoffsets(HandlerNpoints): + def __init__( + self, + numpoints: int | None = ..., + yoffsets: Sequence[float] | None = ..., + **kwargs + ) -> None: ... + def get_ydata( + self, + legend: Legend, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + ) -> ArrayLike: ... + +class HandlerLine2DCompound(HandlerNpoints): + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerLine2D(HandlerNpoints): + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerPatch(HandlerBase): + def __init__(self, patch_func: Callable | None = ..., **kwargs) -> None: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerStepPatch(HandlerBase): + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerLineCollection(HandlerLine2D): + def get_numpoints(self, legend: Legend) -> int: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +_T = TypeVar("_T", bound=Artist) + +class HandlerRegularPolyCollection(HandlerNpointsYoffsets): + def __init__( + self, + yoffsets: Sequence[float] | None = ..., + sizes: Sequence[float] | None = ..., + **kwargs + ) -> None: ... + def get_numpoints(self, legend: Legend) -> int: ... + def get_sizes( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + ) -> Sequence[float]: ... + def update_prop( + self, legend_handle, orig_handle: Artist, legend: Legend + ) -> None: ... + def create_collection( + self, + orig_handle: _T, + sizes: Sequence[float] | None, + offsets: Sequence[float] | None, + offset_transform: Transform, + ) -> _T: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerPathCollection(HandlerRegularPolyCollection): + def create_collection( + self, + orig_handle: _T, + sizes: Sequence[float] | None, + offsets: Sequence[float] | None, + offset_transform: Transform, + ) -> _T: ... + +class HandlerCircleCollection(HandlerRegularPolyCollection): + def create_collection( + self, + orig_handle: _T, + sizes: Sequence[float] | None, + offsets: Sequence[float] | None, + offset_transform: Transform, + ) -> _T: ... + +class HandlerErrorbar(HandlerLine2D): + def __init__( + self, + xerr_size: float = ..., + yerr_size: float | None = ..., + marker_pad: float = ..., + numpoints: int | None = ..., + **kwargs + ) -> None: ... + def get_err_size( + self, + legend: Legend, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + ) -> tuple[float, float]: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerStem(HandlerNpointsYoffsets): + def __init__( + self, + marker_pad: float = ..., + numpoints: int | None = ..., + bottom: float | None = ..., + yoffsets: Sequence[float] | None = ..., + **kwargs + ) -> None: ... + def get_ydata( + self, + legend: Legend, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + ) -> ArrayLike: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerTuple(HandlerBase): + def __init__( + self, ndivide: int | None = ..., pad: float | None = ..., **kwargs + ) -> None: ... + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... + +class HandlerPolyCollection(HandlerBase): + def create_artists( + self, + legend: Legend, + orig_handle: Artist, + xdescent: float, + ydescent: float, + width: float, + height: float, + fontsize: float, + trans: Transform, + ) -> Sequence[Artist]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/lines.pyi b/contrib/python/matplotlib/py3/matplotlib/lines.pyi new file mode 100644 index 0000000000..c91e457e33 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/lines.pyi @@ -0,0 +1,153 @@ +from .artist import Artist +from .axes import Axes +from .backend_bases import MouseEvent, FigureCanvasBase +from .path import Path +from .transforms import Bbox, Transform + +from collections.abc import Callable, Sequence +from typing import Any, Literal, overload +from .typing import ( + ColorType, + DrawStyleType, + FillStyleType, + LineStyleType, + CapStyleType, + JoinStyleType, + MarkEveryType, + MarkerType, +) +from numpy.typing import ArrayLike + +def segment_hits( + cx: ArrayLike, cy: ArrayLike, x: ArrayLike, y: ArrayLike, radius: ArrayLike +) -> ArrayLike: ... + +class Line2D(Artist): + lineStyles: dict[str, str] + drawStyles: dict[str, str] + drawStyleKeys: list[str] + markers: dict[str | int, str] + filled_markers: tuple[str, ...] + fillStyles: tuple[str, ...] + zorder: float + ind_offset: float + def __init__( + self, + xdata: ArrayLike, + ydata: ArrayLike, + *, + linewidth: float | None = ..., + linestyle: LineStyleType | None = ..., + color: ColorType | None = ..., + gapcolor: ColorType | None = ..., + marker: MarkerType | None = ..., + markersize: float | None = ..., + markeredgewidth: float | None = ..., + markeredgecolor: ColorType | None = ..., + markerfacecolor: ColorType | None = ..., + markerfacecoloralt: ColorType = ..., + fillstyle: FillStyleType | None = ..., + antialiased: bool | None = ..., + dash_capstyle: CapStyleType | None = ..., + solid_capstyle: CapStyleType | None = ..., + dash_joinstyle: JoinStyleType | None = ..., + solid_joinstyle: JoinStyleType | None = ..., + pickradius: float = ..., + drawstyle: DrawStyleType | None = ..., + markevery: MarkEveryType | None = ..., + **kwargs + ) -> None: ... + def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict]: ... + def get_pickradius(self) -> float: ... + def set_pickradius(self, pickradius: float) -> None: ... + pickradius: float + def get_fillstyle(self) -> FillStyleType: ... + stale: bool + def set_fillstyle(self, fs: FillStyleType) -> None: ... + def set_markevery(self, every: MarkEveryType) -> None: ... + def get_markevery(self) -> MarkEveryType: ... + def set_picker( + self, p: None | bool | float | Callable[[Artist, MouseEvent], tuple[bool, dict]] + ) -> None: ... + def get_bbox(self) -> Bbox: ... + @overload + def set_data(self, args: ArrayLike) -> None: ... + @overload + def set_data(self, x: ArrayLike, y: ArrayLike) -> None: ... + def recache_always(self) -> None: ... + def recache(self, always: bool = ...) -> None: ... + def get_antialiased(self) -> bool: ... + def get_color(self) -> ColorType: ... + def get_drawstyle(self) -> DrawStyleType: ... + def get_gapcolor(self) -> ColorType: ... + def get_linestyle(self) -> LineStyleType: ... + def get_linewidth(self) -> float: ... + def get_marker(self) -> MarkerType: ... + def get_markeredgecolor(self) -> ColorType: ... + def get_markeredgewidth(self) -> float: ... + def get_markerfacecolor(self) -> ColorType: ... + def get_markerfacecoloralt(self) -> ColorType: ... + def get_markersize(self) -> float: ... + def get_data(self, orig: bool = ...) -> tuple[ArrayLike, ArrayLike]: ... + def get_xdata(self, orig: bool = ...) -> ArrayLike: ... + def get_ydata(self, orig: bool = ...) -> ArrayLike: ... + def get_path(self) -> Path: ... + def get_xydata(self) -> ArrayLike: ... + def set_antialiased(self, b: bool) -> None: ... + def set_color(self, color: ColorType) -> None: ... + def set_drawstyle(self, drawstyle: DrawStyleType | None) -> None: ... + def set_gapcolor(self, gapcolor: ColorType | None) -> None: ... + def set_linewidth(self, w: float) -> None: ... + def set_linestyle(self, ls: LineStyleType) -> None: ... + def set_marker(self, marker: MarkerType) -> None: ... + def set_markeredgecolor(self, ec: ColorType | None) -> None: ... + def set_markerfacecolor(self, fc: ColorType | None) -> None: ... + def set_markerfacecoloralt(self, fc: ColorType | None) -> None: ... + def set_markeredgewidth(self, ew: float | None) -> None: ... + def set_markersize(self, sz: float) -> None: ... + def set_xdata(self, x: ArrayLike) -> None: ... + def set_ydata(self, y: ArrayLike) -> None: ... + def set_dashes(self, seq: Sequence[float] | tuple[None, None]) -> None: ... + def update_from(self, other: Artist) -> None: ... + def set_dash_joinstyle(self, s: JoinStyleType) -> None: ... + def set_solid_joinstyle(self, s: JoinStyleType) -> None: ... + def get_dash_joinstyle(self) -> Literal["miter", "round", "bevel"]: ... + def get_solid_joinstyle(self) -> Literal["miter", "round", "bevel"]: ... + def set_dash_capstyle(self, s: CapStyleType) -> None: ... + def set_solid_capstyle(self, s: CapStyleType) -> None: ... + def get_dash_capstyle(self) -> Literal["butt", "projecting", "round"]: ... + def get_solid_capstyle(self) -> Literal["butt", "projecting", "round"]: ... + def is_dashed(self) -> bool: ... + +class AxLine(Line2D): + def __init__( + self, + xy1: tuple[float, float], + xy2: tuple[float, float] | None, + slope: float | None, + **kwargs + ) -> None: ... + def get_xy1(self) -> tuple[float, float] | None: ... + def get_xy2(self) -> tuple[float, float] | None: ... + def get_slope(self) -> float: ... + def set_xy1(self, x: float, y: float) -> None: ... + def set_xy2(self, x: float, y: float) -> None: ... + def set_slope(self, slope: float) -> None: ... + +class VertexSelector: + axes: Axes + line: Line2D + cid: int + ind: set[int] + def __init__(self, line: Line2D) -> None: ... + @property + def canvas(self) -> FigureCanvasBase: ... + def process_selected( + self, ind: Sequence[int], xs: ArrayLike, ys: ArrayLike + ) -> None: ... + def onpick(self, event: Any) -> None: ... + +lineStyles: dict[str, str] +lineMarkers: dict[str | int, str] +drawStyles: dict[str, str] +fillStyles: tuple[FillStyleType, ...] diff --git a/contrib/python/matplotlib/py3/matplotlib/markers.pyi b/contrib/python/matplotlib/py3/matplotlib/markers.pyi new file mode 100644 index 0000000000..3ee5388385 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/markers.pyi @@ -0,0 +1,51 @@ +from typing import Literal + +from .path import Path +from .transforms import Affine2D, Transform + +from numpy.typing import ArrayLike +from .typing import CapStyleType, FillStyleType, JoinStyleType + +TICKLEFT: int +TICKRIGHT: int +TICKUP: int +TICKDOWN: int +CARETLEFT: int +CARETRIGHT: int +CARETUP: int +CARETDOWN: int +CARETLEFTBASE: int +CARETRIGHTBASE: int +CARETUPBASE: int +CARETDOWNBASE: int + +class MarkerStyle: + markers: dict[str | int, str] + filled_markers: tuple[str, ...] + fillstyles: tuple[FillStyleType, ...] + + def __init__( + self, + marker: str | ArrayLike | Path | MarkerStyle | None, + fillstyle: FillStyleType | None = ..., + transform: Transform | None = ..., + capstyle: CapStyleType | None = ..., + joinstyle: JoinStyleType | None = ..., + ) -> None: ... + def __bool__(self) -> bool: ... + def is_filled(self) -> bool: ... + def get_fillstyle(self) -> FillStyleType: ... + def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ... + def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ... + def get_marker(self) -> str | ArrayLike | Path | None: ... + def get_path(self) -> Path: ... + def get_transform(self) -> Transform: ... + def get_alt_path(self) -> Path | None: ... + def get_alt_transform(self) -> Transform: ... + def get_snap_threshold(self) -> float | None: ... + def get_user_transform(self) -> Transform | None: ... + def transformed(self, transform: Affine2D) -> MarkerStyle: ... + def rotated( + self, *, deg: float | None = ..., rad: float | None = ... + ) -> MarkerStyle: ... + def scaled(self, sx: float, sy: float | None = ...) -> MarkerStyle: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/mathtext.pyi b/contrib/python/matplotlib/py3/matplotlib/mathtext.pyi new file mode 100644 index 0000000000..607501a275 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/mathtext.pyi @@ -0,0 +1,33 @@ +import os +from typing import Generic, IO, Literal, TypeVar, overload + +from matplotlib.font_manager import FontProperties +from matplotlib.typing import ColorType + +# Re-exported API from _mathtext. +from ._mathtext import ( + RasterParse as RasterParse, + VectorParse as VectorParse, + get_unicode_index as get_unicode_index, +) + +_ParseType = TypeVar("_ParseType", RasterParse, VectorParse) + +class MathTextParser(Generic[_ParseType]): + @overload + def __init__(self: MathTextParser[VectorParse], output: Literal["path"]) -> None: ... + @overload + def __init__(self: MathTextParser[RasterParse], output: Literal["agg", "raster", "macosx"]) -> None: ... + def parse( + self, s: str, dpi: float = ..., prop: FontProperties | None = ..., *, antialiased: bool | None = ... + ) -> _ParseType: ... + +def math_to_image( + s: str, + filename_or_obj: str | os.PathLike | IO, + prop: FontProperties | None = ..., + dpi: float | None = ..., + format: str | None = ..., + *, + color: ColorType | None = ... +) -> float: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/mlab.pyi b/contrib/python/matplotlib/py3/matplotlib/mlab.pyi new file mode 100644 index 0000000000..1f23288dd1 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/mlab.pyi @@ -0,0 +1,100 @@ +from collections.abc import Callable +import functools +from typing import Literal + +import numpy as np +from numpy.typing import ArrayLike + +def window_hanning(x: ArrayLike) -> ArrayLike: ... +def window_none(x: ArrayLike) -> ArrayLike: ... +def detrend( + x: ArrayLike, + key: Literal["default", "constant", "mean", "linear", "none"] + | Callable[[ArrayLike, int | None], ArrayLike] + | None = ..., + axis: int | None = ..., +) -> ArrayLike: ... +def detrend_mean(x: ArrayLike, axis: int | None = ...) -> ArrayLike: ... +def detrend_none(x: ArrayLike, axis: int | None = ...) -> ArrayLike: ... +def detrend_linear(y: ArrayLike) -> ArrayLike: ... +def psd( + x: ArrayLike, + NFFT: int | None = ..., + Fs: float | None = ..., + detrend: Literal["none", "mean", "linear"] + | Callable[[ArrayLike, int | None], ArrayLike] + | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + noverlap: int | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale_by_freq: bool | None = ..., +) -> tuple[ArrayLike, ArrayLike]: ... +def csd( + x: ArrayLike, + y: ArrayLike | None, + NFFT: int | None = ..., + Fs: float | None = ..., + detrend: Literal["none", "mean", "linear"] + | Callable[[ArrayLike, int | None], ArrayLike] + | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + noverlap: int | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale_by_freq: bool | None = ..., +) -> tuple[ArrayLike, ArrayLike]: ... + +complex_spectrum = functools.partial(tuple[ArrayLike, ArrayLike]) +magnitude_spectrum = functools.partial(tuple[ArrayLike, ArrayLike]) +angle_spectrum = functools.partial(tuple[ArrayLike, ArrayLike]) +phase_spectrum = functools.partial(tuple[ArrayLike, ArrayLike]) + +def specgram( + x: ArrayLike, + NFFT: int | None = ..., + Fs: float | None = ..., + detrend: Literal["none", "mean", "linear"] | Callable[[ArrayLike, int | None], ArrayLike] | None = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ..., + noverlap: int | None = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] | None = ..., + scale_by_freq: bool | None = ..., + mode: Literal["psd", "complex", "magnitude", "angle", "phase"] | None = ..., +) -> tuple[ArrayLike, ArrayLike, ArrayLike]: ... +def cohere( + x: ArrayLike, + y: ArrayLike, + NFFT: int = ..., + Fs: float = ..., + detrend: Literal["none", "mean", "linear"] | Callable[[ArrayLike, int | None], ArrayLike] = ..., + window: Callable[[ArrayLike], ArrayLike] | ArrayLike = ..., + noverlap: int = ..., + pad_to: int | None = ..., + sides: Literal["default", "onesided", "twosided"] = ..., + scale_by_freq: bool | None = ..., +) -> tuple[ArrayLike, ArrayLike]: ... + +class GaussianKDE: + dataset: ArrayLike + dim: int + num_dp: int + factor: float + data_covariance: ArrayLike + data_inv_cov: ArrayLike + covariance: ArrayLike + inv_cov: ArrayLike + norm_factor: float + def __init__( + self, + dataset: ArrayLike, + bw_method: Literal["scott", "silverman"] + | float + | Callable[[GaussianKDE], float] + | None = ..., + ) -> None: ... + def scotts_factor(self) -> float: ... + def silverman_factor(self) -> float: ... + def covariance_factor(self) -> float: ... + def evaluate(self, points: ArrayLike) -> np.ndarray: ... + def __call__(self, points: ArrayLike) -> np.ndarray: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi b/contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi new file mode 100644 index 0000000000..fdd6ce287f --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/offsetbox.pyi @@ -0,0 +1,321 @@ +import matplotlib.artist as martist +from matplotlib.backend_bases import RendererBase, Event, FigureCanvasBase +from matplotlib.colors import Colormap, Normalize +import matplotlib.text as mtext +from matplotlib.figure import Figure +from matplotlib.font_manager import FontProperties +from matplotlib.image import BboxImage +from matplotlib.patches import FancyArrowPatch, FancyBboxPatch +from matplotlib.transforms import Bbox, BboxBase, Transform + +import numpy as np +from numpy.typing import ArrayLike +from collections.abc import Callable, Sequence +from typing import Any, Literal, overload + +DEBUG: bool + +def bbox_artist(*args, **kwargs) -> None: ... +def _get_packed_offsets( + widths: Sequence[float], + total: float | None, + sep: float | None, + mode: Literal["fixed", "expand", "equal"] = ..., +) -> tuple[float, np.ndarray]: ... + +class OffsetBox(martist.Artist): + width: float | None + height: float | None + def __init__(self, *args, **kwargs) -> None: ... + def set_figure(self, fig: Figure) -> None: ... + def set_offset( + self, + xy: tuple[float, float] + | Callable[[float, float, float, float, RendererBase], tuple[float, float]], + ) -> None: ... + + @overload + def get_offset(self, bbox: Bbox, renderer: RendererBase) -> tuple[float, float]: ... + @overload + def get_offset( + self, + width: float, + height: float, + xdescent: float, + ydescent: float, + renderer: RendererBase + ) -> tuple[float, float]: ... + + def set_width(self, width: float) -> None: ... + def set_height(self, height: float) -> None: ... + def get_visible_children(self) -> list[martist.Artist]: ... + def get_children(self) -> list[martist.Artist]: ... + def get_bbox(self, renderer: RendererBase) -> Bbox: ... + def get_extent_offsets( + self, renderer: RendererBase + ) -> tuple[float, float, float, float, list[tuple[float, float]]]: ... + def get_extent( + self, renderer: RendererBase + ) -> tuple[float, float, float, float]: ... + def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... + +class PackerBase(OffsetBox): + height: float | None + width: float | None + sep: float | None + pad: float | None + mode: Literal["fixed", "expand", "equal"] + align: Literal["top", "bottom", "left", "right", "center", "baseline"] + def __init__( + self, + pad: float | None = ..., + sep: float | None = ..., + width: float | None = ..., + height: float | None = ..., + align: Literal["top", "bottom", "left", "right", "center", "baseline"] = ..., + mode: Literal["fixed", "expand", "equal"] = ..., + children: list[martist.Artist] | None = ..., + ) -> None: ... + +class VPacker(PackerBase): ... +class HPacker(PackerBase): ... + +class PaddedBox(OffsetBox): + pad: float | None + patch: FancyBboxPatch + def __init__( + self, + child: martist.Artist, + pad: float | None = ..., + *, + draw_frame: bool = ..., + patch_attrs: dict[str, Any] | None = ..., + ) -> None: ... + def update_frame(self, bbox: Bbox, fontsize: float | None = ...) -> None: ... + def draw_frame(self, renderer: RendererBase) -> None: ... + +class DrawingArea(OffsetBox): + width: float + height: float + xdescent: float + ydescent: float + offset_transform: Transform + dpi_transform: Transform + def __init__( + self, + width: float, + height: float, + xdescent: float = ..., + ydescent: float = ..., + clip: bool = ..., + ) -> None: ... + @property + def clip_children(self) -> bool: ... + @clip_children.setter + def clip_children(self, val: bool) -> None: ... + def get_transform(self) -> Transform: ... + + # does not accept all options of superclass + def set_offset(self, xy: tuple[float, float]) -> None: ... # type: ignore[override] + def get_offset(self) -> tuple[float, float]: ... # type: ignore[override] + def add_artist(self, a: martist.Artist) -> None: ... + +class TextArea(OffsetBox): + offset_transform: Transform + def __init__( + self, + s: str, + *, + textprops: dict[str, Any] | None = ..., + multilinebaseline: bool = ..., + ) -> None: ... + def set_text(self, s: str) -> None: ... + def get_text(self) -> str: ... + def set_multilinebaseline(self, t: bool) -> None: ... + def get_multilinebaseline(self) -> bool: ... + + # does not accept all options of superclass + def set_offset(self, xy: tuple[float, float]) -> None: ... # type: ignore[override] + def get_offset(self) -> tuple[float, float]: ... # type: ignore[override] + +class AuxTransformBox(OffsetBox): + aux_transform: Transform + offset_transform: Transform + ref_offset_transform: Transform + def __init__(self, aux_transform: Transform) -> None: ... + def add_artist(self, a: martist.Artist) -> None: ... + def get_transform(self) -> Transform: ... + + # does not accept all options of superclass + def set_offset(self, xy: tuple[float, float]) -> None: ... # type: ignore[override] + def get_offset(self) -> tuple[float, float]: ... # type: ignore[override] + +class AnchoredOffsetbox(OffsetBox): + zorder: float + codes: dict[str, int] + loc: int + borderpad: float + pad: float + prop: FontProperties + patch: FancyBboxPatch + def __init__( + self, + loc: str, + *, + pad: float = ..., + borderpad: float = ..., + child: OffsetBox | None = ..., + prop: FontProperties | None = ..., + frameon: bool = ..., + bbox_to_anchor: BboxBase + | tuple[float, float] + | tuple[float, float, float, float] + | None = ..., + bbox_transform: Transform | None = ..., + **kwargs + ) -> None: ... + def set_child(self, child: OffsetBox | None) -> None: ... + def get_child(self) -> OffsetBox | None: ... + def get_children(self) -> list[martist.Artist]: ... + def get_bbox_to_anchor(self) -> Bbox: ... + def set_bbox_to_anchor( + self, bbox: BboxBase, transform: Transform | None = ... + ) -> None: ... + def update_frame(self, bbox: Bbox, fontsize: float | None = ...) -> None: ... + +class AnchoredText(AnchoredOffsetbox): + txt: TextArea + def __init__( + self, + s: str, + loc: str, + *, + pad: float = ..., + borderpad: float = ..., + prop: dict[str, Any] | None = ..., + **kwargs + ) -> None: ... + +class OffsetImage(OffsetBox): + image: BboxImage + def __init__( + self, + arr: ArrayLike, + *, + zoom: float = ..., + cmap: Colormap | str | None = ..., + norm: Normalize | str | None = ..., + interpolation: str | None = ..., + origin: Literal["upper", "lower"] | None = ..., + filternorm: bool = ..., + filterrad: float = ..., + resample: bool = ..., + dpi_cor: bool = ..., + **kwargs + ) -> None: ... + stale: bool + def set_data(self, arr: ArrayLike | None) -> None: ... + def get_data(self) -> ArrayLike | None: ... + def set_zoom(self, zoom: float) -> None: ... + def get_zoom(self) -> float: ... + def get_children(self) -> list[martist.Artist]: ... + def get_offset(self) -> tuple[float, float]: ... # type: ignore[override] + +class AnnotationBbox(martist.Artist, mtext._AnnotationBase): + zorder: float + offsetbox: OffsetBox + arrowprops: dict[str, Any] | None + xybox: tuple[float, float] + boxcoords: str | tuple[str, str] | martist.Artist | Transform | Callable[ + [RendererBase], Bbox | Transform + ] + arrow_patch: FancyArrowPatch | None + patch: FancyBboxPatch + prop: FontProperties + def __init__( + self, + offsetbox: OffsetBox, + xy: tuple[float, float], + xybox: tuple[float, float] | None = ..., + xycoords: str + | tuple[str, str] + | martist.Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] = ..., + boxcoords: str + | tuple[str, str] + | martist.Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] + | None = ..., + *, + frameon: bool = ..., + pad: float = ..., + annotation_clip: bool | None = ..., + box_alignment: tuple[float, float] = ..., + bboxprops: dict[str, Any] | None = ..., + arrowprops: dict[str, Any] | None = ..., + fontsize: float | str | None = ..., + **kwargs + ) -> None: ... + @property + def xyann(self) -> tuple[float, float]: ... + @xyann.setter + def xyann(self, xyann: tuple[float, float]) -> None: ... + @property + def anncoords( + self, + ) -> str | tuple[str, str] | martist.Artist | Transform | Callable[ + [RendererBase], Bbox | Transform + ]: ... + @anncoords.setter + def anncoords( + self, + coords: str + | tuple[str, str] + | martist.Artist + | Transform + | Callable[[RendererBase], Bbox | Transform], + ) -> None: ... + def get_children(self) -> list[martist.Artist]: ... + def set_figure(self, fig: Figure) -> None: ... + def set_fontsize(self, s: str | float | None = ...) -> None: ... + def get_fontsize(self) -> float: ... + def get_tightbbox(self, renderer: RendererBase | None = ...) -> Bbox: ... + def update_positions(self, renderer: RendererBase) -> None: ... + +class DraggableBase: + ref_artist: martist.Artist + got_artist: bool + 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: ... + def on_release(self, event: Event) -> None: ... + def disconnect(self) -> None: ... + def save_offset(self) -> None: ... + def update_offset(self, dx: float, dy: float) -> None: ... + def finalize_offset(self) -> None: ... + +class DraggableOffsetBox(DraggableBase): + offsetbox: OffsetBox + def __init__( + self, ref_artist: martist.Artist, offsetbox: OffsetBox, use_blit: bool = ... + ) -> None: ... + def save_offset(self) -> None: ... + def update_offset(self, dx: float, dy: float) -> None: ... + def get_loc_in_canvas(self) -> tuple[float, float]: ... + +class DraggableAnnotation(DraggableBase): + annotation: mtext.Annotation + def __init__(self, annotation: mtext.Annotation, use_blit: bool = ...) -> None: ... + def save_offset(self) -> None: ... + def update_offset(self, dx: float, dy: float) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/patches.pyi b/contrib/python/matplotlib/py3/matplotlib/patches.pyi new file mode 100644 index 0000000000..29fe36aa6c --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/patches.pyi @@ -0,0 +1,751 @@ +from . import artist +from .axes import Axes +from .backend_bases import RendererBase, MouseEvent +from .path import Path +from .transforms import Transform, Bbox + +from typing import Any, Literal, overload + +import numpy as np +from numpy.typing import ArrayLike +from .typing import ColorType, LineStyleType, CapStyleType, JoinStyleType + +class Patch(artist.Artist): + zorder: float + def __init__( + self, + *, + edgecolor: ColorType | None = ..., + facecolor: ColorType | None = ..., + color: ColorType | None = ..., + linewidth: float | None = ..., + linestyle: LineStyleType | None = ..., + antialiased: bool | None = ..., + hatch: str | None = ..., + fill: bool = ..., + capstyle: CapStyleType | None = ..., + joinstyle: JoinStyleType | None = ..., + **kwargs, + ) -> None: ... + def get_verts(self) -> ArrayLike: ... + def contains(self, mouseevent: MouseEvent, radius: float | None = None) -> tuple[bool, dict[Any, Any]]: ... + def contains_point( + self, point: tuple[float, float], radius: float | None = ... + ) -> bool: ... + def contains_points( + self, points: ArrayLike, radius: float | None = ... + ) -> np.ndarray: ... + def get_extents(self) -> Bbox: ... + def get_transform(self) -> Transform: ... + def get_data_transform(self) -> Transform: ... + def get_patch_transform(self) -> Transform: ... + def get_antialiased(self) -> bool: ... + def get_edgecolor(self) -> ColorType: ... + def get_facecolor(self) -> ColorType: ... + def get_linewidth(self) -> float: ... + def get_linestyle(self) -> LineStyleType: ... + def set_antialiased(self, aa: bool | None) -> None: ... + def set_edgecolor(self, color: ColorType | None) -> None: ... + def set_facecolor(self, color: ColorType | None) -> None: ... + def set_color(self, c: ColorType | None) -> None: ... + def set_alpha(self, alpha: float | None) -> None: ... + def set_linewidth(self, w: float | None) -> None: ... + def set_linestyle(self, ls: LineStyleType | None) -> None: ... + def set_fill(self, b: bool) -> None: ... + def get_fill(self) -> bool: ... + fill = property(get_fill, set_fill) + def set_capstyle(self, s: CapStyleType) -> None: ... + def get_capstyle(self) -> Literal["butt", "projecting", "round"]: ... + def set_joinstyle(self, s: JoinStyleType) -> None: ... + def get_joinstyle(self) -> Literal["miter", "round", "bevel"]: ... + def set_hatch(self, hatch: str) -> None: ... + def get_hatch(self) -> str: ... + def get_path(self) -> Path: ... + +class Shadow(Patch): + patch: Patch + def __init__(self, patch: Patch, ox: float, oy: float, *, shade: float = ..., **kwargs) -> None: ... + +class Rectangle(Patch): + angle: float + def __init__( + self, + xy: tuple[float, float], + width: float, + height: float, + *, + angle: float = ..., + rotation_point: Literal["xy", "center"] | tuple[float, float] = ..., + **kwargs, + ) -> None: ... + @property + def rotation_point(self) -> Literal["xy", "center"] | tuple[float, float]: ... + @rotation_point.setter + def rotation_point( + self, value: Literal["xy", "center"] | tuple[float, float] + ) -> None: ... + def get_x(self) -> float: ... + def get_y(self) -> float: ... + def get_xy(self) -> tuple[float, float]: ... + def get_corners(self) -> np.ndarray: ... + def get_center(self) -> np.ndarray: ... + def get_width(self) -> float: ... + def get_height(self) -> float: ... + def get_angle(self) -> float: ... + def set_x(self, x: float) -> None: ... + def set_y(self, y: float) -> None: ... + def set_angle(self, angle: float) -> None: ... + def set_xy(self, xy: tuple[float, float]) -> None: ... + def set_width(self, w: float) -> None: ... + def set_height(self, h: float) -> None: ... + @overload + def set_bounds(self, args: tuple[float, float, float, float], /) -> None: ... + @overload + def set_bounds( + self, left: float, bottom: float, width: float, height: float, / + ) -> None: ... + def get_bbox(self) -> Bbox: ... + xy = property(get_xy, set_xy) + +class RegularPolygon(Patch): + xy: tuple[float, float] + numvertices: int + orientation: float + radius: float + def __init__( + self, + xy: tuple[float, float], + numVertices: int, + *, + radius: float = ..., + orientation: float = ..., + **kwargs, + ) -> None: ... + +class PathPatch(Patch): + def __init__(self, path: Path, **kwargs) -> None: ... + def set_path(self, path: Path) -> None: ... + +class StepPatch(PathPatch): + orientation: Literal["vertical", "horizontal"] + def __init__( + self, + values: ArrayLike, + edges: ArrayLike, + *, + orientation: Literal["vertical", "horizontal"] = ..., + baseline: float = ..., + **kwargs, + ) -> None: ... + + # NamedTuple StairData, defined in body of method + def get_data(self) -> tuple[np.ndarray, np.ndarray, float]: ... + def set_data( + self, + values: ArrayLike | None = ..., + edges: ArrayLike | None = ..., + baseline: float | None = ..., + ) -> None: ... + +class Polygon(Patch): + def __init__(self, xy: ArrayLike, *, closed: bool = ..., **kwargs) -> None: ... + def get_closed(self) -> bool: ... + def set_closed(self, closed: bool) -> None: ... + def get_xy(self) -> np.ndarray: ... + def set_xy(self, xy: ArrayLike) -> None: ... + xy = property(get_xy, set_xy) + +class Wedge(Patch): + center: tuple[float, float] + r: float + theta1: float + theta2: float + width: float | None + def __init__( + self, + center: tuple[float, float], + r: float, + theta1: float, + theta2: float, + *, + width: float | None = ..., + **kwargs, + ) -> None: ... + def set_center(self, center: tuple[float, float]) -> None: ... + def set_radius(self, radius: float) -> None: ... + def set_theta1(self, theta1: float) -> None: ... + def set_theta2(self, theta2: float) -> None: ... + def set_width(self, width: float | None) -> None: ... + +class Arrow(Patch): + def __init__( + self, x: float, y: float, dx: float, dy: float, *, width: float = ..., **kwargs + ) -> None: ... + +class FancyArrow(Polygon): + def __init__( + self, + x: float, + y: float, + dx: float, + dy: float, + *, + width: float = ..., + length_includes_head: bool = ..., + head_width: float | None = ..., + head_length: float | None = ..., + shape: Literal["full", "left", "right"] = ..., + overhang: float = ..., + head_starts_at_zero: bool = ..., + **kwargs, + ) -> None: ... + def set_data( + self, + *, + x: float | None = ..., + y: float | None = ..., + dx: float | None = ..., + dy: float | None = ..., + width: float | None = ..., + head_width: float | None = ..., + head_length: float | None = ..., + ) -> None: ... + +class CirclePolygon(RegularPolygon): + def __init__( + self, + xy: tuple[float, float], + radius: float = ..., + *, + resolution: int = ..., + **kwargs, + ) -> None: ... + +class Ellipse(Patch): + def __init__( + self, + xy: tuple[float, float], + width: float, + height: float, + *, + angle: float = ..., + **kwargs, + ) -> None: ... + def set_center(self, xy: tuple[float, float]) -> None: ... + def get_center(self) -> float: ... + center = property(get_center, set_center) + + def set_width(self, width: float) -> None: ... + def get_width(self) -> float: ... + width = property(get_width, set_width) + + def set_height(self, height: float) -> None: ... + def get_height(self) -> float: ... + height = property(get_height, set_height) + + def set_angle(self, angle: float) -> None: ... + def get_angle(self) -> float: ... + angle = property(get_angle, set_angle) + + def get_corners(self) -> np.ndarray: ... + + def get_vertices(self) -> list[tuple[float, float]]: ... + def get_co_vertices(self) -> list[tuple[float, float]]: ... + + +class Annulus(Patch): + a: float + b: float + def __init__( + self, + xy: tuple[float, float], + r: float | tuple[float, float], + width: float, + angle: float = ..., + **kwargs, + ) -> None: ... + def set_center(self, xy: tuple[float, float]) -> None: ... + def get_center(self) -> tuple[float, float]: ... + center = property(get_center, set_center) + + def set_width(self, width: float) -> None: ... + def get_width(self) -> float: ... + width = property(get_width, set_width) + + def set_angle(self, angle: float) -> None: ... + def get_angle(self) -> float: ... + angle = property(get_angle, set_angle) + + def set_semimajor(self, a: float) -> None: ... + def set_semiminor(self, b: float) -> None: ... + def set_radii(self, r: float | tuple[float, float]) -> None: ... + def get_radii(self) -> tuple[float, float]: ... + radii = property(get_radii, set_radii) + +class Circle(Ellipse): + def __init__( + self, xy: tuple[float, float], radius: float = ..., **kwargs + ) -> None: ... + def set_radius(self, radius: float) -> None: ... + def get_radius(self) -> float: ... + radius = property(get_radius, set_radius) + +class Arc(Ellipse): + theta1: float + theta2: float + def __init__( + self, + xy: tuple[float, float], + width: float, + height: float, + *, + angle: float = ..., + theta1: float = ..., + theta2: float = ..., + **kwargs, + ) -> None: ... + +def bbox_artist( + artist: artist.Artist, + renderer: RendererBase, + props: dict[str, Any] | None = ..., + fill: bool = ..., +) -> None: ... +def draw_bbox( + bbox: Bbox, + renderer: RendererBase, + color: ColorType = ..., + trans: Transform | None = ..., +) -> None: ... + +class _Style: + def __new__(cls, stylename, **kwargs): ... + @classmethod + def get_styles(cls) -> dict[str, type]: ... + @classmethod + def pprint_styles(cls) -> str: ... + @classmethod + def register(cls, name: str, style: type) -> None: ... + +class BoxStyle(_Style): + class Square(BoxStyle): + pad: float + def __init__(self, pad: float = ...) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class Circle(BoxStyle): + pad: float + def __init__(self, pad: float = ...) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class Ellipse(BoxStyle): + pad: float + def __init__(self, pad: float = ...) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class LArrow(BoxStyle): + pad: float + def __init__(self, pad: float = ...) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class RArrow(LArrow): + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class DArrow(BoxStyle): + pad: float + def __init__(self, pad: float = ...) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class Round(BoxStyle): + pad: float + rounding_size: float | None + def __init__( + self, pad: float = ..., rounding_size: float | None = ... + ) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class Round4(BoxStyle): + pad: float + rounding_size: float | None + def __init__( + self, pad: float = ..., rounding_size: float | None = ... + ) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class Sawtooth(BoxStyle): + pad: float + tooth_size: float | None + def __init__( + self, pad: float = ..., tooth_size: float | None = ... + ) -> None: ... + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + + class Roundtooth(Sawtooth): + def __call__( + self, + x0: float, + y0: float, + width: float, + height: float, + mutation_size: float, + ) -> Path: ... + +class ConnectionStyle(_Style): + class _Base(ConnectionStyle): + class SimpleEvent: + def __init__(self, xy: tuple[float, float]) -> None: ... + + def __call__( + self, + posA: tuple[float, float], + posB: tuple[float, float], + shrinkA: float = ..., + shrinkB: float = ..., + patchA: Patch | None = ..., + patchB: Patch | None = ..., + ) -> Path: ... + + class Arc3(_Base): + rad: float + def __init__(self, rad: float = ...) -> None: ... + def connect( + self, posA: tuple[float, float], posB: tuple[float, float] + ) -> Path: ... + + class Angle3(_Base): + angleA: float + angleB: float + def __init__(self, angleA: float = ..., angleB: float = ...) -> None: ... + def connect( + self, posA: tuple[float, float], posB: tuple[float, float] + ) -> Path: ... + + class Angle(_Base): + angleA: float + angleB: float + rad: float + def __init__( + self, angleA: float = ..., angleB: float = ..., rad: float = ... + ) -> None: ... + def connect( + self, posA: tuple[float, float], posB: tuple[float, float] + ) -> Path: ... + + class Arc(_Base): + angleA: float + angleB: float + armA: float | None + armB: float | None + rad: float + def __init__( + self, + angleA: float = ..., + angleB: float = ..., + armA: float | None = ..., + armB: float | None = ..., + rad: float = ..., + ) -> None: ... + def connect( + self, posA: tuple[float, float], posB: tuple[float, float] + ) -> Path: ... + + class Bar(_Base): + armA: float + armB: float + fraction: float + angle: float | None + def __init__( + self, + armA: float = ..., + armB: float = ..., + fraction: float = ..., + angle: float | None = ..., + ) -> None: ... + def connect( + self, posA: tuple[float, float], posB: tuple[float, float] + ) -> Path: ... + +class ArrowStyle(_Style): + class _Base(ArrowStyle): + @staticmethod + def ensure_quadratic_bezier(path: Path) -> list[float]: ... + def transmute( + self, path: Path, mutation_size: float, linewidth: float + ) -> tuple[Path, bool]: ... + def __call__( + self, + path: Path, + mutation_size: float, + linewidth: float, + aspect_ratio: float = ..., + ) -> tuple[Path, bool]: ... + + class _Curve(_Base): + arrow: str + fillbegin: bool + fillend: bool + def __init__( + self, + head_length: float = ..., + head_width: float = ..., + widthA: float = ..., + widthB: float = ..., + lengthA: float = ..., + lengthB: float = ..., + angleA: float | None = ..., + angleB: float | None = ..., + scaleA: float | None = ..., + scaleB: float | None = ..., + ) -> None: ... + + class Curve(_Curve): + def __init__(self) -> None: ... + + class CurveA(_Curve): + arrow: str + + class CurveB(_Curve): + arrow: str + + class CurveAB(_Curve): + arrow: str + + class CurveFilledA(_Curve): + arrow: str + + class CurveFilledB(_Curve): + arrow: str + + class CurveFilledAB(_Curve): + arrow: str + + class BracketA(_Curve): + arrow: str + def __init__( + self, widthA: float = ..., lengthA: float = ..., angleA: float = ... + ) -> None: ... + + class BracketB(_Curve): + arrow: str + def __init__( + self, widthB: float = ..., lengthB: float = ..., angleB: float = ... + ) -> None: ... + + class BracketAB(_Curve): + arrow: str + def __init__( + self, + widthA: float = ..., + lengthA: float = ..., + angleA: float = ..., + widthB: float = ..., + lengthB: float = ..., + angleB: float = ..., + ) -> None: ... + + class BarAB(_Curve): + arrow: str + def __init__( + self, + widthA: float = ..., + angleA: float = ..., + widthB: float = ..., + angleB: float = ..., + ) -> None: ... + + class BracketCurve(_Curve): + arrow: str + def __init__( + self, widthA: float = ..., lengthA: float = ..., angleA: float | None = ... + ) -> None: ... + + class CurveBracket(_Curve): + arrow: str + def __init__( + self, widthB: float = ..., lengthB: float = ..., angleB: float | None = ... + ) -> None: ... + + class Simple(_Base): + def __init__( + self, + head_length: float = ..., + head_width: float = ..., + tail_width: float = ..., + ) -> None: ... + + class Fancy(_Base): + def __init__( + self, + head_length: float = ..., + head_width: float = ..., + tail_width: float = ..., + ) -> None: ... + + class Wedge(_Base): + tail_width: float + shrink_factor: float + def __init__( + self, tail_width: float = ..., shrink_factor: float = ... + ) -> None: ... + +class FancyBboxPatch(Patch): + def __init__( + self, + xy: tuple[float, float], + width: float, + height: float, + boxstyle: str | BoxStyle = ..., + *, + mutation_scale: float = ..., + mutation_aspect: float = ..., + **kwargs, + ) -> None: ... + def set_boxstyle(self, boxstyle: str | BoxStyle | None = ..., **kwargs) -> None: ... + def get_boxstyle(self) -> BoxStyle: ... + def set_mutation_scale(self, scale: float) -> None: ... + def get_mutation_scale(self) -> float: ... + def set_mutation_aspect(self, aspect: float) -> None: ... + def get_mutation_aspect(self) -> float: ... + def get_x(self) -> float: ... + def get_y(self) -> float: ... + def get_width(self) -> float: ... + def get_height(self) -> float: ... + def set_x(self, x: float) -> None: ... + def set_y(self, y: float) -> None: ... + def set_width(self, w: float) -> None: ... + def set_height(self, h: float) -> None: ... + @overload + def set_bounds(self, args: tuple[float, float, float, float], /) -> None: ... + @overload + def set_bounds( + self, left: float, bottom: float, width: float, height: float, / + ) -> None: ... + def get_bbox(self) -> Bbox: ... + +class FancyArrowPatch(Patch): + patchA: Patch + patchB: Patch + shrinkA: float + shrinkB: float + def __init__( + self, + posA: tuple[float, float] | None = ..., + posB: tuple[float, float] | None = ..., + *, + path: Path | None = ..., + arrowstyle: str | ArrowStyle = ..., + connectionstyle: str | ConnectionStyle = ..., + patchA: Patch | None = ..., + patchB: Patch | None = ..., + shrinkA: float = ..., + shrinkB: float = ..., + mutation_scale: float = ..., + mutation_aspect: float | None = ..., + **kwargs, + ) -> None: ... + def set_positions( + self, posA: tuple[float, float], posB: tuple[float, float] + ) -> None: ... + def set_patchA(self, patchA: Patch) -> None: ... + def set_patchB(self, patchB: Patch) -> None: ... + def set_connectionstyle(self, connectionstyle: str | ConnectionStyle | None = ..., **kwargs) -> None: ... + def get_connectionstyle(self) -> ConnectionStyle: ... + def set_arrowstyle(self, arrowstyle: str | ArrowStyle | None = ..., **kwargs) -> None: ... + def get_arrowstyle(self) -> ArrowStyle: ... + def set_mutation_scale(self, scale: float) -> None: ... + def get_mutation_scale(self) -> float: ... + def set_mutation_aspect(self, aspect: float | None) -> None: ... + def get_mutation_aspect(self) -> float: ... + +class ConnectionPatch(FancyArrowPatch): + xy1: tuple[float, float] + xy2: tuple[float, float] + coords1: str | Transform + coords2: str | Transform | None + axesA: Axes | None + axesB: Axes | None + def __init__( + self, + xyA: tuple[float, float], + xyB: tuple[float, float], + coordsA: str | Transform, + coordsB: str | Transform | None = ..., + *, + axesA: Axes | None = ..., + axesB: Axes | None = ..., + arrowstyle: str | ArrowStyle = ..., + connectionstyle: str | ConnectionStyle = ..., + patchA: Patch | None = ..., + patchB: Patch | None = ..., + shrinkA: float = ..., + shrinkB: float = ..., + mutation_scale: float = ..., + mutation_aspect: float | None = ..., + clip_on: bool = ..., + **kwargs, + ) -> None: ... + def set_annotation_clip(self, b: bool | None) -> None: ... + def get_annotation_clip(self) -> bool | None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/path.pyi b/contrib/python/matplotlib/py3/matplotlib/path.pyi new file mode 100644 index 0000000000..464fc6d9a9 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/path.pyi @@ -0,0 +1,140 @@ +from .bezier import BezierSegment +from .transforms import Affine2D, Transform, Bbox +from collections.abc import Generator, Iterable, Sequence + +import numpy as np +from numpy.typing import ArrayLike + +from typing import Any, overload + +class Path: + code_type: type[np.uint8] + STOP: np.uint8 + MOVETO: np.uint8 + LINETO: np.uint8 + CURVE3: np.uint8 + CURVE4: np.uint8 + CLOSEPOLY: np.uint8 + NUM_VERTICES_FOR_CODE: dict[np.uint8, int] + + def __init__( + self, + vertices: ArrayLike, + codes: ArrayLike | None = ..., + _interpolation_steps: int = ..., + closed: bool = ..., + readonly: bool = ..., + ) -> None: ... + @property + def vertices(self) -> ArrayLike: ... + @vertices.setter + def vertices(self, vertices: ArrayLike) -> None: ... + @property + def codes(self) -> ArrayLike | None: ... + @codes.setter + def codes(self, codes: ArrayLike) -> None: ... + @property + def simplify_threshold(self) -> float: ... + @simplify_threshold.setter + def simplify_threshold(self, threshold: float) -> None: ... + @property + def should_simplify(self) -> bool: ... + @should_simplify.setter + def should_simplify(self, should_simplify: bool) -> None: ... + @property + def readonly(self) -> bool: ... + def copy(self) -> Path: ... + def __deepcopy__(self, memo: dict[int, Any] | None = ...) -> Path: ... + deepcopy = __deepcopy__ + + @classmethod + def make_compound_path_from_polys(cls, XY: ArrayLike) -> Path: ... + @classmethod + def make_compound_path(cls, *args: Path) -> Path: ... + def __len__(self) -> int: ... + def iter_segments( + self, + transform: Transform | None = ..., + remove_nans: bool = ..., + clip: tuple[float, float, float, float] | None = ..., + snap: bool | None = ..., + stroke_width: float = ..., + simplify: bool | None = ..., + curves: bool = ..., + sketch: tuple[float, float, float] | None = ..., + ) -> Generator[tuple[np.ndarray, np.uint8], None, None]: ... + def iter_bezier(self, **kwargs) -> Generator[BezierSegment, None, None]: ... + def cleaned( + self, + transform: Transform | None = ..., + remove_nans: bool = ..., + clip: tuple[float, float, float, float] | None = ..., + *, + simplify: bool | None = ..., + curves: bool = ..., + stroke_width: float = ..., + snap: bool | None = ..., + sketch: tuple[float, float, float] | None = ... + ) -> Path: ... + def transformed(self, transform: Transform) -> Path: ... + def contains_point( + self, + point: tuple[float, float], + transform: Transform | None = ..., + radius: float = ..., + ) -> bool: ... + def contains_points( + self, points: ArrayLike, transform: Transform | None = ..., radius: float = ... + ) -> np.ndarray: ... + def contains_path(self, path: Path, transform: Transform | None = ...) -> bool: ... + def get_extents(self, transform: Transform | None = ..., **kwargs) -> Bbox: ... + def intersects_path(self, other: Path, filled: bool = ...) -> bool: ... + def intersects_bbox(self, bbox: Bbox, filled: bool = ...) -> bool: ... + def interpolated(self, steps: int) -> Path: ... + def to_polygons( + self, + transform: Transform | None = ..., + width: float = ..., + height: float = ..., + closed_only: bool = ..., + ) -> list[ArrayLike]: ... + @classmethod + def unit_rectangle(cls) -> Path: ... + @classmethod + def unit_regular_polygon(cls, numVertices: int) -> Path: ... + @classmethod + def unit_regular_star(cls, numVertices: int, innerCircle: float = ...) -> Path: ... + @classmethod + def unit_regular_asterisk(cls, numVertices: int) -> Path: ... + @classmethod + def unit_circle(cls) -> Path: ... + @classmethod + def circle( + cls, + center: tuple[float, float] = ..., + radius: float = ..., + readonly: bool = ..., + ) -> Path: ... + @classmethod + def unit_circle_righthalf(cls) -> Path: ... + @classmethod + def arc( + cls, theta1: float, theta2: float, n: int | None = ..., is_wedge: bool = ... + ) -> Path: ... + @classmethod + def wedge(cls, theta1: float, theta2: float, n: int | None = ...) -> Path: ... + @overload + @staticmethod + def hatch(hatchpattern: str, density: float = ...) -> Path: ... + @overload + @staticmethod + def hatch(hatchpattern: None, density: float = ...) -> None: ... + def clip_to_bbox(self, bbox: Bbox, inside: bool = ...) -> Path: ... + +def get_path_collection_extents( + master_transform: Transform, + paths: Sequence[Path], + transforms: Iterable[Affine2D], + offsets: ArrayLike, + offset_transform: Affine2D, +) -> Bbox: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/patheffects.pyi b/contrib/python/matplotlib/py3/matplotlib/patheffects.pyi new file mode 100644 index 0000000000..5d8dcfeab6 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/patheffects.pyi @@ -0,0 +1,106 @@ +from collections.abc import Iterable, Sequence +from typing import Any + +from matplotlib.backend_bases import RendererBase, GraphicsContextBase +from matplotlib.path import Path +from matplotlib.patches import Patch +from matplotlib.transforms import Transform + +from matplotlib.typing import ColorType + +class AbstractPathEffect: + def __init__(self, offset: tuple[float, float] = ...) -> None: ... + def draw_path( + self, + renderer: RendererBase, + gc: GraphicsContextBase, + tpath: Path, + affine: Transform, + rgbFace: ColorType | None = ..., + ) -> None: ... + +class PathEffectRenderer(RendererBase): + def __init__( + self, path_effects: Iterable[AbstractPathEffect], renderer: RendererBase + ) -> None: ... + def copy_with_path_effect(self, path_effects: Iterable[AbstractPathEffect]) -> PathEffectRenderer: ... + def draw_path( + self, + gc: GraphicsContextBase, + tpath: Path, + affine: Transform, + rgbFace: ColorType | None = ..., + ) -> None: ... + def draw_markers( + self, + gc: GraphicsContextBase, + marker_path: Path, + marker_trans: Transform, + path: Path, + *args, + **kwargs + ) -> None: ... + def draw_path_collection( + self, + gc: GraphicsContextBase, + master_transform: Transform, + paths: Sequence[Path], + *args, + **kwargs + ) -> None: ... + def __getattribute__(self, name: str) -> Any: ... + +class Normal(AbstractPathEffect): ... + +class Stroke(AbstractPathEffect): + def __init__(self, offset: tuple[float, float] = ..., **kwargs) -> None: ... + # rgbFace becomes non-optional + def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore + +class withStroke(Stroke): ... + +class SimplePatchShadow(AbstractPathEffect): + def __init__( + self, + offset: tuple[float, float] = ..., + shadow_rgbFace: ColorType | None = ..., + alpha: float | None = ..., + rho: float = ..., + **kwargs + ) -> None: ... + # rgbFace becomes non-optional + def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore + +class withSimplePatchShadow(SimplePatchShadow): ... + +class SimpleLineShadow(AbstractPathEffect): + def __init__( + self, + offset: tuple[float, float] = ..., + shadow_color: ColorType = ..., + alpha: float = ..., + rho: float = ..., + **kwargs + ) -> None: ... + # rgbFace becomes non-optional + def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore + +class PathPatchEffect(AbstractPathEffect): + patch: Patch + def __init__(self, offset: tuple[float, float] = ..., **kwargs) -> None: ... + # rgbFace becomes non-optional + def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore + +class TickedStroke(AbstractPathEffect): + def __init__( + self, + offset: tuple[float, float] = ..., + spacing: float = ..., + angle: float = ..., + length: float = ..., + **kwargs + ) -> None: ... + # rgbFace becomes non-optional + def draw_path(self, renderer: RendererBase, gc: GraphicsContextBase, tpath: Path, affine: Transform, rgbFace: ColorType) -> None: ... # type: ignore + +class withTickedStroke(TickedStroke): ... diff --git a/contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi new file mode 100644 index 0000000000..0f8b6c0980 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/projections/__init__.pyi @@ -0,0 +1,15 @@ +from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes +from .polar import PolarAxes +from ..axes import Axes + +class ProjectionRegistry: + def __init__(self) -> None: ... + def register(self, *projections: type[Axes]) -> None: ... + def get_projection_class(self, name: str) -> type[Axes]: ... + def get_projection_names(self) -> list[str]: ... + +projection_registry: ProjectionRegistry + +def register_projection(cls: type[Axes]) -> None: ... +def get_projection_class(projection: str | None = ...) -> type[Axes]: ... +def get_projection_names() -> list[str]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi b/contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi new file mode 100644 index 0000000000..93220f8cbc --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/projections/geo.pyi @@ -0,0 +1,112 @@ +from matplotlib.axes import Axes +from matplotlib.ticker import Formatter +from matplotlib.transforms import Transform + +from typing import Any, Literal + +class GeoAxes(Axes): + class ThetaFormatter(Formatter): + def __init__(self, round_to: float = ...) -> None: ... + def __call__(self, x: float, pos: Any | None = ...): ... + RESOLUTION: float + def get_xaxis_transform( + self, which: Literal["tick1", "tick2", "grid"] = ... + ) -> Transform: ... + def get_xaxis_text1_transform( + self, pad: float + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_xaxis_text2_transform( + self, pad: float + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_yaxis_transform( + self, which: Literal["tick1", "tick2", "grid"] = ... + ) -> Transform: ... + def get_yaxis_text1_transform( + self, pad: float + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_yaxis_text2_transform( + self, pad: float + ) -> tuple[ + Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def set_xlim(self, *args, **kwargs) -> tuple[float, float]: ... + def set_ylim(self, *args, **kwargs) -> tuple[float, float]: ... + def format_coord(self, lon: float, lat: float) -> str: ... + def set_longitude_grid(self, degrees: float) -> None: ... + def set_latitude_grid(self, degrees: float) -> None: ... + def set_longitude_grid_ends(self, degrees: float) -> None: ... + def get_data_ratio(self) -> float: ... + def can_zoom(self) -> bool: ... + def can_pan(self) -> bool: ... + def start_pan(self, x, y, button) -> None: ... + def end_pan(self) -> None: ... + def drag_pan(self, button, key, x, y) -> None: ... + +class _GeoTransform(Transform): + input_dims: int + output_dims: int + def __init__(self, resolution: int) -> None: ... + +class AitoffAxes(GeoAxes): + name: str + + class AitoffTransform(_GeoTransform): + def inverted(self) -> AitoffAxes.InvertedAitoffTransform: ... + + class InvertedAitoffTransform(_GeoTransform): + def inverted(self) -> AitoffAxes.AitoffTransform: ... + +class HammerAxes(GeoAxes): + name: str + + class HammerTransform(_GeoTransform): + def inverted(self) -> HammerAxes.InvertedHammerTransform: ... + + class InvertedHammerTransform(_GeoTransform): + def inverted(self) -> HammerAxes.HammerTransform: ... + +class MollweideAxes(GeoAxes): + name: str + + class MollweideTransform(_GeoTransform): + def inverted(self) -> MollweideAxes.InvertedMollweideTransform: ... + + class InvertedMollweideTransform(_GeoTransform): + def inverted(self) -> MollweideAxes.MollweideTransform: ... + +class LambertAxes(GeoAxes): + name: str + + class LambertTransform(_GeoTransform): + def __init__( + self, center_longitude: float, center_latitude: float, resolution: int + ) -> None: ... + def inverted(self) -> LambertAxes.InvertedLambertTransform: ... + + class InvertedLambertTransform(_GeoTransform): + def __init__( + self, center_longitude: float, center_latitude: float, resolution: int + ) -> None: ... + def inverted(self) -> LambertAxes.LambertTransform: ... + + def __init__( + self, + *args, + center_longitude: float = ..., + center_latitude: float = ..., + **kwargs + ) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi b/contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi new file mode 100644 index 0000000000..2592d49471 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/projections/polar.pyi @@ -0,0 +1,196 @@ +import matplotlib.axis as maxis +import matplotlib.ticker as mticker +import matplotlib.transforms as mtransforms +from matplotlib.axes import Axes +from matplotlib.lines import Line2D +from matplotlib.text import Text + +import numpy as np +from numpy.typing import ArrayLike +from collections.abc import Sequence +from typing import Any, ClassVar, Literal, overload + +class PolarTransform(mtransforms.Transform): + input_dims: int + output_dims: int + def __init__( + self, + axis: PolarAxes | None = ..., + use_rmin: bool = ..., + _apply_theta_transforms: bool = ..., + *, + scale_transform: mtransforms.Transform | None = ..., + ) -> None: ... + def inverted(self) -> InvertedPolarTransform: ... + +class PolarAffine(mtransforms.Affine2DBase): + def __init__( + self, scale_transform: mtransforms.Transform, limits: mtransforms.BboxBase + ) -> None: ... + +class InvertedPolarTransform(mtransforms.Transform): + input_dims: int + output_dims: int + def __init__( + self, + axis: PolarAxes | None = ..., + use_rmin: bool = ..., + _apply_theta_transforms: bool = ..., + ) -> None: ... + def inverted(self) -> PolarTransform: ... + +class ThetaFormatter(mticker.Formatter): ... + +class _AxisWrapper: + def __init__(self, axis: maxis.Axis) -> None: ... + def get_view_interval(self) -> np.ndarray: ... + def set_view_interval(self, vmin: float, vmax: float) -> None: ... + def get_minpos(self) -> float: ... + def get_data_interval(self) -> np.ndarray: ... + def set_data_interval(self, vmin: float, vmax: float) -> None: ... + def get_tick_space(self) -> int: ... + +class ThetaLocator(mticker.Locator): + base: mticker.Locator + axis: _AxisWrapper | None + def __init__(self, base: mticker.Locator) -> None: ... + +class ThetaTick(maxis.XTick): + def __init__(self, axes: PolarAxes, *args, **kwargs) -> None: ... + +class ThetaAxis(maxis.XAxis): + axis_name: str + +class RadialLocator(mticker.Locator): + base: mticker.Locator + def __init__(self, base, axes: PolarAxes | None = ...) -> None: ... + +class RadialTick(maxis.YTick): ... + +class RadialAxis(maxis.YAxis): + axis_name: str + +class _WedgeBbox(mtransforms.Bbox): + def __init__( + self, + center: tuple[float, float], + viewLim: mtransforms.Bbox, + originLim: mtransforms.Bbox, + **kwargs, + ) -> 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__( + self, + *args, + theta_offset: float = ..., + theta_direction: float = ..., + rlabel_position: float = ..., + **kwargs, + ) -> None: ... + def get_xaxis_transform( + self, which: Literal["tick1", "tick2", "grid"] = ... + ) -> mtransforms.Transform: ... + def get_xaxis_text1_transform( + self, pad: float + ) -> tuple[ + mtransforms.Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_xaxis_text2_transform( + self, pad: float + ) -> tuple[ + mtransforms.Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_yaxis_transform( + self, which: Literal["tick1", "tick2", "grid"] = ... + ) -> mtransforms.Transform: ... + def get_yaxis_text1_transform( + self, pad: float + ) -> tuple[ + mtransforms.Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def get_yaxis_text2_transform( + self, pad: float + ) -> tuple[ + mtransforms.Transform, + Literal["center", "top", "bottom", "baseline", "center_baseline"], + Literal["center", "left", "right"], + ]: ... + def set_thetamax(self, thetamax: float) -> None: ... + def get_thetamax(self) -> float: ... + def set_thetamin(self, thetamin: float) -> None: ... + def get_thetamin(self) -> float: ... + @overload + def set_thetalim(self, minval: float, maxval: float, /) -> tuple[float, float]: ... + @overload + def set_thetalim(self, *, thetamin: float, thetamax: float) -> tuple[float, float]: ... + def set_theta_offset(self, offset: float) -> None: ... + def get_theta_offset(self) -> float: ... + def set_theta_zero_location( + self, + loc: Literal["N", "NW", "W", "SW", "S", "SE", "E", "NE"], + offset: float = ..., + ) -> None: ... + def set_theta_direction( + self, + direction: Literal[-1, 1, "clockwise", "counterclockwise", "anticlockwise"], + ) -> None: ... + def get_theta_direction(self) -> Literal[-1, 1]: ... + def set_rmax(self, rmax: float) -> None: ... + def get_rmax(self) -> float: ... + def set_rmin(self, rmin: float) -> None: ... + def get_rmin(self) -> float: ... + def set_rorigin(self, rorigin: float | None) -> None: ... + def get_rorigin(self) -> float: ... + def get_rsign(self) -> float: ... + def set_rlim( + self, + bottom: float | tuple[float, float] | None = ..., + top: float | None = ..., + *, + emit: bool = ..., + auto: bool = ..., + **kwargs, + ) -> tuple[float, float]: ... + def get_rlabel_position(self) -> float: ... + def set_rlabel_position(self, value: float) -> None: ... + def set_rscale(self, *args, **kwargs) -> None: ... + def set_rticks(self, *args, **kwargs) -> None: ... + def set_thetagrids( + self, + angles: ArrayLike, + labels: Sequence[str | Text] | None = ..., + fmt: str | None = ..., + **kwargs, + ) -> tuple[list[Line2D], list[Text]]: ... + def set_rgrids( + self, + radii: ArrayLike, + labels: Sequence[str | Text] | None = ..., + angle: float | None = ..., + fmt: str | None = ..., + **kwargs, + ) -> tuple[list[Line2D], list[Text]]: ... + def format_coord(self, theta: float, r: float) -> str: ... + def get_data_ratio(self) -> float: ... + def can_zoom(self) -> bool: ... + def can_pan(self) -> bool: ... + def start_pan(self, x: float, y: float, button: int) -> None: ... + def end_pan(self) -> None: ... + def drag_pan(self, button: Any, key: Any, x: float, y: float) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/quiver.pyi b/contrib/python/matplotlib/py3/matplotlib/quiver.pyi new file mode 100644 index 0000000000..c673c5dd3a --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/quiver.pyi @@ -0,0 +1,187 @@ +import matplotlib.artist as martist +import matplotlib.collections as mcollections +from matplotlib.axes import Axes +from matplotlib.figure import Figure +from matplotlib.text import Text +from matplotlib.transforms import Transform, Bbox + + +import numpy as np +from numpy.typing import ArrayLike +from collections.abc import Sequence +from typing import Any, Literal, overload +from matplotlib.typing import ColorType + +class QuiverKey(martist.Artist): + halign: dict[Literal["N", "S", "E", "W"], Literal["left", "center", "right"]] + valign: dict[Literal["N", "S", "E", "W"], Literal["top", "center", "bottom"]] + pivot: dict[Literal["N", "S", "E", "W"], Literal["middle", "tip", "tail"]] + Q: Quiver + X: float + Y: float + U: float + angle: float + coord: Literal["axes", "figure", "data", "inches"] + color: ColorType | None + label: str + labelpos: Literal["N", "S", "E", "W"] + labelcolor: ColorType | None + fontproperties: dict[str, Any] + kw: dict[str, Any] + text: Text + zorder: float + def __init__( + self, + Q: Quiver, + X: float, + Y: float, + U: float, + label: str, + *, + angle: float = ..., + coordinates: Literal["axes", "figure", "data", "inches"] = ..., + color: ColorType | None = ..., + labelsep: float = ..., + labelpos: Literal["N", "S", "E", "W"] = ..., + labelcolor: ColorType | None = ..., + fontproperties: dict[str, Any] | None = ..., + **kwargs + ) -> None: ... + @property + def labelsep(self) -> float: ... + def set_figure(self, fig: Figure) -> None: ... + +class Quiver(mcollections.PolyCollection): + X: ArrayLike + Y: ArrayLike + XY: ArrayLike + U: ArrayLike + V: ArrayLike + Umask: ArrayLike + N: int + scale: float | None + headwidth: float + headlength: float + headaxislength: float + minshaft: float + minlength: float + units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] + scale_units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] | None + angles: Literal["uv", "xy"] | ArrayLike + width: float | None + pivot: Literal["tail", "middle", "tip"] + transform: Transform + polykw: dict[str, Any] + + @overload + def __init__( + self, + ax: Axes, + U: ArrayLike, + V: ArrayLike, + C: ArrayLike = ..., + *, + scale: float | None = ..., + headwidth: float = ..., + headlength: float = ..., + headaxislength: float = ..., + minshaft: float = ..., + minlength: float = ..., + units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] = ..., + scale_units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] + | None = ..., + angles: Literal["uv", "xy"] | ArrayLike = ..., + width: float | None = ..., + color: ColorType | Sequence[ColorType] = ..., + pivot: Literal["tail", "mid", "middle", "tip"] = ..., + **kwargs + ) -> None: ... + @overload + def __init__( + self, + ax: Axes, + X: ArrayLike, + Y: ArrayLike, + U: ArrayLike, + V: ArrayLike, + C: ArrayLike = ..., + *, + scale: float | None = ..., + headwidth: float = ..., + headlength: float = ..., + headaxislength: float = ..., + minshaft: float = ..., + minlength: float = ..., + units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] = ..., + scale_units: Literal["width", "height", "dots", "inches", "x", "y", "xy"] + | None = ..., + angles: Literal["uv", "xy"] | ArrayLike = ..., + width: float | None = ..., + color: ColorType | Sequence[ColorType] = ..., + pivot: Literal["tail", "mid", "middle", "tip"] = ..., + **kwargs + ) -> None: ... + def get_datalim(self, transData: Transform) -> Bbox: ... + def set_UVC( + self, U: ArrayLike, V: ArrayLike, C: ArrayLike | None = ... + ) -> None: ... + @property + def quiver_doc(self) -> str: ... + +class Barbs(mcollections.PolyCollection): + sizes: dict[str, float] + fill_empty: bool + barb_increments: dict[str, float] + rounding: bool + flip: np.ndarray + x: ArrayLike + y: ArrayLike + u: ArrayLike + v: ArrayLike + + @overload + def __init__( + self, + ax: Axes, + U: ArrayLike, + V: ArrayLike, + C: ArrayLike = ..., + *, + pivot: str = ..., + length: int = ..., + barbcolor: ColorType | Sequence[ColorType] | None = ..., + flagcolor: ColorType | Sequence[ColorType] | None = ..., + sizes: dict[str, float] | None = ..., + fill_empty: bool = ..., + barb_increments: dict[str, float] | None = ..., + rounding: bool = ..., + flip_barb: bool | ArrayLike = ..., + **kwargs + ) -> None: ... + @overload + def __init__( + self, + ax: Axes, + X: ArrayLike, + Y: ArrayLike, + U: ArrayLike, + V: ArrayLike, + C: ArrayLike = ..., + *, + pivot: str = ..., + length: int = ..., + barbcolor: ColorType | Sequence[ColorType] | None = ..., + flagcolor: ColorType | Sequence[ColorType] | None = ..., + sizes: dict[str, float] | None = ..., + fill_empty: bool = ..., + barb_increments: dict[str, float] | None = ..., + rounding: bool = ..., + flip_barb: bool | ArrayLike = ..., + **kwargs + ) -> None: ... + def set_UVC( + self, U: ArrayLike, V: ArrayLike, C: ArrayLike | None = ... + ) -> None: ... + def set_offsets(self, xy: ArrayLike) -> None: ... + @property + def barbs_doc(self) -> str: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi b/contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi new file mode 100644 index 0000000000..70e94a7694 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/rcsetup.pyi @@ -0,0 +1,157 @@ +from cycler import Cycler + +from collections.abc import Callable, Iterable +from typing import Any, Literal, TypeVar +from matplotlib.typing import ColorType, LineStyleType, MarkEveryType + +interactive_bk: list[str] +non_interactive_bk: list[str] +all_backends: list[str] + +_T = TypeVar("_T") + +def _listify_validator(s: Callable[[Any], _T]) -> Callable[[Any], list[_T]]: ... + +class ValidateInStrings: + key: str + ignorecase: bool + valid: dict[str, str] + def __init__( + self, + key: str, + valid: Iterable[str], + ignorecase: bool = ..., + *, + _deprecated_since: str | None = ... + ) -> None: ... + def __call__(self, s: Any) -> str: ... + +def validate_any(s: Any) -> Any: ... +def validate_anylist(s: Any) -> list[Any]: ... +def validate_bool(b: Any) -> bool: ... +def validate_axisbelow(s: Any) -> bool | Literal["line"]: ... +def validate_dpi(s: Any) -> Literal["figure"] | float: ... +def validate_string(s: Any) -> str: ... +def validate_string_or_None(s: Any) -> str | None: ... +def validate_stringlist(s: Any) -> list[str]: ... +def validate_int(s: Any) -> int: ... +def validate_int_or_None(s: Any) -> int | None: ... +def validate_float(s: Any) -> float: ... +def validate_float_or_None(s: Any) -> float | None: ... +def validate_floatlist(s: Any) -> list[float]: ... +def validate_fonttype(s: Any) -> int: ... + +_auto_backend_sentinel: object + +def validate_backend(s: Any) -> str: ... +def validate_color_or_inherit(s: Any) -> Literal["inherit"] | ColorType: ... +def validate_color_or_auto(s: Any) -> ColorType | Literal["auto"]: ... +def validate_color_for_prop_cycle(s: Any) -> ColorType: ... +def validate_color(s: Any) -> ColorType: ... +def validate_colorlist(s: Any) -> list[ColorType]: ... +def _validate_color_or_linecolor( + s: Any, +) -> ColorType | Literal["linecolor", "markerfacecolor", "markeredgecolor"] | None: ... +def validate_aspect(s: Any) -> Literal["auto", "equal"] | float: ... +def validate_fontsize_None( + s: Any, +) -> Literal[ + "xx-small", + "x-small", + "small", + "medium", + "large", + "x-large", + "xx-large", + "smaller", + "larger", +] | float | None: ... +def validate_fontsize( + s: Any, +) -> Literal[ + "xx-small", + "x-small", + "small", + "medium", + "large", + "x-large", + "xx-large", + "smaller", + "larger", +] | float: ... +def validate_fontsizelist( + s: Any, +) -> list[ + Literal[ + "xx-small", + "x-small", + "small", + "medium", + "large", + "x-large", + "xx-large", + "smaller", + "larger", + ] + | float +]: ... +def validate_fontweight( + s: Any, +) -> Literal[ + "ultralight", + "light", + "normal", + "regular", + "book", + "medium", + "roman", + "semibold", + "demibold", + "demi", + "bold", + "heavy", + "extra bold", + "black", +] | int: ... +def validate_fontstretch( + s: Any, +) -> Literal[ + "ultra-condensed", + "extra-condensed", + "condensed", + "semi-condensed", + "normal", + "semi-expanded", + "expanded", + "extra-expanded", + "ultra-expanded", +] | int: ... +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"]: ... + +validate_fillstyle: ValidateInStrings + +def validate_fillstylelist( + s: Any, +) -> list[Literal["full", "left", "right", "bottom", "top", "none"]]: ... +def validate_markevery(s: Any) -> MarkEveryType: ... +def _validate_linestyle(s: Any) -> LineStyleType: ... +def validate_markeverylist(s: Any) -> list[MarkEveryType]: ... +def validate_bbox(s: Any) -> Literal["tight", "standard"] | None: ... +def validate_sketch(s: Any) -> None | tuple[float, float, float]: ... +def validate_hatch(s: Any) -> str: ... +def validate_hatchlist(s: Any) -> list[str]: ... +def validate_dashlist(s: Any) -> list[list[float]]: ... + +# TODO: copy cycler overloads? +def cycler(*args, **kwargs) -> Cycler: ... +def validate_cycler(s: Any) -> Cycler: ... +def validate_hist_bins( + s: Any, +) -> Literal["auto", "sturges", "fd", "doane", "scott", "rice", "sqrt"] | int | list[ + float +]: ... + +# At runtime is added in __init__.py +defaultParams: dict[str, Any] diff --git a/contrib/python/matplotlib/py3/matplotlib/sankey.pyi b/contrib/python/matplotlib/py3/matplotlib/sankey.pyi new file mode 100644 index 0000000000..4a40c31e3c --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/sankey.pyi @@ -0,0 +1,61 @@ +from matplotlib.axes import Axes + +from collections.abc import Callable, Iterable +from typing import Any + +import numpy as np + +__license__: str +__credits__: list[str] +__author__: str +__version__: str + +RIGHT: int +UP: int +DOWN: int + +# TODO typing units +class Sankey: + diagrams: list[Any] + ax: Axes + unit: Any + format: str | Callable[[float], str] + scale: float + gap: float + radius: float + shoulder: float + offset: float + margin: float + pitch: float + tolerance: float + extent: np.ndarray + def __init__( + self, + ax: Axes | None = ..., + scale: float = ..., + unit: Any = ..., + format: str | Callable[[float], str] = ..., + gap: float = ..., + radius: float = ..., + shoulder: float = ..., + offset: float = ..., + head_angle: float = ..., + margin: float = ..., + tolerance: float = ..., + **kwargs + ) -> None: ... + def add( + self, + patchlabel: str = ..., + flows: Iterable[float] | None = ..., + orientations: Iterable[int] | None = ..., + labels: str | Iterable[str | None] = ..., + trunklength: float = ..., + pathlengths: float | Iterable[float] = ..., + prior: int | None = ..., + connect: tuple[int, int] = ..., + rotation: float = ..., + **kwargs + # Replace return with Self when py3.9 is dropped + ) -> Sankey: ... + def finish(self) -> list[Any]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/scale.pyi b/contrib/python/matplotlib/py3/matplotlib/scale.pyi new file mode 100644 index 0000000000..7fec8e68cc --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/scale.pyi @@ -0,0 +1,178 @@ +from matplotlib.axis import Axis +from matplotlib.transforms import Transform + +from collections.abc import Callable, Iterable +from typing import Literal +from numpy.typing import ArrayLike + +class ScaleBase: + def __init__(self, axis: Axis | None) -> None: ... + def get_transform(self) -> Transform: ... + def set_default_locators_and_formatters(self, axis: Axis) -> None: ... + def limit_range_for_scale( + self, vmin: float, vmax: float, minpos: float + ) -> tuple[float, float]: ... + +class LinearScale(ScaleBase): + name: str + +class FuncTransform(Transform): + input_dims: int + output_dims: int + def __init__( + self, + forward: Callable[[ArrayLike], ArrayLike], + inverse: Callable[[ArrayLike], ArrayLike], + ) -> None: ... + def inverted(self) -> FuncTransform: ... + +class FuncScale(ScaleBase): + name: str + def __init__( + self, + axis: Axis | None, + functions: tuple[ + Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike] + ], + ) -> None: ... + +class LogTransform(Transform): + input_dims: int + output_dims: int + base: float + def __init__( + self, base: float, nonpositive: Literal["clip", "mask"] = ... + ) -> None: ... + def inverted(self) -> InvertedLogTransform: ... + +class InvertedLogTransform(Transform): + input_dims: int + output_dims: int + base: float + def __init__(self, base: float) -> None: ... + def inverted(self) -> LogTransform: ... + +class LogScale(ScaleBase): + name: str + subs: Iterable[int] | None + def __init__( + self, + axis: Axis | None, + *, + base: float = ..., + subs: Iterable[int] | None = ..., + nonpositive: Literal["clip", "mask"] = ... + ) -> None: ... + @property + def base(self) -> float: ... + def get_transform(self) -> Transform: ... + +class FuncScaleLog(LogScale): + def __init__( + self, + axis: Axis | None, + functions: tuple[ + Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike] + ], + base: float = ..., + ) -> None: ... + @property + def base(self) -> float: ... + def get_transform(self) -> Transform: ... + +class SymmetricalLogTransform(Transform): + input_dims: int + output_dims: int + base: float + linthresh: float + linscale: float + def __init__(self, base: float, linthresh: float, linscale: float) -> None: ... + def inverted(self) -> InvertedSymmetricalLogTransform: ... + +class InvertedSymmetricalLogTransform(Transform): + input_dims: int + output_dims: int + base: float + linthresh: float + invlinthresh: float + linscale: float + def __init__(self, base: float, linthresh: float, linscale: float) -> None: ... + def inverted(self) -> SymmetricalLogTransform: ... + +class SymmetricalLogScale(ScaleBase): + name: str + subs: Iterable[int] | None + def __init__( + self, + axis: Axis | None, + *, + base: float = ..., + linthresh: float = ..., + subs: Iterable[int] | None = ..., + linscale: float = ... + ) -> None: ... + @property + def base(self) -> float: ... + @property + def linthresh(self) -> float: ... + @property + def linscale(self) -> float: ... + def get_transform(self) -> SymmetricalLogTransform: ... + +class AsinhTransform(Transform): + input_dims: int + output_dims: int + linear_width: float + def __init__(self, linear_width: float) -> None: ... + def inverted(self) -> InvertedAsinhTransform: ... + +class InvertedAsinhTransform(Transform): + input_dims: int + output_dims: int + linear_width: float + def __init__(self, linear_width: float) -> None: ... + def inverted(self) -> AsinhTransform: ... + +class AsinhScale(ScaleBase): + name: str + auto_tick_multipliers: dict[int, tuple[int, ...]] + def __init__( + self, + axis: Axis | None, + *, + linear_width: float = ..., + base: float = ..., + subs: Iterable[int] | Literal["auto"] | None = ..., + **kwargs + ) -> None: ... + @property + def linear_width(self) -> float: ... + def get_transform(self) -> AsinhTransform: ... + +class LogitTransform(Transform): + input_dims: int + output_dims: int + def __init__(self, nonpositive: Literal["mask", "clip"] = ...) -> None: ... + def inverted(self) -> LogisticTransform: ... + +class LogisticTransform(Transform): + input_dims: int + output_dims: int + def __init__(self, nonpositive: Literal["mask", "clip"] = ...) -> None: ... + def inverted(self) -> LogitTransform: ... + +class LogitScale(ScaleBase): + name: str + def __init__( + self, + axis: Axis | None, + nonpositive: Literal["mask", "clip"] = ..., + *, + one_half: str = ..., + use_overline: bool = ... + ) -> None: ... + def get_transform(self) -> LogitTransform: ... + +def get_scale_names() -> list[str]: ... +def scale_factory(scale: str, axis: Axis, **kwargs) -> ScaleBase: ... +def register_scale(scale_class: type[ScaleBase]) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/spines.pyi b/contrib/python/matplotlib/py3/matplotlib/spines.pyi new file mode 100644 index 0000000000..0f06a6d1ce --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/spines.pyi @@ -0,0 +1,83 @@ +from collections.abc import Callable, Iterator, MutableMapping +from typing import Any, Literal, TypeVar, overload + +import matplotlib.patches as mpatches +from matplotlib.axes import Axes +from matplotlib.axis import Axis +from matplotlib.path import Path +from matplotlib.transforms import Transform +from matplotlib.typing import ColorType + +class Spine(mpatches.Patch): + axes: Axes + spine_type: str + axis: Axis | None + def __init__(self, axes: Axes, spine_type: str, path: Path, **kwargs) -> None: ... + def set_patch_arc( + self, center: tuple[float, float], radius: float, theta1: float, theta2: float + ) -> None: ... + def set_patch_circle(self, center: tuple[float, float], radius: float) -> None: ... + def set_patch_line(self) -> None: ... + def get_patch_transform(self) -> Transform: ... + def get_path(self) -> Path: ... + def register_axis(self, axis: Axis) -> None: ... + def clear(self) -> None: ... + def set_position( + self, + position: Literal["center", "zero"] + | tuple[Literal["outward", "axes", "data"], float], + ) -> None: ... + def get_position( + self, + ) -> Literal["center", "zero"] | tuple[ + Literal["outward", "axes", "data"], float + ]: ... + def get_spine_transform(self) -> Transform: ... + def set_bounds(self, low: float | None = ..., high: float | None = ...) -> None: ... + def get_bounds(self) -> tuple[float, float]: ... + + _T = TypeVar("_T", bound=Spine) + @classmethod + def linear_spine( + cls: type[_T], + axes: Axes, + spine_type: Literal["left", "right", "bottom", "top"], + **kwargs + ) -> _T: ... + @classmethod + def arc_spine( + cls: type[_T], + axes: Axes, + spine_type: Literal["left", "right", "bottom", "top"], + center: tuple[float, float], + radius: float, + theta1: float, + theta2: float, + **kwargs + ) -> _T: ... + @classmethod + def circular_spine( + cls: type[_T], axes: Axes, center: tuple[float, float], radius: float, **kwargs + ) -> _T: ... + def set_color(self, c: ColorType | None) -> None: ... + +class SpinesProxy: + def __init__(self, spine_dict: dict[str, Spine]) -> None: ... + def __getattr__(self, name: str) -> Callable[..., None]: ... + def __dir__(self) -> list[str]: ... + +class Spines(MutableMapping[str, Spine]): + def __init__(self, **kwargs: Spine) -> None: ... + @classmethod + def from_dict(cls, d: dict[str, Spine]) -> Spines: ... + def __getattr__(self, name: str) -> Spine: ... + @overload + def __getitem__(self, key: str) -> Spine: ... + @overload + def __getitem__(self, key: list[str]) -> SpinesProxy: ... + @overload + def __getitem__(self, key: slice) -> SpinesProxy: ... + def __setitem__(self, key: str, value: Spine) -> None: ... + def __delitem__(self, key: str) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/stackplot.pyi b/contrib/python/matplotlib/py3/matplotlib/stackplot.pyi new file mode 100644 index 0000000000..503e282665 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/stackplot.pyi @@ -0,0 +1,17 @@ +from matplotlib.axes import Axes +from matplotlib.collections import PolyCollection + +from collections.abc import Iterable +from typing import Literal +from numpy.typing import ArrayLike +from matplotlib.typing import ColorType + +def stackplot( + axes: Axes, + x: ArrayLike, + *args: ArrayLike, + labels: Iterable[str] = ..., + colors: Iterable[ColorType] | None = ..., + baseline: Literal["zero", "sym", "wiggle", "weighted_wiggle"] = ..., + **kwargs +) -> list[PolyCollection]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/streamplot.pyi b/contrib/python/matplotlib/py3/matplotlib/streamplot.pyi new file mode 100644 index 0000000000..9da83096e5 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/streamplot.pyi @@ -0,0 +1,82 @@ +from matplotlib.axes import Axes +from matplotlib.colors import Normalize, Colormap +from matplotlib.collections import LineCollection, PatchCollection +from matplotlib.patches import ArrowStyle +from matplotlib.transforms import Transform + +from typing import Literal +from numpy.typing import ArrayLike +from .typing import ColorType + +def streamplot( + axes: Axes, + x: ArrayLike, + y: ArrayLike, + u: ArrayLike, + v: ArrayLike, + density: float | tuple[float, float] = ..., + linewidth: float | ArrayLike | None = ..., + color: ColorType | ArrayLike | None = ..., + cmap: str | Colormap | None = ..., + norm: str | Normalize | None = ..., + arrowsize: float = ..., + arrowstyle: str | ArrowStyle = ..., + minlength: float = ..., + transform: Transform | None = ..., + zorder: float | None = ..., + start_points: ArrayLike | None = ..., + maxlength: float = ..., + integration_direction: Literal["forward", "backward", "both"] = ..., + broken_streamlines: bool = ..., +) -> StreamplotSet: ... + +class StreamplotSet: + lines: LineCollection + arrows: PatchCollection + def __init__(self, lines: LineCollection, arrows: PatchCollection) -> None: ... + +class DomainMap: + grid: Grid + mask: StreamMask + x_grid2mask: float + y_grid2mask: float + x_mask2grid: float + y_mask2grid: float + x_data2grid: float + y_data2grid: float + def __init__(self, grid: Grid, mask: StreamMask) -> None: ... + def grid2mask(self, xi: float, yi: float) -> tuple[int, int]: ... + def mask2grid(self, xm: float, ym: float) -> tuple[float, float]: ... + def data2grid(self, xd: float, yd: float) -> tuple[float, float]: ... + def grid2data(self, xg: float, yg: float) -> tuple[float, float]: ... + def start_trajectory( + self, xg: float, yg: float, broken_streamlines: bool = ... + ) -> None: ... + def reset_start_point(self, xg: float, yg: float) -> None: ... + def update_trajectory(self, xg, yg, broken_streamlines: bool = ...) -> None: ... + def undo_trajectory(self) -> None: ... + +class Grid: + nx: int + ny: int + dx: float + dy: float + x_origin: float + y_origin: float + width: float + height: float + def __init__(self, x: ArrayLike, y: ArrayLike) -> None: ... + @property + def shape(self) -> tuple[int, int]: ... + def within_grid(self, xi: float, yi: float) -> bool: ... + +class StreamMask: + nx: int + ny: int + shape: tuple[int, int] + def __init__(self, density: float | tuple[float, float]) -> None: ... + def __getitem__(self, args): ... + +class InvalidIndexError(Exception): ... +class TerminateTrajectory(Exception): ... +class OutOfBounds(IndexError): ... diff --git a/contrib/python/matplotlib/py3/matplotlib/style/core.pyi b/contrib/python/matplotlib/py3/matplotlib/style/core.pyi new file mode 100644 index 0000000000..7340049214 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/style/core.pyi @@ -0,0 +1,19 @@ +from collections.abc import Generator +import contextlib + +from matplotlib import RcParams +from matplotlib.typing import RcStyleType + +USER_LIBRARY_PATHS: list[str] = ... +STYLE_EXTENSION: str = ... + +def use(style: RcStyleType) -> None: ... +@contextlib.contextmanager +def context( + style: RcStyleType, after_reset: bool = ... +) -> Generator[None, None, None]: ... + +library: dict[str, RcParams] +available: list[str] + +def reload_library() -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/table.pyi b/contrib/python/matplotlib/py3/matplotlib/table.pyi new file mode 100644 index 0000000000..842c55edb5 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/table.pyi @@ -0,0 +1,85 @@ +from .artist import Artist +from .axes import Axes +from .backend_bases import RendererBase +from .patches import Rectangle +from .path import Path +from .text import Text +from .transforms import Bbox +from .typing import ColorType + +from collections.abc import Sequence +from typing import Any, Literal + +class Cell(Rectangle): + PAD: float + def __init__( + self, + xy: tuple[float, float], + width: float, + height: float, + *, + edgecolor: ColorType = ..., + facecolor: ColorType = ..., + fill: bool = ..., + text: str = ..., + loc: Literal["left", "center", "right"] | None = ..., + fontproperties: dict[str, Any] | None = ..., + visible_edges: str | None = ... + ) -> None: ... + def get_text(self) -> Text: ... + def set_fontsize(self, size: float) -> None: ... + def get_fontsize(self) -> float: ... + def auto_set_font_size(self, renderer: RendererBase) -> float: ... + def get_text_bounds( + self, renderer: RendererBase + ) -> tuple[float, float, float, float]: ... + def get_required_width(self, renderer: RendererBase) -> float: ... + def set_text_props(self, **kwargs) -> None: ... + @property + def visible_edges(self) -> str: ... + @visible_edges.setter + def visible_edges(self, value: str | None) -> None: ... + def get_path(self) -> Path: ... + +CustomCell = Cell + +class Table(Artist): + codes: dict[str, int] + FONTSIZE: float + AXESPAD: float + def __init__( + self, ax: Axes, loc: str | None = ..., bbox: Bbox | None = ..., **kwargs + ) -> None: ... + def add_cell(self, row: int, col: int, *args, **kwargs) -> Cell: ... + def __setitem__(self, position: tuple[int, int], cell: Cell) -> None: ... + def __getitem__(self, position: tuple[int, int]) -> Cell: ... + @property + def edges(self) -> str | None: ... + @edges.setter + def edges(self, value: str | None) -> None: ... + def draw(self, renderer) -> None: ... + def get_children(self) -> list[Artist]: ... + def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ... + def auto_set_column_width(self, col: int | Sequence[int]) -> None: ... + def auto_set_font_size(self, value: bool = ...) -> None: ... + def scale(self, xscale: float, yscale: float) -> None: ... + def set_fontsize(self, size: float) -> None: ... + def get_celld(self) -> dict[tuple[int, int], Cell]: ... + +def table( + ax: Axes, + cellText: Sequence[Sequence[str]] | None = ..., + cellColours: Sequence[Sequence[ColorType]] | None = ..., + cellLoc: Literal["left", "center", "right"] = ..., + colWidths: Sequence[float] | None = ..., + rowLabels: Sequence[str] | None = ..., + rowColours: Sequence[ColorType] | None = ..., + rowLoc: Literal["left", "center", "right"] = ..., + colLabels: Sequence[str] | None = ..., + colColours: Sequence[ColorType] | None = ..., + colLoc: Literal["left", "center", "right"] = ..., + loc: str = ..., + bbox: Bbox | None = ..., + edges: str = ..., + **kwargs +) -> Table: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi new file mode 100644 index 0000000000..30cfd9a9ed --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/testing/__init__.pyi @@ -0,0 +1,49 @@ +from collections.abc import Callable +import subprocess +from typing import Any, IO, Literal, overload + +def set_font_settings_for_testing() -> None: ... +def set_reproducibility_for_testing() -> None: ... +def setup() -> None: ... +@overload +def subprocess_run_for_testing( + command: list[str], + env: dict[str, str] | None = ..., + timeout: float | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., + check: bool = ..., + *, + text: Literal[True], + capture_output: bool = ..., +) -> subprocess.CompletedProcess[str]: ... +@overload +def subprocess_run_for_testing( + command: list[str], + env: dict[str, str] | None = ..., + timeout: float | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., + check: bool = ..., + text: Literal[False] = ..., + capture_output: bool = ..., +) -> subprocess.CompletedProcess[bytes]: ... +@overload +def subprocess_run_for_testing( + command: list[str], + env: dict[str, str] | None = ..., + timeout: float | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., + check: bool = ..., + text: bool = ..., + capture_output: bool = ..., +) -> subprocess.CompletedProcess[bytes] | subprocess.CompletedProcess[str]: ... +def subprocess_run_helper( + func: Callable[[], None], + *args: Any, + timeout: float, + extra_env: dict[str, str] | None = ..., +) -> subprocess.CompletedProcess[str]: ... +def _check_for_pgf(texsystem: str) -> bool: ... +def _has_tex_package(package: str) -> bool: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi new file mode 100644 index 0000000000..8f11b3bebc --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/testing/compare.pyi @@ -0,0 +1,32 @@ +from collections.abc import Callable +from typing import Literal, overload + +from numpy.typing import NDArray + +__all__ = ["calculate_rms", "comparable_formats", "compare_images"] + +def make_test_filename(fname: str, purpose: str) -> str: ... +def get_cache_dir() -> str: ... +def get_file_hash(path: str, block_size: int = ...) -> str: ... + +converter: dict[str, Callable[[str, str], None]] = {} + +def comparable_formats() -> list[str]: ... +def convert(filename: str, cache: bool) -> str: ... +def crop_to_same( + actual_path: str, actual_image: NDArray, expected_path: str, expected_image: NDArray +) -> tuple[NDArray, NDArray]: ... +def calculate_rms(expected_image: NDArray, actual_image: NDArray) -> float: ... +@overload +def compare_images( + expected: str, actual: str, tol: float, in_decorator: Literal[True] +) -> None | dict[str, float | str]: ... +@overload +def compare_images( + expected: str, actual: str, tol: float, in_decorator: Literal[False] +) -> None | str: ... +@overload +def compare_images( + expected: str, actual: str, tol: float, in_decorator: bool = ... +) -> None | str | dict[str, float | str]: ... +def save_diff_image(expected: str, actual: str, output: str) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi new file mode 100644 index 0000000000..2af0eb93cc --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/testing/conftest.pyi @@ -0,0 +1,12 @@ +from types import ModuleType + +import pytest + +def pytest_configure(config: pytest.Config) -> None: ... +def pytest_unconfigure(config: pytest.Config) -> None: ... +@pytest.fixture +def mpl_test_settings(request: pytest.FixtureRequest) -> None: ... +@pytest.fixture +def pd() -> ModuleType: ... +@pytest.fixture +def xr() -> ModuleType: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi new file mode 100644 index 0000000000..f1b6c5e595 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/testing/decorators.pyi @@ -0,0 +1,25 @@ +from collections.abc import Callable, Sequence +from pathlib import Path +from typing import Any, TypeVar +from typing_extensions import ParamSpec + +from matplotlib.figure import Figure +from matplotlib.typing import RcStyleType + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +def remove_ticks_and_titles(figure: Figure) -> None: ... +def image_comparison( + baseline_images: list[str] | None, + extensions: list[str] | None = ..., + tol: float = ..., + freetype_version: tuple[str, str] | str | None = ..., + remove_text: bool = ..., + savefig_kwarg: dict[str, Any] | None = ..., + style: RcStyleType = ..., +) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... +def check_figures_equal( + *, extensions: Sequence[str] = ..., tol: float = ... +) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... +def _image_directories(func: Callable) -> tuple[Path, Path]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi b/contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi new file mode 100644 index 0000000000..858ff45715 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/testing/widgets.pyi @@ -0,0 +1,31 @@ +from typing import Any, Literal + +from matplotlib.axes import Axes +from matplotlib.backend_bases import Event, MouseButton +from matplotlib.widgets import AxesWidget, Widget + +def get_ax() -> Axes: ... +def noop(*args: Any, **kwargs: Any) -> None: ... +def mock_event( + ax: Axes, + button: MouseButton | int | Literal["up", "down"] | None = ..., + xdata: float = ..., + ydata: float = ..., + key: str | None = ..., + step: int = ..., +) -> Event: ... +def do_event( + tool: AxesWidget, + etype: str, + button: MouseButton | int | Literal["up", "down"] | None = ..., + xdata: float = ..., + ydata: float = ..., + key: str | None = ..., + step: int = ..., +) -> None: ... +def click_and_drag( + tool: Widget, + start: tuple[float, float], + end: tuple[float, float], + key: str | None = ..., +) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/texmanager.pyi b/contrib/python/matplotlib/py3/matplotlib/texmanager.pyi new file mode 100644 index 0000000000..94f0d76fa8 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/texmanager.pyi @@ -0,0 +1,38 @@ +from .backend_bases import RendererBase + +from matplotlib.typing import ColorType + +import numpy as np + +class TexManager: + texcache: str + @classmethod + def get_basefile( + cls, tex: str, fontsize: float, dpi: float | None = ... + ) -> str: ... + @classmethod + def get_font_preamble(cls) -> str: ... + @classmethod + def get_custom_preamble(cls) -> str: ... + @classmethod + def make_tex(cls, tex: str, fontsize: float) -> str: ... + @classmethod + def make_dvi(cls, tex: str, fontsize: float) -> str: ... + @classmethod + def make_png(cls, tex: str, fontsize: float, dpi: float) -> str: ... + @classmethod + def get_grey( + cls, tex: str, fontsize: float | None = ..., dpi: float | None = ... + ) -> np.ndarray: ... + @classmethod + def get_rgba( + cls, + tex: str, + fontsize: float | None = ..., + dpi: float | None = ..., + rgb: ColorType = ..., + ) -> np.ndarray: ... + @classmethod + def get_text_width_height_descent( + cls, tex: str, fontsize, renderer: RendererBase | None = ... + ) -> tuple[int, int, int]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/text.pyi b/contrib/python/matplotlib/py3/matplotlib/text.pyi new file mode 100644 index 0000000000..6a83b1bbbe --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/text.pyi @@ -0,0 +1,214 @@ +from .artist import Artist +from .backend_bases import RendererBase +from .font_manager import FontProperties +from .offsetbox import DraggableAnnotation +from .path import Path +from .patches import FancyArrowPatch, FancyBboxPatch +from .textpath import ( # noqa: reexported API + TextPath as TextPath, + TextToPath as TextToPath, +) +from .transforms import ( + Bbox, + BboxBase, + Transform, +) + +from collections.abc import Callable, Iterable +from typing import Any, Literal +from .typing import ColorType + +class Text(Artist): + zorder: float + def __init__( + self, + x: float = ..., + y: float = ..., + text: Any = ..., + *, + color: ColorType | None = ..., + verticalalignment: Literal[ + "bottom", "baseline", "center", "center_baseline", "top" + ] = ..., + horizontalalignment: Literal["left", "center", "right"] = ..., + multialignment: Literal["left", "center", "right"] | None = ..., + fontproperties: str | Path | FontProperties | None = ..., + rotation: float | Literal["vertical", "horizontal"] | None = ..., + linespacing: float | None = ..., + rotation_mode: Literal["default", "anchor"] | None = ..., + usetex: bool | None = ..., + wrap: bool = ..., + transform_rotates_text: bool = ..., + parse_math: bool | None = ..., + antialiased: bool | None = ..., + **kwargs + ) -> None: ... + def update(self, kwargs: dict[str, Any]) -> list[Any]: ... + def get_rotation(self) -> float: ... + def get_transform_rotates_text(self) -> bool: ... + def set_rotation_mode(self, m: None | Literal["default", "anchor"]) -> None: ... + def get_rotation_mode(self) -> Literal["default", "anchor"]: ... + def set_bbox(self, rectprops: dict[str, Any]) -> None: ... + def get_bbox_patch(self) -> None | FancyBboxPatch: ... + def update_bbox_position_size(self, renderer: RendererBase) -> None: ... + def get_wrap(self) -> bool: ... + def set_wrap(self, wrap: bool) -> None: ... + def get_color(self) -> ColorType: ... + def get_fontproperties(self) -> FontProperties: ... + def get_fontfamily(self) -> list[str]: ... + def get_fontname(self) -> str: ... + def get_fontstyle(self) -> Literal["normal", "italic", "oblique"]: ... + def get_fontsize(self) -> float | str: ... + def get_fontvariant(self) -> Literal["normal", "small-caps"]: ... + def get_fontweight(self) -> int | str: ... + def get_stretch(self) -> int | str: ... + def get_horizontalalignment(self) -> Literal["left", "center", "right"]: ... + def get_unitless_position(self) -> tuple[float, float]: ... + def get_position(self) -> tuple[float, float]: ... + def get_text(self) -> str: ... + def get_verticalalignment( + self, + ) -> Literal["bottom", "baseline", "center", "center_baseline", "top"]: ... + def get_window_extent( + self, renderer: RendererBase | None = ..., dpi: float | None = ... + ) -> Bbox: ... + def set_backgroundcolor(self, color: ColorType) -> None: ... + def set_color(self, color: ColorType) -> None: ... + def set_horizontalalignment( + self, align: Literal["left", "center", "right"] + ) -> None: ... + def set_multialignment(self, align: Literal["left", "center", "right"]) -> None: ... + def set_linespacing(self, spacing: float) -> None: ... + def set_fontfamily(self, fontname: str | Iterable[str]) -> None: ... + def set_fontvariant(self, variant: Literal["normal", "small-caps"]) -> None: ... + def set_fontstyle( + self, fontstyle: Literal["normal", "italic", "oblique"] + ) -> None: ... + def set_fontsize(self, fontsize: float | str) -> None: ... + def get_math_fontfamily(self) -> str: ... + def set_math_fontfamily(self, fontfamily: str) -> None: ... + def set_fontweight(self, weight: int | str) -> None: ... + def set_fontstretch(self, stretch: int | str) -> None: ... + def set_position(self, xy: tuple[float, float]) -> None: ... + def set_x(self, x: float) -> None: ... + def set_y(self, y: float) -> None: ... + def set_rotation(self, s: float) -> None: ... + def set_transform_rotates_text(self, t: bool) -> None: ... + def set_verticalalignment( + self, align: Literal["bottom", "baseline", "center", "center_baseline", "top"] + ) -> None: ... + def set_text(self, s: Any) -> None: ... + def set_fontproperties(self, fp: FontProperties | str | Path | None) -> None: ... + def set_usetex(self, usetex: bool | None) -> None: ... + def get_usetex(self) -> bool: ... + def set_parse_math(self, parse_math: bool) -> None: ... + def get_parse_math(self) -> bool: ... + def set_fontname(self, fontname: str | Iterable[str]) -> None: ... + def get_antialiased(self) -> bool: ... + def set_antialiased(self, antialiased: bool) -> None: ... + +class OffsetFrom: + def __init__( + self, + artist: Artist | BboxBase | Transform, + ref_coord: tuple[float, float], + unit: Literal["points", "pixels"] = ..., + ) -> None: ... + def set_unit(self, unit: Literal["points", "pixels"]) -> None: ... + def get_unit(self) -> Literal["points", "pixels"]: ... + def __call__(self, renderer: RendererBase) -> Transform: ... + +class _AnnotationBase: + xy: tuple[float, float] + xycoords: str | tuple[str, str] | Artist | Transform | Callable[ + [RendererBase], Bbox | Transform + ] + def __init__( + self, + xy, + xycoords: str + | tuple[str, str] + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] = ..., + annotation_clip: bool | None = ..., + ) -> None: ... + def set_annotation_clip(self, b: bool | None) -> None: ... + def get_annotation_clip(self) -> bool | None: ... + def draggable( + self, state: bool | None = ..., use_blit: bool = ... + ) -> DraggableAnnotation | None: ... + +class Annotation(Text, _AnnotationBase): + arrowprops: dict[str, Any] | None + arrow_patch: FancyArrowPatch | None + def __init__( + self, + text: str, + xy: tuple[float, float], + xytext: tuple[float, float] | None = ..., + xycoords: str + | tuple[str, str] + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] = ..., + textcoords: str + | tuple[str, str] + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform] + | None = ..., + arrowprops: dict[str, Any] | None = ..., + annotation_clip: bool | None = ..., + **kwargs + ) -> None: ... + @property + def xycoords( + self, + ) -> str | tuple[str, str] | Artist | Transform | Callable[ + [RendererBase], Bbox | Transform + ]: ... + @xycoords.setter + def xycoords( + self, + xycoords: str + | tuple[str, str] + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform], + ) -> None: ... + @property + def xyann(self) -> tuple[float, float]: ... + @xyann.setter + def xyann(self, xytext: tuple[float, float]) -> None: ... + def get_anncoords( + self, + ) -> str | tuple[str, str] | Artist | Transform | Callable[ + [RendererBase], Bbox | Transform + ]: ... + def set_anncoords( + self, + coords: str + | tuple[str, str] + | Artist + | Transform + | Callable[[RendererBase], Bbox | Transform], + ) -> None: ... + @property + def anncoords( + self, + ) -> str | tuple[str, str] | Artist | Transform | Callable[ + [RendererBase], Bbox | Transform + ]: ... + @anncoords.setter + def anncoords( + self, + coords: str + | tuple[str, str] + | Artist + | Transform + | 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] diff --git a/contrib/python/matplotlib/py3/matplotlib/textpath.pyi b/contrib/python/matplotlib/py3/matplotlib/textpath.pyi new file mode 100644 index 0000000000..34d4e92ac4 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/textpath.pyi @@ -0,0 +1,74 @@ +from matplotlib.font_manager import FontProperties +from matplotlib.ft2font import FT2Font +from matplotlib.mathtext import MathTextParser, VectorParse +from matplotlib.path import Path + +import numpy as np + +from typing import Literal + +class TextToPath: + FONT_SCALE: float + DPI: float + mathtext_parser: MathTextParser[VectorParse] + def __init__(self) -> None: ... + def get_text_width_height_descent( + self, s: str, prop: FontProperties, ismath: bool | Literal["TeX"] + ) -> tuple[float, float, float]: ... + def get_text_path( + self, prop: FontProperties, s: str, ismath: bool | Literal["TeX"] = ... + ) -> list[np.ndarray]: ... + def get_glyphs_with_font( + self, + font: FT2Font, + s: str, + glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ..., + return_new_glyphs_only: bool = ..., + ) -> tuple[ + list[tuple[str, float, float, float]], + dict[str, tuple[np.ndarray, np.ndarray]], + list[tuple[list[tuple[float, float]], list[int]]], + ]: ... + def get_glyphs_mathtext( + self, + prop: FontProperties, + s: str, + glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ..., + return_new_glyphs_only: bool = ..., + ) -> tuple[ + list[tuple[str, float, float, float]], + dict[str, tuple[np.ndarray, np.ndarray]], + list[tuple[list[tuple[float, float]], list[int]]], + ]: ... + def get_glyphs_tex( + self, + prop: FontProperties, + s: str, + glyph_map: dict[str, tuple[np.ndarray, np.ndarray]] | None = ..., + return_new_glyphs_only: bool = ..., + ) -> tuple[ + list[tuple[str, float, float, float]], + dict[str, tuple[np.ndarray, np.ndarray]], + list[tuple[list[tuple[float, float]], list[int]]], + ]: ... + +text_to_path: TextToPath + +class TextPath(Path): + def __init__( + self, + xy: tuple[float, float], + s: str, + size: float | None = ..., + prop: FontProperties | None = ..., + _interpolation_steps: int = ..., + usetex: bool = ..., + ) -> None: ... + def set_size(self, size: float | None) -> None: ... + def get_size(self) -> float | None: ... + + # These are read only... there actually are protections in the base class, so probably can be deleted... + @property # type: ignore[misc] + def vertices(self) -> np.ndarray: ... # type: ignore[override] + @property # type: ignore[misc] + def codes(self) -> np.ndarray: ... # type: ignore[override] diff --git a/contrib/python/matplotlib/py3/matplotlib/ticker.pyi b/contrib/python/matplotlib/py3/matplotlib/ticker.pyi new file mode 100644 index 0000000000..f026b4943c --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/ticker.pyi @@ -0,0 +1,301 @@ +from collections.abc import Callable, Sequence +from typing import Any, Literal + +from matplotlib.axis import Axis +from matplotlib.transforms import Transform +from matplotlib.projections.polar import _AxisWrapper + +import numpy as np + +class _DummyAxis: + __name__: str + def __init__(self, minpos: float = ...) -> None: ... + def get_view_interval(self) -> tuple[float, float]: ... + def set_view_interval(self, vmin: float, vmax: float) -> None: ... + def get_minpos(self) -> float: ... + def get_data_interval(self) -> tuple[float, float]: ... + def set_data_interval(self, vmin: float, vmax: float) -> None: ... + def get_tick_space(self) -> int: ... + +class TickHelper: + axis: None | Axis | _DummyAxis | _AxisWrapper + def set_axis(self, axis: Axis | _DummyAxis | _AxisWrapper | None) -> None: ... + def create_dummy_axis(self, **kwargs) -> None: ... + +class Formatter(TickHelper): + locs: list[float] + def __call__(self, x: float, pos: int | None = ...) -> str: ... + def format_ticks(self, values: list[float]) -> list[str]: ... + def format_data(self, value: float) -> str: ... + def format_data_short(self, value: float) -> str: ... + def get_offset(self) -> str: ... + def set_locs(self, locs: list[float]) -> None: ... + @staticmethod + def fix_minus(s: str) -> str: ... + +class NullFormatter(Formatter): ... + +class FixedFormatter(Formatter): + seq: Sequence[str] + offset_string: str + def __init__(self, seq: Sequence[str]) -> None: ... + def set_offset_string(self, ofs: str) -> None: ... + +class FuncFormatter(Formatter): + func: Callable[[float, int | None], str] + offset_string: str + # Callable[[float, int | None], str] | Callable[[float], str] + def __init__(self, func: Callable[..., str]) -> None: ... + def set_offset_string(self, ofs: str) -> None: ... + +class FormatStrFormatter(Formatter): + fmt: str + def __init__(self, fmt: str) -> None: ... + +class StrMethodFormatter(Formatter): + fmt: str + def __init__(self, fmt: str) -> None: ... + +class ScalarFormatter(Formatter): + orderOfMagnitude: int + format: str + def __init__( + self, + useOffset: bool | float | None = ..., + useMathText: bool | None = ..., + useLocale: bool | None = ..., + ) -> None: ... + offset: float + def get_useOffset(self) -> bool: ... + def set_useOffset(self, val: bool | float) -> None: ... + @property + def useOffset(self) -> bool: ... + @useOffset.setter + def useOffset(self, val: bool | float) -> None: ... + def get_useLocale(self) -> bool: ... + def set_useLocale(self, val: bool | None) -> None: ... + @property + def useLocale(self) -> bool: ... + @useLocale.setter + def useLocale(self, val: bool | None) -> None: ... + def get_useMathText(self) -> bool: ... + def set_useMathText(self, val: bool | None) -> None: ... + @property + def useMathText(self) -> bool: ... + @useMathText.setter + def useMathText(self, val: bool | None) -> None: ... + def set_scientific(self, b: bool) -> None: ... + def set_powerlimits(self, lims: tuple[int, int]) -> None: ... + def format_data_short(self, value: float | np.ma.MaskedArray) -> str: ... + def format_data(self, value: float) -> str: ... + +class LogFormatter(Formatter): + minor_thresholds: tuple[float, float] + def __init__( + self, + base: float = ..., + labelOnlyBase: bool = ..., + minor_thresholds: tuple[float, float] | None = ..., + linthresh: float | None = ..., + ) -> None: ... + def set_base(self, base: float) -> None: ... + labelOnlyBase: bool + def set_label_minor(self, labelOnlyBase: bool) -> None: ... + def set_locs(self, locs: Any | None = ...) -> None: ... + def format_data(self, value: float) -> str: ... + def format_data_short(self, value: float) -> str: ... + +class LogFormatterExponent(LogFormatter): ... +class LogFormatterMathtext(LogFormatter): ... +class LogFormatterSciNotation(LogFormatterMathtext): ... + +class LogitFormatter(Formatter): + def __init__( + self, + *, + use_overline: bool = ..., + one_half: str = ..., + minor: bool = ..., + minor_threshold: int = ..., + minor_number: int = ... + ) -> None: ... + def use_overline(self, use_overline: bool) -> None: ... + def set_one_half(self, one_half: str) -> None: ... + def set_minor_threshold(self, minor_threshold: int) -> None: ... + def set_minor_number(self, minor_number: int) -> None: ... + def format_data_short(self, value: float) -> str: ... + +class EngFormatter(Formatter): + ENG_PREFIXES: dict[int, str] + unit: str + places: int | None + sep: str + def __init__( + self, + unit: str = ..., + places: int | None = ..., + sep: str = ..., + *, + usetex: bool | None = ..., + useMathText: bool | None = ... + ) -> None: ... + def get_usetex(self) -> bool: ... + def set_usetex(self, val: bool | None) -> None: ... + @property + def usetex(self) -> bool: ... + @usetex.setter + def usetex(self, val: bool | None) -> None: ... + def get_useMathText(self) -> bool: ... + def set_useMathText(self, val: bool | None) -> None: ... + @property + def useMathText(self) -> bool: ... + @useMathText.setter + def useMathText(self, val: bool | None) -> None: ... + def format_eng(self, num: float) -> str: ... + +class PercentFormatter(Formatter): + xmax: float + decimals: int | None + def __init__( + self, + xmax: float = ..., + decimals: int | None = ..., + symbol: str | None = ..., + is_latex: bool = ..., + ) -> None: ... + def format_pct(self, x: float, display_range: float) -> str: ... + def convert_to_pct(self, x: float) -> float: ... + @property + def symbol(self) -> str: ... + @symbol.setter + def symbol(self, symbol: str) -> None: ... + +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]: ... + def nonsingular(self, v0: float, v1: float) -> tuple[float, float]: ... + def view_limits(self, vmin: float, vmax: float) -> tuple[float, float]: ... + +class IndexLocator(Locator): + offset: float + def __init__(self, base: float, offset: float) -> None: ... + def set_params( + self, base: float | None = ..., offset: float | None = ... + ) -> None: ... + +class FixedLocator(Locator): + nbins: int | None + def __init__(self, locs: Sequence[float], nbins: int | None = ...) -> None: ... + def set_params(self, nbins: int | None = ...) -> None: ... + +class NullLocator(Locator): ... + +class LinearLocator(Locator): + presets: dict[tuple[float, float], Sequence[float]] + def __init__( + self, + numticks: int | None = ..., + presets: dict[tuple[float, float], Sequence[float]] | None = ..., + ) -> None: ... + @property + def numticks(self) -> int: ... + @numticks.setter + def numticks(self, numticks: int | None) -> None: ... + def set_params( + self, + numticks: int | None = ..., + presets: dict[tuple[float, float], Sequence[float]] | None = ..., + ) -> None: ... + +class MultipleLocator(Locator): + def __init__(self, base: float = ..., offset: float = ...) -> None: ... + def set_params(self, base: float | None = ..., offset: float | None = ...) -> None: ... + def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ... + +class _Edge_integer: + step: float + def __init__(self, step: float, offset: float) -> None: ... + def closeto(self, ms: float, edge: float) -> bool: ... + def le(self, x: float) -> float: ... + def ge(self, x: float) -> float: ... + +class MaxNLocator(Locator): + default_params: dict[str, Any] + def __init__(self, nbins: int | Literal["auto"] | None = ..., **kwargs) -> None: ... + def set_params(self, **kwargs) -> None: ... + def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ... + +class LogLocator(Locator): + numdecs: float + numticks: int | None + def __init__( + self, + base: float = ..., + subs: None | Literal["auto", "all"] | Sequence[float] = ..., + numdecs: float = ..., + numticks: int | None = ..., + ) -> None: ... + def set_params( + self, + base: float | None = ..., + subs: Literal["auto", "all"] | Sequence[float] | None = ..., + numdecs: float | None = ..., + numticks: int | None = ..., + ) -> None: ... + +class SymmetricalLogLocator(Locator): + numticks: int + def __init__( + self, + transform: Transform | None = ..., + subs: Sequence[float] | None = ..., + linthresh: float | None = ..., + base: float | None = ..., + ) -> None: ... + def set_params( + self, subs: Sequence[float] | None = ..., numticks: int | None = ... + ) -> None: ... + +class AsinhLocator(Locator): + linear_width: float + numticks: int + symthresh: float + base: int + subs: Sequence[float] | None + def __init__( + self, + linear_width: float, + numticks: int = ..., + symthresh: float = ..., + base: int = ..., + subs: Sequence[float] | None = ..., + ) -> None: ... + def set_params( + self, + numticks: int | None = ..., + symthresh: float | None = ..., + base: int | None = ..., + subs: Sequence[float] | None = ..., + ) -> None: ... + +class LogitLocator(MaxNLocator): + def __init__( + self, minor: bool = ..., *, nbins: Literal["auto"] | int = ... + ) -> None: ... + def set_params(self, minor: bool | None = ..., **kwargs) -> None: ... + @property + def minor(self) -> bool: ... + @minor.setter + def minor(self, value: bool) -> None: ... + +class AutoLocator(MaxNLocator): + def __init__(self) -> None: ... + +class AutoMinorLocator(Locator): + ndivs: int + def __init__(self, n: int | None = ...) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/transforms.pyi b/contrib/python/matplotlib/py3/matplotlib/transforms.pyi new file mode 100644 index 0000000000..90a527e5bf --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/transforms.pyi @@ -0,0 +1,335 @@ +from .path import Path +from .patches import Patch +from .figure import Figure +import numpy as np +from numpy.typing import ArrayLike +from collections.abc import Iterable, Sequence +from typing import Literal + +DEBUG: bool + +class TransformNode: + INVALID_NON_AFFINE: int + INVALID_AFFINE: int + INVALID: int + is_bbox: bool + # Implemented as a standard attr in base class, but functionally readonly and some subclasses implement as such + @property + def is_affine(self) -> bool: ... + pass_through: bool + def __init__(self, shorthand_name: str | None = ...) -> None: ... + def __copy__(self) -> TransformNode: ... + def invalidate(self) -> None: ... + def set_children(self, *children: TransformNode) -> None: ... + def frozen(self) -> TransformNode: ... + +class BboxBase(TransformNode): + is_bbox: bool + is_affine: bool + def frozen(self) -> Bbox: ... + def __array__(self, *args, **kwargs): ... + @property + def x0(self) -> float: ... + @property + def y0(self) -> float: ... + @property + def x1(self) -> float: ... + @property + def y1(self) -> float: ... + @property + def p0(self) -> tuple[float, float]: ... + @property + def p1(self) -> tuple[float, float]: ... + @property + def xmin(self) -> float: ... + @property + def ymin(self) -> float: ... + @property + def xmax(self) -> float: ... + @property + def ymax(self) -> float: ... + @property + def min(self) -> tuple[float, float]: ... + @property + def max(self) -> tuple[float, float]: ... + @property + def intervalx(self) -> tuple[float, float]: ... + @property + def intervaly(self) -> tuple[float, float]: ... + @property + def width(self) -> float: ... + @property + def height(self) -> float: ... + @property + def size(self) -> tuple[float, float]: ... + @property + def bounds(self) -> tuple[float, float, float, float]: ... + @property + def extents(self) -> tuple[float, float, float, float]: ... + def get_points(self) -> np.ndarray: ... + def containsx(self, x: float) -> bool: ... + def containsy(self, y: float) -> bool: ... + def contains(self, x: float, y: float) -> bool: ... + def overlaps(self, other: BboxBase) -> bool: ... + def fully_containsx(self, x: float) -> bool: ... + def fully_containsy(self, y: float) -> bool: ... + def fully_contains(self, x: float, y: float) -> bool: ... + def fully_overlaps(self, other: BboxBase) -> bool: ... + def transformed(self, transform: Transform) -> Bbox: ... + coefs: dict[str, tuple[float, float]] + # anchored type can be s/str/Literal["C", "SW", "S", "SE", "E", "NE", "N", "NW", "W"] + def anchored( + self, c: tuple[float, float] | str, container: BboxBase | None = ... + ) -> Bbox: ... + def shrunk(self, mx: float, my: float) -> Bbox: ... + def shrunk_to_aspect( + self, + box_aspect: float, + container: BboxBase | None = ..., + fig_aspect: float = ..., + ) -> Bbox: ... + def splitx(self, *args: float) -> list[Bbox]: ... + def splity(self, *args: float) -> list[Bbox]: ... + def count_contains(self, vertices: ArrayLike) -> int: ... + def count_overlaps(self, bboxes: Iterable[BboxBase]) -> int: ... + def expanded(self, sw: float, sh: float) -> Bbox: ... + def padded(self, w_pad: float, h_pad: float | None = ...) -> Bbox: ... + def translated(self, tx: float, ty: float) -> Bbox: ... + def corners(self) -> np.ndarray: ... + def rotated(self, radians: float) -> Bbox: ... + @staticmethod + def union(bboxes: Sequence[BboxBase]) -> Bbox: ... + @staticmethod + def intersection(bbox1: BboxBase, bbox2: BboxBase) -> Bbox | None: ... + +class Bbox(BboxBase): + def __init__(self, points: ArrayLike, **kwargs) -> None: ... + @staticmethod + def unit() -> Bbox: ... + @staticmethod + def null() -> Bbox: ... + @staticmethod + def from_bounds(x0: float, y0: float, width: float, height: float) -> Bbox: ... + @staticmethod + def from_extents(*args: float, minpos: float | None = ...) -> Bbox: ... + def __format__(self, fmt: str) -> str: ... + def ignore(self, value: bool) -> None: ... + def update_from_path( + self, + path: Path, + ignore: bool | None = ..., + updatex: bool = ..., + updatey: bool = ..., + ) -> None: ... + def update_from_data_x(self, x: ArrayLike, ignore: bool | None = ...) -> None: ... + def update_from_data_y(self, y: ArrayLike, ignore: bool | None = ...) -> None: ... + def update_from_data_xy( + self, + xy: ArrayLike, + ignore: bool | None = ..., + updatex: bool = ..., + updatey: bool = ..., + ) -> None: ... + @property + def minpos(self) -> float: ... + @property + def minposx(self) -> float: ... + @property + def minposy(self) -> float: ... + def get_points(self) -> np.ndarray: ... + def set_points(self, points: ArrayLike) -> None: ... + def set(self, other: Bbox) -> None: ... + def mutated(self) -> bool: ... + def mutatedx(self) -> bool: ... + def mutatedy(self) -> bool: ... + +class TransformedBbox(BboxBase): + def __init__(self, bbox: Bbox, transform: Transform, **kwargs) -> None: ... + def get_points(self) -> np.ndarray: ... + +class LockableBbox(BboxBase): + def __init__( + self, + bbox: BboxBase, + x0: float | None = ..., + y0: float | None = ..., + x1: float | None = ..., + y1: float | None = ..., + **kwargs + ) -> None: ... + @property + def locked_x0(self) -> float | None: ... + @locked_x0.setter + def locked_x0(self, x0: float | None) -> None: ... + @property + def locked_y0(self) -> float | None: ... + @locked_y0.setter + def locked_y0(self, y0: float | None) -> None: ... + @property + def locked_x1(self) -> float | None: ... + @locked_x1.setter + def locked_x1(self, x1: float | None) -> None: ... + @property + def locked_y1(self) -> float | None: ... + @locked_y1.setter + def locked_y1(self, y1: float | None) -> None: ... + +class Transform(TransformNode): + + # 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: ... + def contains_branch(self, other: Transform) -> bool: ... + def contains_branch_seperately( + self, other_transform: Transform + ) -> Sequence[bool]: ... + def __sub__(self, other: Transform) -> Transform: ... + def __array__(self, *args, **kwargs) -> np.ndarray: ... + def transform(self, values: ArrayLike) -> np.ndarray: ... + def transform_affine(self, values: ArrayLike) -> np.ndarray: ... + def transform_non_affine(self, values: ArrayLike) -> ArrayLike: ... + def transform_bbox(self, bbox: BboxBase) -> Bbox: ... + def get_affine(self) -> Transform: ... + def get_matrix(self) -> np.ndarray: ... + def transform_point(self, point: ArrayLike) -> np.ndarray: ... + def transform_path(self, path: Path) -> Path: ... + def transform_path_affine(self, path: Path) -> Path: ... + def transform_path_non_affine(self, path: Path) -> Path: ... + def transform_angles( + self, + angles: ArrayLike, + pts: ArrayLike, + radians: bool = ..., + pushoff: float = ..., + ) -> np.ndarray: ... + def inverted(self) -> Transform: ... + +class TransformWrapper(Transform): + pass_through: bool + def __init__(self, child: Transform) -> None: ... + def __eq__(self, other: object) -> bool: ... + def frozen(self) -> Transform: ... + def set(self, child: Transform) -> None: ... + +class AffineBase(Transform): + is_affine: Literal[True] + def __init__(self, *args, **kwargs) -> None: ... + def __eq__(self, other: object) -> bool: ... + +class Affine2DBase(AffineBase): + input_dims: Literal[2] + output_dims: Literal[2] + def frozen(self) -> Affine2D: ... + def to_values(self) -> tuple[float, float, float, float, float, float]: ... + +class Affine2D(Affine2DBase): + def __init__(self, matrix: ArrayLike | None = ..., **kwargs) -> None: ... + @staticmethod + def from_values( + a: float, b: float, c: float, d: float, e: float, f: float + ) -> Affine2D: ... + def set_matrix(self, mtx: ArrayLike) -> None: ... + def clear(self) -> Affine2D: ... + def rotate(self, theta: float) -> Affine2D: ... + def rotate_deg(self, degrees: float) -> Affine2D: ... + def rotate_around(self, x: float, y: float, theta: float) -> Affine2D: ... + def rotate_deg_around(self, x: float, y: float, degrees: float) -> Affine2D: ... + def translate(self, tx: float, ty: float) -> Affine2D: ... + def scale(self, sx: float, sy: float | None = ...) -> Affine2D: ... + def skew(self, xShear: float, yShear: float) -> Affine2D: ... + def skew_deg(self, xShear: float, yShear: float) -> Affine2D: ... + +class IdentityTransform(Affine2DBase): ... + +class _BlendedMixin: + def __eq__(self, other: object) -> bool: ... + def contains_branch_seperately(self, transform: Transform) -> Sequence[bool]: ... + +class BlendedGenericTransform(_BlendedMixin, Transform): + input_dims: Literal[2] + output_dims: Literal[2] + pass_through: bool + def __init__( + self, x_transform: Transform, y_transform: Transform, **kwargs + ) -> None: ... + @property + def depth(self) -> int: ... + def contains_branch(self, other: Transform) -> Literal[False]: ... + @property + def is_affine(self) -> bool: ... + +class BlendedAffine2D(_BlendedMixin, Affine2DBase): + def __init__( + self, x_transform: Transform, y_transform: Transform, **kwargs + ) -> None: ... + +def blended_transform_factory( + x_transform: Transform, y_transform: Transform +) -> BlendedGenericTransform | BlendedAffine2D: ... + +class CompositeGenericTransform(Transform): + pass_through: bool + def __init__(self, a: Transform, b: Transform, **kwargs) -> None: ... + +class CompositeAffine2D(Affine2DBase): + def __init__(self, a: Affine2DBase, b: Affine2DBase, **kwargs) -> None: ... + @property + def depth(self) -> int: ... + +def composite_transform_factory(a: Transform, b: Transform) -> Transform: ... + +class BboxTransform(Affine2DBase): + def __init__(self, boxin: BboxBase, boxout: BboxBase, **kwargs) -> None: ... + +class BboxTransformTo(Affine2DBase): + def __init__(self, boxout: BboxBase, **kwargs) -> None: ... + +class BboxTransformToMaxOnly(BboxTransformTo): ... + +class BboxTransformFrom(Affine2DBase): + def __init__(self, boxin: BboxBase, **kwargs) -> None: ... + +class ScaledTranslation(Affine2DBase): + def __init__( + self, xt: float, yt: float, scale_trans: Affine2DBase, **kwargs + ) -> None: ... + +class AffineDeltaTransform(Affine2DBase): + def __init__(self, transform: Affine2DBase, **kwargs) -> None: ... + +class TransformedPath(TransformNode): + def __init__(self, path: Path, transform: Transform) -> None: ... + def get_transformed_points_and_affine(self) -> tuple[Path, Transform]: ... + def get_transformed_path_and_affine(self) -> tuple[Path, Transform]: ... + def get_fully_transformed_path(self) -> Path: ... + def get_affine(self) -> Transform: ... + +class TransformedPatchPath(TransformedPath): + def __init__(self, patch: Patch) -> None: ... + +def nonsingular( + vmin: float, + vmax: float, + expander: float = ..., + tiny: float = ..., + increasing: bool = ..., +) -> tuple[float, float]: ... +def interval_contains(interval: tuple[float, float], val: float) -> bool: ... +def interval_contains_open(interval: tuple[float, float], val: float) -> bool: ... +def offset_copy( + trans: Transform, + fig: Figure | None = ..., + x: float = ..., + y: float = ..., + units: Literal["inches", "points", "dots"] = ..., +) -> Transform: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi new file mode 100644 index 0000000000..6e00b272ed --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_triangulation.pyi @@ -0,0 +1,33 @@ +from matplotlib import _tri +from matplotlib.tri._trifinder import TriFinder + +import numpy as np +from numpy.typing import ArrayLike +from typing import Any + +class Triangulation: + x: np.ndarray + y: np.ndarray + mask: np.ndarray | None + is_delaunay: bool + triangles: np.ndarray + def __init__( + self, + x: ArrayLike, + y: ArrayLike, + triangles: ArrayLike | None = ..., + mask: ArrayLike | None = ..., + ) -> None: ... + def calculate_plane_coefficients(self, z: ArrayLike) -> np.ndarray: ... + @property + def edges(self) -> np.ndarray: ... + def get_cpp_triangulation(self) -> _tri.Triangulation: ... + def get_masked_triangles(self) -> np.ndarray: ... + @staticmethod + def get_from_args_and_kwargs( + *args, **kwargs + ) -> tuple[Triangulation, tuple[Any, ...], dict[str, Any]]: ... + def get_trifinder(self) -> TriFinder: ... + @property + def neighbors(self) -> np.ndarray: ... + def set_mask(self, mask: None | ArrayLike) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi new file mode 100644 index 0000000000..31929d8661 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_tricontour.pyi @@ -0,0 +1,52 @@ +from matplotlib.axes import Axes +from matplotlib.contour import ContourSet +from matplotlib.tri._triangulation import Triangulation + +from numpy.typing import ArrayLike +from typing import overload + +# TODO: more explicit args/kwargs (for all things in this module)? + +class TriContourSet(ContourSet): + def __init__(self, ax: Axes, *args, **kwargs) -> None: ... + +@overload +def tricontour( + ax: Axes, + triangulation: Triangulation, + z: ArrayLike, + levels: int | ArrayLike = ..., + **kwargs +) -> TriContourSet: ... +@overload +def tricontour( + ax: Axes, + x: ArrayLike, + y: ArrayLike, + z: ArrayLike, + levels: int | ArrayLike = ..., + *, + triangles: ArrayLike = ..., + mask: ArrayLike = ..., + **kwargs +) -> TriContourSet: ... +@overload +def tricontourf( + ax: Axes, + triangulation: Triangulation, + z: ArrayLike, + levels: int | ArrayLike = ..., + **kwargs +) -> TriContourSet: ... +@overload +def tricontourf( + ax: Axes, + x: ArrayLike, + y: ArrayLike, + z: ArrayLike, + levels: int | ArrayLike = ..., + *, + triangles: ArrayLike = ..., + mask: ArrayLike = ..., + **kwargs +) -> TriContourSet: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi new file mode 100644 index 0000000000..41a9990b89 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_trifinder.pyi @@ -0,0 +1,10 @@ +from matplotlib.tri import Triangulation +from numpy.typing import ArrayLike + +class TriFinder: + def __init__(self, triangulation: Triangulation) -> None: ... + def __call__(self, x: ArrayLike, y: ArrayLike) -> ArrayLike: ... + +class TrapezoidMapTriFinder(TriFinder): + def __init__(self, triangulation: Triangulation) -> None: ... + def __call__(self, x: ArrayLike, y: ArrayLike) -> ArrayLike: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi new file mode 100644 index 0000000000..8a56b22acd --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_triinterpolate.pyi @@ -0,0 +1,30 @@ +from matplotlib.tri import Triangulation, TriFinder + +from typing import Literal +import numpy as np +from numpy.typing import ArrayLike + +class TriInterpolator: + def __init__( + self, + triangulation: Triangulation, + z: ArrayLike, + trifinder: TriFinder | None = ..., + ) -> None: ... + # __call__ and gradient are not actually implemented by the ABC, but are specified as required + def __call__(self, x: ArrayLike, y: ArrayLike) -> np.ma.MaskedArray: ... + def gradient( + self, x: ArrayLike, y: ArrayLike + ) -> tuple[np.ma.MaskedArray, np.ma.MaskedArray]: ... + +class LinearTriInterpolator(TriInterpolator): ... + +class CubicTriInterpolator(TriInterpolator): + def __init__( + self, + triangulation: Triangulation, + z: ArrayLike, + kind: Literal["min_E", "geom", "user"] = ..., + trifinder: TriFinder | None = ..., + dz: tuple[ArrayLike, ArrayLike] | None = ..., + ) -> None: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi new file mode 100644 index 0000000000..42acffcdc5 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_tripcolor.pyi @@ -0,0 +1,71 @@ +from matplotlib.axes import Axes +from matplotlib.collections import PolyCollection, TriMesh +from matplotlib.colors import Normalize, Colormap +from matplotlib.tri._triangulation import Triangulation + +from numpy.typing import ArrayLike + +from typing import overload, Literal + +@overload +def tripcolor( + ax: Axes, + triangulation: Triangulation, + c: ArrayLike = ..., + *, + alpha: float = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + shading: Literal["flat"] = ..., + facecolors: ArrayLike | None = ..., + **kwargs +) -> PolyCollection: ... +@overload +def tripcolor( + ax: Axes, + x: ArrayLike, + y: ArrayLike, + c: ArrayLike = ..., + *, + alpha: float = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + shading: Literal["flat"] = ..., + facecolors: ArrayLike | None = ..., + **kwargs +) -> PolyCollection: ... +@overload +def tripcolor( + ax: Axes, + triangulation: Triangulation, + c: ArrayLike = ..., + *, + alpha: float = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + shading: Literal["gouraud"], + facecolors: ArrayLike | None = ..., + **kwargs +) -> TriMesh: ... +@overload +def tripcolor( + ax: Axes, + x: ArrayLike, + y: ArrayLike, + c: ArrayLike = ..., + *, + alpha: float = ..., + norm: str | Normalize | None = ..., + cmap: str | Colormap | None = ..., + vmin: float | None = ..., + vmax: float | None = ..., + shading: Literal["gouraud"], + facecolors: ArrayLike | None = ..., + **kwargs +) -> TriMesh: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi new file mode 100644 index 0000000000..6224276afd --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_triplot.pyi @@ -0,0 +1,15 @@ +from matplotlib.tri._triangulation import Triangulation +from matplotlib.axes import Axes +from matplotlib.lines import Line2D + +from typing import overload +from numpy.typing import ArrayLike + +@overload +def triplot( + ax: Axes, triangulation: Triangulation, *args, **kwargs +) -> tuple[Line2D, Line2D]: ... +@overload +def triplot( + ax: Axes, x: ArrayLike, y: ArrayLike, triangles: ArrayLike = ..., *args, **kwargs +) -> tuple[Line2D, Line2D]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi new file mode 100644 index 0000000000..7c60dc76e2 --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_trirefine.pyi @@ -0,0 +1,31 @@ +from typing import Literal, overload + +import numpy as np +from numpy.typing import ArrayLike + +from matplotlib.tri._triangulation import Triangulation +from matplotlib.tri._triinterpolate import TriInterpolator + +class TriRefiner: + def __init__(self, triangulation: Triangulation) -> None: ... + +class UniformTriRefiner(TriRefiner): + def __init__(self, triangulation: Triangulation) -> None: ... + @overload + def refine_triangulation( + self, *, return_tri_index: Literal[True], subdiv: int = ... + ) -> tuple[Triangulation, np.ndarray]: ... + @overload + def refine_triangulation( + self, return_tri_index: Literal[False] = ..., subdiv: int = ... + ) -> Triangulation: ... + @overload + def refine_triangulation( + self, return_tri_index: bool = ..., subdiv: int = ... + ) -> tuple[Triangulation, np.ndarray] | Triangulation: ... + def refine_field( + self, + z: ArrayLike, + triinterpolator: TriInterpolator | None = ..., + subdiv: int = ..., + ) -> tuple[Triangulation, np.ndarray]: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi b/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi new file mode 100644 index 0000000000..9b5e1bec4b --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.pyi @@ -0,0 +1,12 @@ +from matplotlib.tri import Triangulation + +import numpy as np + +class TriAnalyzer: + def __init__(self, triangulation: Triangulation) -> None: ... + @property + def scale_factors(self) -> tuple[float, float]: ... + def circle_ratios(self, rescale: bool = ...) -> np.ndarray: ... + def get_flat_tri_mask( + self, min_circle_ratio: float = ..., rescale: bool = ... + ) -> np.ndarray: ... diff --git a/contrib/python/matplotlib/py3/matplotlib/widgets.pyi b/contrib/python/matplotlib/py3/matplotlib/widgets.pyi new file mode 100644 index 0000000000..00c2d0da8a --- /dev/null +++ b/contrib/python/matplotlib/py3/matplotlib/widgets.pyi @@ -0,0 +1,487 @@ +from .artist import Artist +from .axes import Axes +from .backend_bases import FigureCanvasBase, Event, MouseEvent, MouseButton +from .collections import LineCollection +from .figure import Figure +from .lines import Line2D +from .patches import Circle, Polygon, Rectangle +from .text import Text + +import PIL.Image + +from collections.abc import Callable, Collection, Iterable, Sequence +from typing import Any, Literal +from numpy.typing import ArrayLike +from .typing import ColorType +import numpy as np + +class LockDraw: + def __init__(self) -> None: ... + def __call__(self, o: Any) -> None: ... + def release(self, o: Any) -> None: ... + def available(self, o: Any) -> bool: ... + def isowner(self, o: Any) -> bool: ... + def locked(self) -> bool: ... + +class Widget: + drawon: bool + eventson: bool + active: bool + def set_active(self, active: bool) -> None: ... + def get_active(self) -> None: ... + def ignore(self, event) -> bool: ... + +class AxesWidget(Widget): + ax: Axes + canvas: FigureCanvasBase | None + def __init__(self, ax: Axes) -> None: ... + def connect_event(self, event: Event, callback: Callable) -> None: ... + def disconnect_events(self) -> None: ... + +class Button(AxesWidget): + label: Text + color: ColorType + hovercolor: ColorType + def __init__( + self, + ax: Axes, + label: str, + image: ArrayLike | PIL.Image.Image | None = ..., + color: ColorType = ..., + hovercolor: ColorType = ..., + *, + useblit: bool = ... + ) -> None: ... + def on_clicked(self, func: Callable[[Event], Any]) -> int: ... + def disconnect(self, cid: int) -> None: ... + +class SliderBase(AxesWidget): + orientation: Literal["horizontal", "vertical"] + closedmin: bool + closedmax: bool + valmin: float + valmax: float + valstep: float | ArrayLike | None + drag_active: bool + valfmt: str + def __init__( + self, + ax: Axes, + orientation: Literal["horizontal", "vertical"], + closedmin: bool, + closedmax: bool, + valmin: float, + valmax: float, + valfmt: str, + dragging: Slider | None, + valstep: float | ArrayLike | None, + ) -> None: ... + def disconnect(self, cid: int) -> None: ... + def reset(self) -> None: ... + +class Slider(SliderBase): + slidermin: Slider | None + slidermax: Slider | None + val: float + valinit: float + track: Rectangle + poly: Polygon + hline: Line2D + vline: Line2D + label: Text + valtext: Text + def __init__( + self, + ax: Axes, + label: str, + valmin: float, + valmax: float, + *, + valinit: float = ..., + valfmt: str | None = ..., + closedmin: bool = ..., + closedmax: bool = ..., + slidermin: Slider | None = ..., + slidermax: Slider | None = ..., + dragging: bool = ..., + valstep: float | ArrayLike | None = ..., + orientation: Literal["horizontal", "vertical"] = ..., + initcolor: ColorType = ..., + track_color: ColorType = ..., + handle_style: dict[str, Any] | None = ..., + **kwargs + ) -> None: ... + def set_val(self, val: float) -> None: ... + def on_changed(self, func: Callable[[float], Any]) -> int: ... + +class RangeSlider(SliderBase): + val: tuple[float, float] + valinit: tuple[float, float] + track: Rectangle + poly: Polygon + label: Text + valtext: Text + def __init__( + self, + ax: Axes, + label: str, + valmin: float, + valmax: float, + *, + valinit: tuple[float, float] | None = ..., + valfmt: str | None = ..., + closedmin: bool = ..., + closedmax: bool = ..., + dragging: bool = ..., + valstep: float | ArrayLike | None = ..., + orientation: Literal["horizontal", "vertical"] = ..., + track_color: ColorType = ..., + handle_style: dict[str, Any] | None = ..., + **kwargs + ) -> None: ... + def set_min(self, min: float) -> None: ... + def set_max(self, max: float) -> None: ... + def set_val(self, val: ArrayLike) -> None: ... + def on_changed(self, func: Callable[[tuple[float, float]], Any]) -> int: ... + +class CheckButtons(AxesWidget): + labels: list[Text] + def __init__( + self, + ax: Axes, + labels: Sequence[str], + actives: Iterable[bool] | None = ..., + *, + useblit: bool = ..., + label_props: dict[str, Any] | None = ..., + frame_props: dict[str, Any] | None = ..., + check_props: dict[str, Any] | None = ..., + ) -> None: ... + def set_label_props(self, props: dict[str, Any]) -> None: ... + def set_frame_props(self, props: dict[str, Any]) -> None: ... + def set_check_props(self, props: dict[str, Any]) -> None: ... + def set_active(self, index: int) -> None: ... + def get_status(self) -> list[bool]: ... + def on_clicked(self, func: Callable[[str], Any]) -> int: ... + def disconnect(self, cid: int) -> None: ... + @property + def lines(self) -> list[tuple[Line2D, Line2D]]: ... + @property + def rectangles(self) -> list[Rectangle]: ... + +class TextBox(AxesWidget): + label: Text + text_disp: Text + cursor_index: int + cursor: LineCollection + color: ColorType + hovercolor: ColorType + capturekeystrokes: bool + def __init__( + self, + ax: Axes, + label: str, + initial: str = ..., + *, + color: ColorType = ..., + hovercolor: ColorType = ..., + label_pad: float = ..., + textalignment: Literal["left", "center", "right"] = ..., + ) -> None: ... + @property + def text(self) -> str: ... + def set_val(self, val: str) -> None: ... + def begin_typing(self, x = ...) -> None: ... + def stop_typing(self) -> None: ... + def on_text_change(self, func: Callable[[str], Any]) -> int: ... + def on_submit(self, func: Callable[[str], Any]) -> int: ... + def disconnect(self, cid: int) -> None: ... + +class RadioButtons(AxesWidget): + activecolor: ColorType + value_selected: str + labels: list[Text] + def __init__( + self, + ax: Axes, + labels: Iterable[str], + active: int = ..., + activecolor: ColorType | None = ..., + *, + useblit: bool = ..., + label_props: dict[str, Any] | Sequence[dict[str, Any]] | None = ..., + radio_props: dict[str, Any] | None = ..., + ) -> None: ... + def set_label_props(self, props: dict[str, Any]) -> None: ... + def set_radio_props(self, props: dict[str, Any]) -> None: ... + def set_active(self, index: int) -> None: ... + def on_clicked(self, func: Callable[[str], Any]) -> int: ... + def disconnect(self, cid: int) -> None: ... + @property + def circles(self) -> list[Circle]: ... + +class SubplotTool(Widget): + figure: Figure + targetfig: Figure + buttonreset: Button + def __init__(self, targetfig: Figure, toolfig: Figure) -> None: ... + +class Cursor(AxesWidget): + visible: bool + horizOn: bool + vertOn: bool + useblit: bool + lineh: Line2D + linev: Line2D + background: Any + needclear: bool + def __init__( + self, + ax: Axes, + *, + horizOn: bool = ..., + vertOn: bool = ..., + useblit: bool = ..., + **lineprops + ) -> None: ... + def clear(self, event: Event) -> None: ... + def onmove(self, event: Event) -> None: ... + +class MultiCursor(Widget): + axes: Sequence[Axes] + horizOn: bool + vertOn: bool + visible: bool + useblit: bool + needclear: bool + vlines: list[Line2D] + hlines: list[Line2D] + def __init__( + self, + canvas: Any, + axes: Sequence[Axes], + *, + useblit: bool = ..., + horizOn: bool = ..., + vertOn: bool = ..., + **lineprops + ) -> None: ... + def connect(self) -> None: ... + def disconnect(self) -> None: ... + def clear(self, event: Event) -> None: ... + def onmove(self, event: Event) -> None: ... + +class _SelectorWidget(AxesWidget): + onselect: Callable[[float, float], Any] + useblit: bool + background: Any + validButtons: list[MouseButton] + def __init__( + self, + ax: Axes, + onselect: Callable[[float, float], Any], + useblit: bool = ..., + button: MouseButton | Collection[MouseButton] | None = ..., + state_modifier_keys: dict[str, str] | None = ..., + use_data_coordinates: bool = ..., + ) -> None: ... + def update_background(self, event: Event) -> None: ... + def connect_default_events(self) -> None: ... + def ignore(self, event: Event) -> bool: ... + def update(self) -> None: ... + def press(self, event: Event) -> bool: ... + def release(self, event: Event) -> bool: ... + def onmove(self, event: Event) -> bool: ... + def on_scroll(self, event: Event) -> None: ... + def on_key_press(self, event: Event) -> None: ... + def on_key_release(self, event: Event) -> None: ... + def set_visible(self, visible: bool) -> None: ... + def get_visible(self) -> bool: ... + @property + def visible(self) -> bool: ... + def clear(self) -> None: ... + @property + def artists(self) -> tuple[Artist]: ... + def set_props(self, **props) -> None: ... + def set_handle_props(self, **handle_props) -> None: ... + def add_state(self, state: str) -> None: ... + def remove_state(self, state: str) -> None: ... + +class SpanSelector(_SelectorWidget): + snap_values: ArrayLike | None + onmove_callback: Callable[[float, float], Any] + minspan: float + grab_range: float + drag_from_anywhere: bool + ignore_event_outside: bool + canvas: FigureCanvasBase | None + def __init__( + self, + ax: Axes, + onselect: Callable[[float, float], Any], + direction: Literal["horizontal", "vertical"], + *, + minspan: float = ..., + useblit: bool = ..., + props: dict[str, Any] | None = ..., + onmove_callback: Callable[[float, float], Any] | None = ..., + interactive: bool = ..., + button: MouseButton | Collection[MouseButton] | None = ..., + handle_props: dict[str, Any] | None = ..., + grab_range: float = ..., + state_modifier_keys: dict[str, str] | None = ..., + drag_from_anywhere: bool = ..., + ignore_event_outside: bool = ..., + snap_values: ArrayLike | None = ..., + ) -> None: ... + def new_axes(self, ax: Axes, *, _props: dict[str, Any] | None = ...) -> None: ... + def connect_default_events(self) -> None: ... + @property + def direction(self) -> Literal["horizontal", "vertical"]: ... + @direction.setter + def direction(self, direction: Literal["horizontal", "vertical"]) -> None: ... + @property + def extents(self) -> tuple[float, float]: ... + @extents.setter + def extents(self, extents: tuple[float, float]) -> None: ... + +class ToolLineHandles: + ax: Axes + def __init__( + self, + ax: Axes, + positions: ArrayLike, + direction: Literal["horizontal", "vertical"], + *, + line_props: dict[str, Any] | None = ..., + useblit: bool = ..., + ) -> None: ... + @property + def artists(self) -> tuple[Line2D]: ... + @property + def positions(self) -> list[float]: ... + @property + def direction(self) -> Literal["horizontal", "vertical"]: ... + def set_data(self, positions: ArrayLike) -> None: ... + def set_visible(self, value: bool) -> None: ... + def set_animated(self, value: bool) -> None: ... + def remove(self) -> None: ... + def closest(self, x: float, y: float) -> tuple[int, float]: ... + +class ToolHandles: + ax: Axes + def __init__( + self, + ax: Axes, + x: ArrayLike, + y: ArrayLike, + *, + marker: str = ..., + marker_props: dict[str, Any] | None = ..., + useblit: bool = ..., + ) -> None: ... + @property + def x(self) -> ArrayLike: ... + @property + def y(self) -> ArrayLike: ... + @property + def artists(self) -> tuple[Line2D]: ... + def set_data(self, pts: ArrayLike, y: ArrayLike | None = ...) -> None: ... + def set_visible(self, val: bool) -> None: ... + def set_animated(self, val: bool) -> None: ... + def closest(self, x: float, y: float) -> tuple[int, float]: ... + +class RectangleSelector(_SelectorWidget): + drag_from_anywhere: bool + ignore_event_outside: bool + minspanx: float + minspany: float + spancoords: Literal["data", "pixels"] + grab_range: float + def __init__( + self, + ax: Axes, + onselect: Callable[[MouseEvent, MouseEvent], Any], + *, + minspanx: float = ..., + minspany: float = ..., + useblit: bool = ..., + props: dict[str, Any] | None = ..., + spancoords: Literal["data", "pixels"] = ..., + button: MouseButton | Collection[MouseButton] | None = ..., + grab_range: float = ..., + handle_props: dict[str, Any] | None = ..., + interactive: bool = ..., + state_modifier_keys: dict[str, str] | None = ..., + drag_from_anywhere: bool = ..., + ignore_event_outside: bool = ..., + use_data_coordinates: bool = ..., + ) -> None: ... + @property + def corners(self) -> tuple[np.ndarray, np.ndarray]: ... + @property + def edge_centers(self) -> tuple[np.ndarray, np.ndarray]: ... + @property + def center(self) -> tuple[float, float]: ... + @property + def extents(self) -> tuple[float, float, float, float]: ... + @extents.setter + def extents(self, extents: tuple[float, float, float, float]) -> None: ... + @property + def rotation(self) -> float: ... + @rotation.setter + def rotation(self, value: float) -> None: ... + @property + def geometry(self) -> np.ndarray: ... + +class EllipseSelector(RectangleSelector): ... + +class LassoSelector(_SelectorWidget): + verts: None | list[tuple[float, float]] + def __init__( + self, + ax: Axes, + onselect: Callable[[list[tuple[float, float]]], Any], + *, + useblit: bool = ..., + props: dict[str, Any] | None = ..., + button: MouseButton | Collection[MouseButton] | None = ..., + ) -> None: ... + +class PolygonSelector(_SelectorWidget): + grab_range: float + def __init__( + self, + ax: Axes, + onselect: Callable[[ArrayLike, ArrayLike], Any], + *, + useblit: bool = ..., + props: dict[str, Any] | None = ..., + handle_props: dict[str, Any] | None = ..., + grab_range: float = ..., + draw_bounding_box: bool = ..., + box_handle_props: dict[str, Any] | None = ..., + box_props: dict[str, Any] | None = ... + ) -> None: ... + def onmove(self, event: Event) -> bool: ... + @property + def verts(self) -> list[tuple[float, float]]: ... + @verts.setter + def verts(self, xys: Sequence[tuple[float, float]]) -> None: ... + +class Lasso(AxesWidget): + useblit: bool + background: Any + verts: list[tuple[float, float]] | None + line: Line2D + callback: Callable[[list[tuple[float, float]]], Any] + def __init__( + self, + ax: Axes, + xy: tuple[float, float], + callback: Callable[[list[tuple[float, float]]], Any], + *, + useblit: bool = ..., + ) -> None: ... + def onrelease(self, event: Event) -> None: ... + def onmove(self, event: Event) -> None: ... |