Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Create RCKeyType#30316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 9 commits intomatplotlib:mainfromZPyrolink:typing/rc
Oct 30, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletionslib/matplotlib/__init__.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ import contextlib
from packaging.version import Version

from matplotlib._api import MatplotlibDeprecationWarning
from matplotlib.typing import RcKeyType, RcGroupKeyType
from typing import Any, Literal, NamedTuple, overload
from matplotlib.typing import LogLevel

Expand DownExpand Up@@ -69,18 +70,18 @@ def get_cachedir() -> str: ...
def get_data_path() -> str: ...
def matplotlib_fname() -> str: ...

class RcParams(dict[str, Any]):
class RcParams(dict[RcKeyType, Any]):
validate: dict[str, Callable]
def __init__(self, *args, **kwargs) -> None: ...
def _set(self, key:str, val: Any) -> None: ...
def _get(self, key:str) -> Any: ...
def _set(self, key:RcKeyType, val: Any) -> None: ...
def _get(self, key:RcKeyType) -> Any: ...

def _update_raw(self, other_params: dict | RcParams) -> None: ...

def _ensure_has_backend(self) -> None: ...
def __setitem__(self, key:str, val: Any) -> None: ...
def __getitem__(self, key:str) -> Any: ...
def __iter__(self) -> Generator[str, None, None]: ...
def __setitem__(self, key:RcKeyType, val: Any) -> None: ...
def __getitem__(self, key:RcKeyType) -> Any: ...
def __iter__(self) -> Generator[RcKeyType, None, None]: ...
def __len__(self) -> int: ...
def find_all(self, pattern: str) -> RcParams: ...
def copy(self) -> RcParams: ...
Expand All@@ -95,17 +96,17 @@ def rc_params_from_file(
rcParamsDefault: RcParams
rcParams: RcParams
rcParamsOrig: RcParams
defaultParams: dict[str, Any]
defaultParams: dict[RcKeyType, Any]

def rc(group:str, **kwargs) -> None: ...
def rc(group:RcGroupKeyType, **kwargs) -> None: ...
def rcdefaults() -> None: ...
def rc_file_defaults() -> None: ...
def rc_file(
fname: str | Path | os.PathLike, *, use_default_template: bool = ...
) -> None: ...
@contextlib.contextmanager
def rc_context(
rc: dict[str, Any] | None = ..., fname: str | Path | os.PathLike | None = ...
rc: dict[RcKeyType, Any] | None = ..., fname: str | Path | os.PathLike | None = ...
) -> Generator[None, None, None]: ...
def use(backend: str, *, force: bool = ...) -> None: ...
@overload
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/_mathtext.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -570,7 +570,7 @@ def __init__(self, default_font_prop: FontProperties, load_glyph_flags: LoadFlag

super().__init__(default_font_prop, load_glyph_flags)
for texfont in "cal rm tt it bf sf bfit".split():
prop = mpl.rcParams['mathtext.' + texfont]
prop = mpl.rcParams['mathtext.' + texfont] # type: ignore[index]
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There is no getter for a group so I think ignoring the error is the only solution.

Copy link
Member

@timhoffmtimhoffmSep 8, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I assume mypy is complaining here. Would it help to make the list explicit?

fortexfontin ["cal","rm","tt","it","bf","sf","bfit"]:

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Unfortunately mypy considertextfont as astr and the sum also as str so we have the same error

timhoffm reacted with confused emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ok in that case, ignoring is likely the simplest solution.

font = findfont(prop)
self.fontmap[texfont] = font
prop = FontProperties('cmex10')
Expand Down
6 changes: 4 additions & 2 deletionslib/matplotlib/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,6 +143,8 @@
MarkerType,
MouseEventType,
PickEventType,
RcGroupKeyType,
RcKeyType,
ResizeEventType,
LogLevel
)
Expand DownExpand Up@@ -787,13 +789,13 @@ def pause(interval: float) -> None:


@_copy_docstring_and_deprecators(matplotlib.rc)
def rc(group:str, **kwargs) -> None:
def rc(group:RcGroupKeyType, **kwargs) -> None:
matplotlib.rc(group, **kwargs)


@_copy_docstring_and_deprecators(matplotlib.rc_context)
def rc_context(
rc: dict[str, Any] | None = None,
rc: dict[RcKeyType, Any] | None = None,
fname: str | pathlib.Path | os.PathLike | None = None,
) -> AbstractContextManager[None]:
return matplotlib.rc_context(rc, fname)
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp