mathtext.pyi 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. from typing import Generic, IO, Literal, TypeVar, overload
  3. from matplotlib.font_manager import FontProperties
  4. from matplotlib.typing import ColorType
  5. # Re-exported API from _mathtext.
  6. from ._mathtext import (
  7. RasterParse as RasterParse,
  8. VectorParse as VectorParse,
  9. get_unicode_index as get_unicode_index,
  10. )
  11. _ParseType = TypeVar("_ParseType", RasterParse, VectorParse)
  12. class MathTextParser(Generic[_ParseType]):
  13. @overload
  14. def __init__(self: MathTextParser[VectorParse], output: Literal["path"]) -> None: ...
  15. @overload
  16. def __init__(self: MathTextParser[RasterParse], output: Literal["agg", "raster", "macosx"]) -> None: ...
  17. def parse(
  18. self, s: str, dpi: float = ..., prop: FontProperties | None = ..., *, antialiased: bool | None = ...
  19. ) -> _ParseType: ...
  20. def math_to_image(
  21. s: str,
  22. filename_or_obj: str | os.PathLike | IO,
  23. prop: FontProperties | None = ...,
  24. dpi: float | None = ...,
  25. format: str | None = ...,
  26. *,
  27. color: ColorType | None = ...
  28. ) -> float: ...