Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/matplotlib/typing.py: 0%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

23 statements  

1""" 

2Typing support for Matplotlib 

3 

4This module contains Type aliases which are useful for Matplotlib and potentially 

5downstream libraries. 

6 

7.. admonition:: Provisional status of typing 

8 

9 The ``typing`` module and type stub files are considered provisional and may change 

10 at any time without a deprecation period. 

11""" 

12from collections.abc import Hashable, Sequence 

13import pathlib 

14from typing import Any, Literal, TypeVar, Union 

15 

16from . import path 

17from ._enums import JoinStyle, CapStyle 

18from .markers import MarkerStyle 

19 

20# The following are type aliases. Once python 3.9 is dropped, they should be annotated 

21# using ``typing.TypeAlias`` and Unions should be converted to using ``|`` syntax. 

22 

23RGBColorType = Union[tuple[float, float, float], str] 

24RGBAColorType = Union[ 

25 str, # "none" or "#RRGGBBAA"/"#RGBA" hex strings 

26 tuple[float, float, float, float], 

27 # 2 tuple (color, alpha) representations, not infinitely recursive 

28 # RGBColorType includes the (str, float) tuple, even for RGBA strings 

29 tuple[RGBColorType, float], 

30 # (4-tuple, float) is odd, but accepted as the outer float overriding A of 4-tuple 

31 tuple[tuple[float, float, float, float], float], 

32] 

33 

34ColorType = Union[RGBColorType, RGBAColorType] 

35 

36RGBColourType = RGBColorType 

37RGBAColourType = RGBAColorType 

38ColourType = ColorType 

39 

40LineStyleType = Union[str, tuple[float, Sequence[float]]] 

41DrawStyleType = Literal["default", "steps", "steps-pre", "steps-mid", "steps-post"] 

42MarkEveryType = Union[ 

43 None, int, tuple[int, int], slice, list[int], float, tuple[float, float], list[bool] 

44] 

45 

46MarkerType = Union[str, path.Path, MarkerStyle] 

47FillStyleType = Literal["full", "left", "right", "bottom", "top", "none"] 

48JoinStyleType = Union[JoinStyle, Literal["miter", "round", "bevel"]] 

49CapStyleType = Union[CapStyle, Literal["butt", "projecting", "round"]] 

50 

51RcStyleType = Union[ 

52 str, 

53 dict[str, Any], 

54 pathlib.Path, 

55 Sequence[Union[str, pathlib.Path, dict[str, Any]]], 

56] 

57 

58_HT = TypeVar("_HT", bound=Hashable) 

59HashableList = list[Union[_HT, "HashableList[_HT]"]] 

60"""A nested list of Hashable values."""