Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec6a139

Browse files
committed
Move StyleType to typing.RcStyleType
1 parent 9bf4e14 commit ec6a139

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

lib/matplotlib/style/core.pyi

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
from collections.abc import Generator
2-
from typing import Any, TypeAlias
3-
from pathlib import Path
42
import contextlib
53

64
from matplotlib import RcParams
7-
8-
StyleType: TypeAlias = str | dict[str, Any] | Path | list[str | Path | dict[str, Any]]
5+
from matplotlib.typing import RcStyleType
96

107
USER_LIBRARY_PATHS: list[str] = ...
118
STYLE_EXTENSION: str = ...
129

13-
def use(style: StyleType) -> None: ...
10+
def use(style: RcStyleType) -> None: ...
1411
@contextlib.contextmanager
1512
def context(
16-
style: StyleType, after_reset: bool = ...
13+
style: RcStyleType, after_reset: bool = ...
1714
) -> Generator[None, None, None]: ...
1815

1916
class _StyleLibrary(dict[str, RcParams]): ...

lib/matplotlib/typing.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
a deprecation period.
1111
"""
1212
from collections.abc import Sequence
13-
from typing import Literal, Union
13+
import pathlib
14+
from typing import Any, Literal, Union
1415

15-
from .path import Path
16+
from . import path
1617
from .markers import MarkerStyle
1718

1819
# The following are type aliases. Once python 3.9 is dropped, they should be annotated
@@ -34,5 +35,9 @@
3435
list[bool]
3536
]
3637

37-
MarkerType = Union[str, Path, MarkerStyle]
38+
MarkerType = Union[str, path.Path, MarkerStyle]
3839
FillStyleType = Literal["full", "left", "right", "bottom", "top", "none"]
40+
41+
RcStyleType = Union[
42+
str, dict[str, Any], pathlib.Path, list[Union[str, pathlib.Path, dict[str, Any]]]
43+
]

0 commit comments

Comments
 (0)