Skip to content

Commit 430ef24

Browse files
authored
Merge branch 'matplotlib:main' into enh-29681-hr
2 parents 0e36c50 + b95676a commit 430ef24

File tree

11 files changed

+74
-27
lines changed

11 files changed

+74
-27
lines changed

.github/workflows/cibuildwheel.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
fetch-depth: 0
4545
persist-credentials: false
4646

47-
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
47+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4848
name: Install Python
4949
with:
5050
python-version: '3.11'
@@ -131,13 +131,13 @@ jobs:
131131

132132
steps:
133133
- name: Download sdist
134-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
134+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
135135
with:
136136
name: cibw-sdist
137137
path: dist/
138138

139139
- name: Build wheels for CPython 3.13
140-
uses: pypa/cibuildwheel@d04cacbc9866d432033b1d09142936e6a0e2121a # v2.23.2
140+
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
141141
with:
142142
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
143143
env:
@@ -148,15 +148,15 @@ jobs:
148148
CIBW_ARCHS: ${{ matrix.cibw_archs }}
149149

150150
- name: Build wheels for CPython 3.12
151-
uses: pypa/cibuildwheel@d04cacbc9866d432033b1d09142936e6a0e2121a # v2.23.2
151+
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
152152
with:
153153
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
154154
env:
155155
CIBW_BUILD: "cp312-*"
156156
CIBW_ARCHS: ${{ matrix.cibw_archs }}
157157

158158
- name: Build wheels for CPython 3.11
159-
uses: pypa/cibuildwheel@d04cacbc9866d432033b1d09142936e6a0e2121a # v2.23.2
159+
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
160160
with:
161161
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
162162
env:
@@ -165,7 +165,7 @@ jobs:
165165

166166

167167
- name: Build wheels for PyPy
168-
uses: pypa/cibuildwheel@d04cacbc9866d432033b1d09142936e6a0e2121a # v2.23.2
168+
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
169169
with:
170170
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
171171
env:
@@ -194,7 +194,7 @@ jobs:
194194
contents: read
195195
steps:
196196
- name: Download packages
197-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
197+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
198198
with:
199199
pattern: cibw-*
200200
path: dist
@@ -204,7 +204,7 @@ jobs:
204204
run: ls dist
205205

206206
- name: Generate artifact attestation for sdist and wheel
207-
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
207+
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
208208
with:
209209
subject-path: dist/matplotlib-*
210210

.github/workflows/codeql-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
persist-credentials: false
3232

3333
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
34+
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
3535
with:
3636
languages: ${{ matrix.language }}
3737

@@ -42,4 +42,4 @@ jobs:
4242
pip install --user -v .
4343
4444
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
45+
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16

.github/workflows/mypy-stubtest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
persist-credentials: false
1818

1919
- name: Set up Python 3
20-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
20+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2121
with:
2222
python-version: '3.11'
2323

.github/workflows/reviewdog.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
persist-credentials: false
1818

1919
- name: Set up Python 3
20-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
20+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2121
with:
2222
python-version: '3.11'
2323

@@ -46,7 +46,7 @@ jobs:
4646
persist-credentials: false
4747

4848
- name: Set up Python 3
49-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
49+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
5050
with:
5151
python-version: '3.11'
5252

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
persist-credentials: false
8585

8686
- name: Set up Python ${{ matrix.python-version }}
87-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
87+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
8888
with:
8989
python-version: ${{ matrix.python-version }}
9090
allow-prereleases: true

galleries/examples/animation/rain.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ def update(frame_number):
6767
scat.set_edgecolors(rain_drops['color'])
6868
scat.set_sizes(rain_drops['size'])
6969
scat.set_offsets(rain_drops['position'])
70+
return [scat]
7071

7172

7273
# Construct the animation, using the update function as the animation director.
73-
animation = FuncAnimation(fig, update, interval=10, save_count=100)
74+
animation = FuncAnimation(fig, update, interval=10, save_count=100, blit=True)
7475
plt.show()
7576

7677
# %%

lib/matplotlib/_mathtext.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import types
1515
import unicodedata
1616
import string
17+
import textwrap
1718
import typing as T
1819
from typing import NamedTuple
1920

@@ -1165,12 +1166,16 @@ def __init__(self, elements: T.Sequence[Node]):
11651166
self.glue_sign = 0 # 0: normal, -1: shrinking, 1: stretching
11661167
self.glue_order = 0 # The order of infinity (0 - 3) for the glue
11671168

1168-
def __repr__(self) -> str:
1169-
return '{}<w={:.02f} h={:.02f} d={:.02f} s={:.02f}>[{}]'.format(
1169+
def __repr__(self):
1170+
return "{}<w={:.02f} h={:.02f} d={:.02f} s={:.02f}>[{}]".format(
11701171
super().__repr__(),
11711172
self.width, self.height,
11721173
self.depth, self.shift_amount,
1173-
', '.join([repr(x) for x in self.children]))
1174+
"\n" + textwrap.indent(
1175+
"\n".join(map("{!r},".format, self.children)),
1176+
" ") + "\n"
1177+
if self.children else ""
1178+
)
11741179

11751180
def _set_glue(self, x: float, sign: int, totals: list[float],
11761181
error_type: str) -> None:
@@ -1604,7 +1609,7 @@ def clamp(value: float) -> float:
16041609
return -1e9 if value < -1e9 else +1e9 if value > +1e9 else value
16051610

16061611
def hlist_out(box: Hlist) -> None:
1607-
nonlocal cur_v, cur_h, off_h, off_v
1612+
nonlocal cur_v, cur_h
16081613

16091614
cur_g = 0
16101615
cur_glue = 0.
@@ -1667,7 +1672,7 @@ def hlist_out(box: Hlist) -> None:
16671672
cur_h += rule_width
16681673

16691674
def vlist_out(box: Vlist) -> None:
1670-
nonlocal cur_v, cur_h, off_h, off_v
1675+
nonlocal cur_v, cur_h
16711676

16721677
cur_g = 0
16731678
cur_glue = 0.

lib/matplotlib/axes/_axes.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class Axes(_AxesBase):
591591
weights: ArrayLike | None = ...,
592592
*,
593593
complementary: bool=...,
594-
orientation: Literal["vertical", "horizonatal"]=...,
594+
orientation: Literal["vertical", "horizontal"]=...,
595595
compress: bool=...,
596596
data=...,
597597
**kwargs

lib/matplotlib/pyplot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ def ecdf(
32473247
weights: ArrayLike | None = None,
32483248
*,
32493249
complementary: bool = False,
3250-
orientation: Literal["vertical", "horizonatal"] = "vertical",
3250+
orientation: Literal["vertical", "horizontal"] = "vertical",
32513251
compress: bool = False,
32523252
data=None,
32533253
**kwargs,

lib/matplotlib/tests/test_mathtext.py

+42-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from pathlib import Path
55
import platform
66
import re
7-
from xml.etree import ElementTree as ET
7+
import textwrap
88
from typing import Any
9+
from xml.etree import ElementTree as ET
910

1011
import numpy as np
1112
from packaging.version import parse as parse_version
@@ -16,7 +17,8 @@
1617
import matplotlib as mpl
1718
from matplotlib.testing.decorators import check_figures_equal, image_comparison
1819
import matplotlib.pyplot as plt
19-
from matplotlib import mathtext, _mathtext
20+
from matplotlib import font_manager as fm, mathtext, _mathtext
21+
from matplotlib.ft2font import LoadFlags
2022

2123
pyparsing_version = parse_version(pyparsing.__version__)
2224

@@ -558,3 +560,41 @@ def test_mathtext_operators():
558560
def test_boldsymbol(fig_test, fig_ref):
559561
fig_test.text(0.1, 0.2, r"$\boldsymbol{\mathrm{abc0123\alpha}}$")
560562
fig_ref.text(0.1, 0.2, r"$\mathrm{abc0123\alpha}$")
563+
564+
565+
def test_box_repr():
566+
s = repr(_mathtext.Parser().parse(
567+
r"$\frac{1}{2}$",
568+
_mathtext.DejaVuSansFonts(fm.FontProperties(), LoadFlags.NO_HINTING),
569+
fontsize=12, dpi=100))
570+
assert s == textwrap.dedent("""\
571+
Hlist<w=9.49 h=16.08 d=6.64 s=0.00>[
572+
Hlist<w=0.00 h=0.00 d=0.00 s=0.00>[],
573+
Hlist<w=9.49 h=16.08 d=6.64 s=0.00>[
574+
Hlist<w=9.49 h=16.08 d=6.64 s=0.00>[
575+
Vlist<w=7.40 h=22.72 d=0.00 s=6.64>[
576+
HCentered<w=7.40 h=8.67 d=0.00 s=0.00>[
577+
Glue,
578+
Hlist<w=7.40 h=8.67 d=0.00 s=0.00>[
579+
`1`,
580+
k2.36,
581+
],
582+
Glue,
583+
],
584+
Vbox,
585+
Hrule,
586+
Vbox,
587+
HCentered<w=7.40 h=8.84 d=0.00 s=0.00>[
588+
Glue,
589+
Hlist<w=7.40 h=8.84 d=0.00 s=0.00>[
590+
`2`,
591+
k2.02,
592+
],
593+
Glue,
594+
],
595+
],
596+
Hbox,
597+
],
598+
],
599+
Hlist<w=0.00 h=0.00 d=0.00 s=0.00>[],
600+
]""")

lib/matplotlib/tests/test_quiver.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ def test_quiver_memory_leak():
2626

2727
Q = draw_quiver(ax)
2828
ttX = Q.X
29+
orig_refcount = sys.getrefcount(ttX)
2930
Q.remove()
3031

3132
del Q
3233

33-
assert sys.getrefcount(ttX) == 2
34+
assert sys.getrefcount(ttX) < orig_refcount
3435

3536

3637
@pytest.mark.skipif(platform.python_implementation() != 'CPython',
@@ -43,9 +44,9 @@ def test_quiver_key_memory_leak():
4344
qk = ax.quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$',
4445
labelpos='W',
4546
fontproperties={'weight': 'bold'})
46-
assert sys.getrefcount(qk) == 3
47+
orig_refcount = sys.getrefcount(qk)
4748
qk.remove()
48-
assert sys.getrefcount(qk) == 2
49+
assert sys.getrefcount(qk) < orig_refcount
4950

5051

5152
def test_quiver_number_of_args():

0 commit comments

Comments
 (0)