pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/matplotlib/matplotlib/commit/f734bb5d9ef2e0fb72d992464f6473407abf044b

.css" /> TYP: Hint typing aliases as TypeAlias · matplotlib/matplotlib@f734bb5 · GitHub
Skip to content

Commit f734bb5

Browse files
committed
TYP: Hint typing aliases as TypeAlias
1 parent 1bc4ab6 commit f734bb5

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

lib/matplotlib/typing.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@
1111
"""
1212
from collections.abc import Hashable, Sequence
1313
import pathlib
14-
from typing import Any, Literal, TypeVar
14+
from typing import Any, Literal, TypeAlias, TypeVar
1515

1616
from . import path
1717
from ._enums import JoinStyle, CapStyle
1818
from .markers import MarkerStyle
1919

20-
# The following are type aliases. Once python 3.9 is dropped, they should be annotated
21-
# using ``typing.TypeAlias``.
22-
23-
RGBColorType = tuple[float, float, float] | str
24-
RGBAColorType = (
20+
RGBColorType: TypeAlias = tuple[float, float, float] | str
21+
RGBAColorType: TypeAlias = (
2522
str | # "none" or "#RRGGBBAA"/"#RGBA" hex strings
2623
tuple[float, float, float, float] |
2724
# 2 tuple (color, alpha) representations, not infinitely recursive
@@ -31,33 +28,34 @@
3128
tuple[tuple[float, float, float, float], float]
3229
)
3330

34-
ColorType = RGBColorType | RGBAColorType
31+
ColorType: TypeAlias = RGBColorType | RGBAColorType
3532

36-
RGBColourType = RGBColorType
37-
RGBAColourType = RGBAColorType
38-
ColourType = ColorType
33+
RGBColourType: TypeAlias = RGBColorType
34+
RGBAColourType: TypeAlias = RGBAColorType
35+
ColourType: TypeAlias = ColorType
3936

40-
LineStyleType = str | tuple[float, Sequence[float]]
41-
DrawStyleType = Literal["default", "steps", "steps-pre", "steps-mid", "steps-post"]
42-
MarkEveryType = (
37+
LineStyleType: TypeAlias = str | tuple[float, Sequence[float]]
38+
DrawStyleType: TypeAlias = Literal["default", "steps", "steps-pre", "steps-mid",
39+
"steps-post"]
40+
MarkEveryType: TypeAlias = (
4341
None |
4442
int | tuple[int, int] | slice | list[int] |
4543
float | tuple[float, float] |
4644
list[bool]
4745
)
4846

49-
MarkerType = str | path.Path | MarkerStyle
50-
FillStyleType = Literal["full", "left", "right", "bottom", "top", "none"]
51-
JoinStyleType = JoinStyle | Literal["miter", "round", "bevel"]
52-
CapStyleType = CapStyle | Literal["butt", "projecting", "round"]
47+
MarkerType: TypeAlias = str | path.Path | MarkerStyle
48+
FillStyleType: TypeAlias = Literal["full", "left", "right", "bottom", "top", "none"]
49+
JoinStyleType: TypeAlias = JoinStyle | Literal["miter", "round", "bevel"]
50+
CapStyleType: TypeAlias = CapStyle | Literal["butt", "projecting", "round"]
5351

54-
RcStyleType = (
52+
RcStyleType: TypeAlias = (
5553
str |
5654
dict[str, Any] |
5755
pathlib.Path |
5856
Sequence[str | pathlib.Path | dict[str, Any]]
5957
)
6058

6159
_HT = TypeVar("_HT", bound=Hashable)
62-
HashableList = list[_HT | "HashableList[_HT]"]
60+
HashableList: TypeAlias = list[_HT | "HashableList[_HT]"]
6361
"""A nested list of Hashable values."""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy