artist.pyi 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. from .axes._base import _AxesBase
  2. from .backend_bases import RendererBase, MouseEvent
  3. from .figure import Figure, SubFigure
  4. from .path import Path
  5. from .patches import Patch
  6. from .patheffects import AbstractPathEffect
  7. from .transforms import (
  8. BboxBase,
  9. Bbox,
  10. Transform,
  11. TransformedPatchPath,
  12. TransformedPath,
  13. )
  14. import numpy as np
  15. from collections.abc import Callable, Iterable
  16. from typing import Any, NamedTuple, TextIO, overload
  17. from numpy.typing import ArrayLike
  18. def allow_rasterization(draw): ...
  19. class _XYPair(NamedTuple):
  20. x: ArrayLike
  21. y: ArrayLike
  22. class _Unset: ...
  23. class Artist:
  24. zorder: float
  25. stale_callback: Callable[[Artist, bool], None] | None
  26. figure: Figure | SubFigure | None
  27. clipbox: BboxBase | None
  28. def __init__(self) -> None: ...
  29. def remove(self) -> None: ...
  30. def have_units(self) -> bool: ...
  31. # TODO units
  32. def convert_xunits(self, x): ...
  33. def convert_yunits(self, y): ...
  34. @property
  35. def axes(self) -> _AxesBase | None: ...
  36. @axes.setter
  37. def axes(self, new_axes: _AxesBase | None) -> None: ...
  38. @property
  39. def stale(self) -> bool: ...
  40. @stale.setter
  41. def stale(self, val: bool) -> None: ...
  42. def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
  43. def get_tightbbox(self, renderer: RendererBase | None = ...) -> Bbox | None: ...
  44. def add_callback(self, func: Callable[[Artist], Any]) -> int: ...
  45. def remove_callback(self, oid: int) -> None: ...
  46. def pchanged(self) -> None: ...
  47. def is_transform_set(self) -> bool: ...
  48. def set_transform(self, t: Transform | None) -> None: ...
  49. def get_transform(self) -> Transform: ...
  50. def get_children(self) -> list[Artist]: ...
  51. # TODO can these dicts be type narrowed? e.g. str keys
  52. def contains(self, mouseevent: MouseEvent) -> tuple[bool, dict[Any, Any]]: ...
  53. def pickable(self) -> bool: ...
  54. def pick(self, mouseevent: MouseEvent) -> None: ...
  55. def set_picker(
  56. self,
  57. picker: None
  58. | bool
  59. | float
  60. | Callable[[Artist, MouseEvent], tuple[bool, dict[Any, Any]]],
  61. ) -> None: ...
  62. def get_picker(
  63. self,
  64. ) -> None | bool | float | Callable[
  65. [Artist, MouseEvent], tuple[bool, dict[Any, Any]]
  66. ]: ...
  67. def get_url(self) -> str | None: ...
  68. def set_url(self, url: str | None) -> None: ...
  69. def get_gid(self) -> str | None: ...
  70. def set_gid(self, gid: str | None) -> None: ...
  71. def get_snap(self) -> bool | None: ...
  72. def set_snap(self, snap: bool | None) -> None: ...
  73. def get_sketch_params(self) -> tuple[float, float, float] | None: ...
  74. def set_sketch_params(
  75. self,
  76. scale: float | None = ...,
  77. length: float | None = ...,
  78. randomness: float | None = ...,
  79. ) -> None: ...
  80. def set_path_effects(self, path_effects: list[AbstractPathEffect]) -> None: ...
  81. def get_path_effects(self) -> list[AbstractPathEffect]: ...
  82. def get_figure(self) -> Figure | None: ...
  83. def set_figure(self, fig: Figure) -> None: ...
  84. def set_clip_box(self, clipbox: BboxBase | None) -> None: ...
  85. def set_clip_path(
  86. self,
  87. path: Patch | Path | TransformedPath | TransformedPatchPath | None,
  88. transform: Transform | None = ...,
  89. ) -> None: ...
  90. def get_alpha(self) -> float | None: ...
  91. def get_visible(self) -> bool: ...
  92. def get_animated(self) -> bool: ...
  93. def get_in_layout(self) -> bool: ...
  94. def get_clip_on(self) -> bool: ...
  95. def get_clip_box(self) -> Bbox | None: ...
  96. def get_clip_path(
  97. self,
  98. ) -> Patch | Path | TransformedPath | TransformedPatchPath | None: ...
  99. def get_transformed_clip_path_and_affine(
  100. self,
  101. ) -> tuple[None, None] | tuple[Path, Transform]: ...
  102. def set_clip_on(self, b: bool) -> None: ...
  103. def get_rasterized(self) -> bool: ...
  104. def set_rasterized(self, rasterized: bool) -> None: ...
  105. def get_agg_filter(self) -> Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None: ...
  106. def set_agg_filter(
  107. self, filter_func: Callable[[ArrayLike, float], tuple[np.ndarray, float, float]] | None
  108. ) -> None: ...
  109. def draw(self, renderer: RendererBase) -> None: ...
  110. def set_alpha(self, alpha: float | None) -> None: ...
  111. def set_visible(self, b: bool) -> None: ...
  112. def set_animated(self, b: bool) -> None: ...
  113. def set_in_layout(self, in_layout: bool) -> None: ...
  114. def get_label(self) -> object: ...
  115. def set_label(self, s: object) -> None: ...
  116. def get_zorder(self) -> float: ...
  117. def set_zorder(self, level: float) -> None: ...
  118. @property
  119. def sticky_edges(self) -> _XYPair: ...
  120. def update_from(self, other: Artist) -> None: ...
  121. def properties(self) -> dict[str, Any]: ...
  122. def update(self, props: dict[str, Any]) -> list[Any]: ...
  123. def _internal_update(self, kwargs: Any) -> list[Any]: ...
  124. def set(self, **kwargs: Any) -> list[Any]: ...
  125. def findobj(
  126. self,
  127. match: None | Callable[[Artist], bool] | type[Artist] = ...,
  128. include_self: bool = ...,
  129. ) -> list[Artist]: ...
  130. def get_cursor_data(self, event: MouseEvent) -> Any: ...
  131. def format_cursor_data(self, data: Any) -> str: ...
  132. def get_mouseover(self) -> bool: ...
  133. def set_mouseover(self, mouseover: bool) -> None: ...
  134. @property
  135. def mouseover(self) -> bool: ...
  136. @mouseover.setter
  137. def mouseover(self, mouseover: bool) -> None: ...
  138. class ArtistInspector:
  139. oorig: Artist | type[Artist]
  140. o: type[Artist]
  141. aliasd: dict[str, set[str]]
  142. def __init__(
  143. self, o: Artist | type[Artist] | Iterable[Artist | type[Artist]]
  144. ) -> None: ...
  145. def get_aliases(self) -> dict[str, set[str]]: ...
  146. def get_valid_values(self, attr: str) -> str | None: ...
  147. def get_setters(self) -> list[str]: ...
  148. @staticmethod
  149. def number_of_parameters(func: Callable) -> int: ...
  150. @staticmethod
  151. def is_alias(method: Callable) -> bool: ...
  152. def aliased_name(self, s: str) -> str: ...
  153. def aliased_name_rest(self, s: str, target: str) -> str: ...
  154. @overload
  155. def pprint_setters(
  156. self, prop: None = ..., leadingspace: int = ...
  157. ) -> list[str]: ...
  158. @overload
  159. def pprint_setters(self, prop: str, leadingspace: int = ...) -> str: ...
  160. @overload
  161. def pprint_setters_rest(
  162. self, prop: None = ..., leadingspace: int = ...
  163. ) -> list[str]: ...
  164. @overload
  165. def pprint_setters_rest(self, prop: str, leadingspace: int = ...) -> str: ...
  166. def properties(self) -> dict[str, Any]: ...
  167. def pprint_getters(self) -> list[str]: ...
  168. def getp(obj: Artist, property: str | None = ...) -> Any: ...
  169. get = getp
  170. def setp(obj: Artist, *args, file: TextIO | None = ..., **kwargs) -> list[Any] | None: ...
  171. def kwdoc(artist: Artist | type[Artist] | Iterable[Artist | type[Artist]]) -> str: ...