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

Use functools.cache instead of lru_cache to establish singletons.#29581

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 1 commit intomatplotlib:mainfromanntzer:cache
Feb 6, 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
4 changes: 2 additions & 2 deletionslib/matplotlib/_fontconfig_pattern.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
# there would have created cyclical dependency problems, because it also needs
# to be available from `matplotlib.rcsetup` (for parsing matplotlibrc files).

from functools import lru_cache, partial
from functools importcache,lru_cache, partial
import re

from pyparsing import (
Expand DownExpand Up@@ -52,7 +52,7 @@
}


@lru_cache # The parser instance is a singleton.
@cache # The parser instance is a singleton.
def _make_fontconfig_parser():
def comma_separated(elem):
return elem + ZeroOrMore(Suppress(",") + elem)
Expand Down
4 changes: 2 additions & 2 deletionslib/matplotlib/dviread.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@

from collections import namedtuple
import enum
from functools import lru_cache, partial, wraps
from functools importcache,lru_cache, partial, wraps
import logging
import os
from pathlib import Path
Expand DownExpand Up@@ -1020,7 +1020,7 @@ def _parse_enc(path):


class _LuatexKpsewhich:
@lru_cache # A singleton.
@cache # A singleton.
def __new__(cls):
self = object.__new__(cls)
self._proc = self._new_proc()
Expand Down
6 changes: 3 additions & 3 deletionslib/matplotlib/font_manager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@
from base64 import b64encode
import copy
import dataclasses
from functools import lru_cache
from functools importcache,lru_cache
import functools
from io import BytesIO
import json
Expand DownExpand Up@@ -247,7 +247,7 @@ def _get_win32_installed_fonts():
return items


@lru_cache
@cache
def _get_fontconfig_fonts():
"""Cache and list the font paths known to ``fc-list``."""
try:
Expand All@@ -261,7 +261,7 @@ def _get_fontconfig_fonts():
return [Path(os.fsdecode(fname)) for fname in out.split(b'\n')]


@lru_cache
@cache
def _get_macos_fonts():
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``."""
try:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp