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

Appearance settings

Commit e4905bf

Browse filesBrowse files
authored
Merge pull request #26467 from ksunden/np2_repr_change
MNT: Adjust for upcoming numpy repr changes
2 parents f250998 + 046fac2 commit e4905bf
Copy full SHA for e4905bf

File tree

2 files changed

+15
-14
lines changed
Filter options

2 files changed

+15
-14
lines changed

‎lib/matplotlib/_type1font.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_type1font.py
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ def _read(self, file):
396396
elif type == 3: # end of file
397397
break
398398
else:
399-
raise RuntimeError('Unknown segment type %d in pfb file' %
400-
type)
399+
raise RuntimeError('Unknown segment type %d in pfb file' % type)
401400

402401
return data
403402

@@ -725,7 +724,7 @@ def transform(self, effects):
725724

726725
if 'slant' in effects:
727726
slant = effects['slant']
728-
fontname += '_Slant_%d' % int(1000 * slant)
727+
fontname += f'_Slant_{int(1000 * slant)}'
729728
italicangle = round(
730729
float(italicangle) - np.arctan(slant) / np.pi * 180,
731730
5
@@ -734,21 +733,21 @@ def transform(self, effects):
734733

735734
if 'extend' in effects:
736735
extend = effects['extend']
737-
fontname += '_Extend_%d' % int(1000 * extend)
736+
fontname += f'_Extend_{int(1000 * extend)}'
738737
modifier[0, 0] = extend
739738

740739
newmatrix = np.dot(modifier, oldmatrix)
741740
array[::2] = newmatrix[0:3, 0]
742741
array[1::2] = newmatrix[0:3, 1]
743742
fontmatrix = (
744-
'[%s]' % ' '.join(_format_approx(x, 6) for x in array)
743+
f"[{' '.join(_format_approx(x, 6) for x in array)}]"
745744
)
746745
replacements = (
747-
[(x, '/FontName/%s def' % fontname)
746+
[(x, f'/FontName/{fontname} def')
748747
for x in self._pos['FontName']]
749-
+ [(x, '/ItalicAngle %a def' % italicangle)
748+
+ [(x, f'/ItalicAngle {italicangle} def')
750749
for x in self._pos['ItalicAngle']]
751-
+ [(x, '/FontMatrix %s readonly def' % fontmatrix)
750+
+ [(x, f'/FontMatrix {fontmatrix} readonly def')
752751
for x in self._pos['FontMatrix']]
753752
+ [(x, '') for x in self._pos.get('UniqueID', [])]
754753
)

‎lib/matplotlib/backends/backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -990,12 +990,14 @@ def savefig(self, figure=None, **kwargs):
990990
# luatex<0.85; they were renamed to \pagewidth and \pageheight
991991
# on luatex>=0.85.
992992
self._file.write(
993-
br'\newpage'
994-
br'\ifdefined\pdfpagewidth\pdfpagewidth'
995-
br'\else\pagewidth\fi=%ain'
996-
br'\ifdefined\pdfpageheight\pdfpageheight'
997-
br'\else\pageheight\fi=%ain'
998-
b'%%\n' % (width, height)
993+
(
994+
r'\newpage'
995+
r'\ifdefined\pdfpagewidth\pdfpagewidth'
996+
fr'\else\pagewidth\fi={width}in'
997+
r'\ifdefined\pdfpageheight\pdfpageheight'
998+
fr'\else\pageheight\fi={height}in'
999+
'%%\n'
1000+
).encode("ascii")
9991001
)
10001002
figure.savefig(self._file, format="pgf", **kwargs)
10011003
self._n_figures += 1

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.