diff options
| author | robot-piglet <[email protected]> | 2026-01-19 12:40:13 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2026-01-19 13:17:05 +0300 |
| commit | ef22f23d3970c53a3641f03aa87893f6cd49bff5 (patch) | |
| tree | 8e0f9c416b7aa9eb224366532aea285e9c6957cf /contrib/python/matplotlib | |
| parent | d58b08dfbe6d6a50b7b01eda4fb990a9cfdb2c2b (diff) | |
Intermediate changes
commit_hash:0cdb936337b75fb5b94e369f3df422e396ab25fd
Diffstat (limited to 'contrib/python/matplotlib')
3 files changed, 60 insertions, 6 deletions
diff --git a/contrib/python/matplotlib/py3/matplotlib/_fontconfig_pattern.py b/contrib/python/matplotlib/py3/matplotlib/_fontconfig_pattern.py index d3933b9f396..1e415e6c148 100644 --- a/contrib/python/matplotlib/py3/matplotlib/_fontconfig_pattern.py +++ b/contrib/python/matplotlib/py3/matplotlib/_fontconfig_pattern.py @@ -85,11 +85,11 @@ def parse_fontconfig_pattern(pattern): """ parser = _make_fontconfig_parser() try: - parse = parser.parseString(pattern) + parse = parser.parse_string(pattern) except ParseException as err: # explain becomes a plain method on pyparsing 3 (err.explain(0)). raise ValueError("\n" + ParseException.explain(err, 0)) from None - parser.resetCache() + parser.reset_cache() props = {} if "families" in parse: props["family"] = [*map(_family_unescape, parse["families"])] diff --git a/contrib/python/matplotlib/py3/matplotlib/_mathtext.py b/contrib/python/matplotlib/py3/matplotlib/_mathtext.py index b23cb67116e..a52bf3c2a6d 100644 --- a/contrib/python/matplotlib/py3/matplotlib/_mathtext.py +++ b/contrib/python/matplotlib/py3/matplotlib/_mathtext.py @@ -42,7 +42,7 @@ if T.TYPE_CHECKING: from collections.abc import Iterable from .ft2font import Glyph -ParserElement.enablePackrat() +ParserElement.enable_packrat() _log = logging.getLogger("matplotlib.mathtext") @@ -2159,7 +2159,7 @@ class Parser: ParserState(fonts_object, 'default', 'rm', fontsize, dpi)] self._em_width_cache: dict[tuple[str, float, float], float] = {} try: - result = self._expression.parseString(s) + result = self._expression.parse_string(s) except ParseBaseException as err: # explain becomes a plain method on pyparsing 3 (err.explain(0)). raise ValueError("\n" + ParseException.explain(err, 0)) from None @@ -2167,7 +2167,7 @@ class Parser: self._in_subscript_or_superscript = False # prevent operator spacing from leaking into a new expression self._em_width_cache = {} - ParserElement.resetCache() + ParserElement.reset_cache() return T.cast(Hlist, result[0]) # Known return type from main. def get_state(self) -> ParserState: @@ -2186,7 +2186,7 @@ class Parser: return [Hlist(toks.asList())] def math_string(self, toks: ParseResults) -> ParseResults: - return self._math_expression.parseString(toks[0][1:-1], parseAll=True) + return self._math_expression.parse_string(toks[0][1:-1], parseAll=True) def math(self, toks: ParseResults) -> T.Any: hlist = Hlist(toks.asList()) diff --git a/contrib/python/matplotlib/py3/patches/05-support-pyparsing-3.3.0.patch b/contrib/python/matplotlib/py3/patches/05-support-pyparsing-3.3.0.patch new file mode 100644 index 00000000000..aef73a57caa --- /dev/null +++ b/contrib/python/matplotlib/py3/patches/05-support-pyparsing-3.3.0.patch @@ -0,0 +1,54 @@ +--- contrib/python/matplotlib/py3/matplotlib/_fontconfig_pattern.py (index) ++++ contrib/python/matplotlib/py3/matplotlib/_fontconfig_pattern.py (working tree) +@@ -85,11 +85,11 @@ def parse_fontconfig_pattern(pattern): + """ + parser = _make_fontconfig_parser() + try: +- parse = parser.parseString(pattern) ++ parse = parser.parse_string(pattern) + except ParseException as err: + # explain becomes a plain method on pyparsing 3 (err.explain(0)). + raise ValueError("\n" + ParseException.explain(err, 0)) from None +- parser.resetCache() ++ parser.reset_cache() + props = {} + if "families" in parse: + props["family"] = [*map(_family_unescape, parse["families"])] +--- contrib/python/matplotlib/py3/matplotlib/_mathtext.py (index) ++++ contrib/python/matplotlib/py3/matplotlib/_mathtext.py (working tree) +@@ -42,7 +42,7 @@ if T.TYPE_CHECKING: + from collections.abc import Iterable + from .ft2font import Glyph + +-ParserElement.enablePackrat() ++ParserElement.enable_packrat() + _log = logging.getLogger("matplotlib.mathtext") + + +@@ -2159,7 +2159,7 @@ class Parser: + ParserState(fonts_object, 'default', 'rm', fontsize, dpi)] + self._em_width_cache: dict[tuple[str, float, float], float] = {} + try: +- result = self._expression.parseString(s) ++ result = self._expression.parse_string(s) + except ParseBaseException as err: + # explain becomes a plain method on pyparsing 3 (err.explain(0)). + raise ValueError("\n" + ParseException.explain(err, 0)) from None +@@ -2167,7 +2167,7 @@ class Parser: + self._in_subscript_or_superscript = False + # prevent operator spacing from leaking into a new expression + self._em_width_cache = {} +- ParserElement.resetCache() ++ ParserElement.reset_cache() + return T.cast(Hlist, result[0]) # Known return type from main. + + def get_state(self) -> ParserState: +@@ -2186,7 +2186,7 @@ class Parser: + return [Hlist(toks.asList())] + + def math_string(self, toks: ParseResults) -> ParseResults: +- return self._math_expression.parseString(toks[0][1:-1], parseAll=True) ++ return self._math_expression.parse_string(toks[0][1:-1], parseAll=True) + + def math(self, toks: ParseResults) -> T.Any: + hlist = Hlist(toks.asList()) |
